Locate generated results
masterresults/ directory of the repository.repository·master·Indexed 12 days ago
https://github.com/rudrabha/wav2lipA tool for accurately lip-syncing videos to audio. It offers an open-source version for research and a commercial API via the Sync.so infrastructure with Python (syncsdk) and TypeScript (@sync.so/sdk) SDKs. Features include support for the lipsync-2 model, LSE-D and LSE-C quality metrics, and options for training standard or GAN-based models using datasets like LRS2, LRS3, and LRW.
results/ directory of the repository.When training or fine-tuning on datasets other than LRS2, keep the following in mind:
0.25 and the Wav2Lip eval sync loss should reach approximately 0.2.pytorch-fid repository. The process involves dumping all frames from both the ground-truth videos and the generated videos, then calculating the FID score between these frame sets.Before training, you must preprocess the LRS2 dataset. The dataset should follow this structure:
data_root (mvlrs_v1)
├── main
| └── [five-digit numbered video IDs].mp4Place your LRS2 filelists (train.txt, val.txt, test.txt) in the filelists/ folder, then run:
python preprocess.py --data_root data_root/main --preprocessed_root lrs2_preprocessed/python preprocess.py --data_root data_root/main --preprocessed_root lrs2_preprocessed/You need to download the pre-trained weights to perform inference. There are two main versions available:
Download links can be found in the 'Getting the weights' section of the repository documentation.
After setting up syncnet_python, you must copy the Wav2Lip evaluation scripts into the syncnet_python directory to run the calculations.
.py and .sh files into the syncnet_python folder.cd Wav2Lip/evaluation/scores_LSE/
cp *.py syncnet_python/
cp *.sh syncnet_python/The evaluation/test_filelists/ directory contains filelists for evaluating the Wav2Lip model on standard datasets: LRS2, LRS3, and LRW. Each filelist contains the names of audio-video pairs from the respective test sets.
Usage Restrictions:
To evaluate lip-sync quality using LSE-D and LSE-C metrics, you must set up a separate environment using the syncnet_python repository to avoid dependency conflicts with the main Wav2Lip installation.
syncnet_python repository.git clone https://github.com/joonson/syncnet_python.git
cd syncnet_python
pip install -r requirements.txt
sh download_model.shTo use the commercial Wav2Lip API via Python, install the syncsdk package using pip.
pip install syncsdkUse the SyncClient to submit a lip-sync generation job. The client.generations.create method accepts an array of input objects (type video or audio) and a model string (e.g., lipsync-2). After receiving a jobId, poll client.generations.get(jobId) until the status reaches COMPLETED or FAILED.
import { SyncClient, SyncError } from "@sync.so/sdk";
const apiKey = "YOUR_API_KEY_HERE";
const videoUrl = "https://assets.sync.so/docs/example-video.mp4";
const audioUrl = "https://assets.sync.so/docs/example-audio.wav";
const client = new SyncClient({ apiKey });
async function main() {
try {
const response = await client.generations.create({
input: [
{ type: "video", url: videoUrl },
{ type: "audio", url: audioUrl },
],
model: "lipsync-2",
options: { sync_mode: "cut_off" },
outputFileName: "quickstart"
});
const jobId = response.id;
let status = '';
let generation;
while (status !== 'COMPLETED' && status !== 'FAILED') {
await new Promise(resolve => setTimeout(resolve, 10000));
generation = await client.generations.get(jobId);
status = generation.status;
}
if (status === 'COMPLETED') {
console.log('output url:', generation?.outputUrl);
}
} catch (err) {
if (err instanceof SyncError) {
console.error(`Error: ${err.statusCode} ${JSON.stringify(err.body)}`);
}
}
}
main();The ReSynCED sub-folder contains filelists for the Real-world lip-Sync Evaluation Dataset (ReSyncED), which is a custom benchmark used in the Wav2Lip paper.
To use these filelists, refer to the instructions provided in the README of the parent directory.
To use the commercial Wav2Lip API via TypeScript, install the @sync.so/sdk package using npm.
npm i @sync.so/sdk