--- language: - vi license: cc-by-nc-4.0 task_categories: - video-classification - image-to-video tags: - talking-face - landmark - lip-sync - vietnamese - audio-visual pretty_name: 'VAVD: Vietnamese Visual-Audio Dataset' size_categories: - 1K **Note:** This dataset does not directly host video files. Instead, [`video_sources.csv`](video_sources.csv) provides the 123 public YouTube source URLs. The full dataset can be automatically downloaded and processed using [`download_dataset.py`](download_dataset.py). --- ## Dataset Summary | Split | Clips | Speakers | |-------|------:|--------:| | Train | 3,541 | ~118 | | Val | 338 | ~66 | | Test | 239 | ~52 | | **Total** | **4,118** | **123** | The dataset is constructed from two sources: - `vilap_dataset`: 1,630 clips from the main training set - `vilap_dataset_extra_10h`: 2,488 clips from the extended crawl The videos are collected from public Vietnamese YouTube sources, including news programs, interviews, and talk shows. Each sample is a short single-speaker clip of approximately 5 seconds, processed at 25 FPS. --- ## Quick Start ```bash # 1. Clone the dataset repository from Hugging Face git clone https://huggingface.co/datasets/btlam2002/VAVD cd VAVD # 2. Install the required dependencies pip install yt-dlp mediapipe opencv-python librosa scipy numpy # 3. Download and process the full dataset # This automatically downloads videos, cuts clips, extracts faces, landmarks, and audio features python download_dataset.py --output ./vilap_data # Or download only the test split for a quick trial (~239 clips) python download_dataset.py --output ./vilap_data --splits test # Or process only specific videos python download_dataset.py --output ./vilap_data --video_ids 3p7dFrIx5bk xwsPD6xiPbI ``` The `download_dataset.py` pipeline automatically performs the following steps: 1. **Download videos** from YouTube using `yt-dlp` with a maximum resolution of 720p. 2. **Cut clips** into 5-second segments using `ffmpeg`. 3. **Extract face crops** at 128×128 pixels using MediaPipe Face Detection. 4. **Extract landmarks** using MediaPipe Face Mesh, including 74 pose landmarks and 57 content landmarks. 5. **Extract audio features**, including 16 kHz WAV files and Mel-spectrogram `.npy` files following the IP-LAP convention. --- ## Video Sources All video URLs are listed in [`video_sources.csv`](video_sources.csv). | Column | Description | |--------|-------------| | `video_id` | YouTube video ID, also used as the speaker folder name | | `youtube_url` | Full YouTube URL | | `title` | Video title | | `channel` | YouTube channel name | | `source` | Dataset source, either `vilap_dataset` or `vilap_dataset_extra_10h` | | `n_train_clips` | Number of clips in the training split | | `n_val_clips` | Number of clips in the validation split | | `n_test_clips` | Number of clips in the test split | | `n_total_clips` | Total number of clips from the video | Example: ```csv video_id,youtube_url,title,channel,source,n_train_clips,n_val_clips,n_test_clips,n_total_clips 3p7dFrIx5bk,https://www.youtube.com/watch?v=3p7dFrIx5bk,Chuyên gia phân tích...,VTV24,vilap_dataset,68,1,1,70 ``` --- ## Directory Structure ```text vilap_dataset/ ├── 02_clips/ │ └── / │ └── _cNNNN.mp4 # raw clip, 25 FPS, 1280×720 ├── 03_face/ │ └── // │ └── {frame_id}.png # 128×128 face crop ├── 04_sketch/ │ └── // │ └── {frame_id}.png # optional sketch image ├── 05_landmark/ │ └── // │ └── {frame_id}.npy # per-frame landmark dictionary └── 06_audio/ └── // ├── audio.npy # Mel-spectrogram, shape [T, 80] └── audio.wav # 16 kHz mono WAV file ``` --- ## Landmark Format Each `.npy` landmark file contains a Python dictionary and can be loaded with `allow_pickle=True`. ```python d = np.load("05_landmark/spk/spk_c0000/0.npy", allow_pickle=True).item() # d.keys() → ['pose_landmarks', 'content_landmarks'] ``` | Field | Points | Description | |-------|-------:|-------------| | `pose_landmarks` | 74 | Jaw and upper-face structural landmarks | | `content_landmarks` | 57 | Lip and lower-face landmarks, including jaw `0:17`, outer lip `17:37`, and inner lip `37:57` | Each landmark is stored as a list of `[landmark_id, x, y]` triplets, where `x` and `y` are normalized to the face crop range `[0.0, 1.0]`. ```python # Example: read one frame import numpy as np d = np.load("frame_0.npy", allow_pickle=True).item() content = d["content_landmarks"] # list of [id, x, y], 57 points pose = d["pose_landmarks"] # list of [id, x, y], 74 points # Sort landmarks according to the IP-LAP ori_sequence_idx before feeding them into the model. ``` --- ## Audio Format | Property | Value | |----------|-------| | Sample rate | 16,000 Hz | | Channels | Mono | | Mel bands | 80 | | FFT size | 800 | | Hop size | 200 samples | | Frame rate | 25 FPS, aligned with video | ```python # Load Mel-spectrogram mel = np.load("audio.npy") # shape: [T_mel_frames, 80] # Extract a 16-frame Mel window for frame i following the IP-LAP convention frame_idx = 50 audio_offset = -2 # -4 recommended offset for Vietnamese speech start = int(80.0 * ((frame_idx + audio_offset) / 25.0)) window = mel[start : start + 16, :] # shape: [16, 80] ``` --- ## File Lists The `filelists/` directory provides pre-computed train, validation, and test splits. ```text filelists/ ├── train.txt # 3,541 clips, 86.0% ├── val.txt # 338 clips, 8.2% └── test.txt # 239 clips, 5.8% ``` Each line stores a clip key in the format `/`. ```text 3p7dFrIx5bk/3p7dFrIx5bk_c0000 3p7dFrIx5bk/3p7dFrIx5bk_c0001 ... ``` The following example shows how to resolve the actual data paths: ```python from pathlib import Path DATA_BASE = Path("path/to/vilap_dataset") clip_key = "3p7dFrIx5bk/3p7dFrIx5bk_c0017" dirname, vidname = clip_key.split("/") face_dir = DATA_BASE / "03_face" / dirname / vidname lm_dir = DATA_BASE / "05_landmark" / dirname / vidname audio_npy = DATA_BASE / "06_audio" / dirname / vidname / "audio.npy" audio_wav = DATA_BASE / "06_audio" / dirname / vidname / "audio.wav" ``` --- ## Loading a Full Clip ```python import numpy as np import torch from pathlib import Path DATA_BASE = Path("vilap_dataset") ORI_SEQUENCE_IDX = [ 162, 127, 234, 93, 132, 58, 172, 136, 150, 149, 176, 148, 152, 377, 400, 378, 379, 365, 397, 288, 361, 323, 454, 356, 389, 70, 63, 105, 66, 107, 55, 65, 52, 53, 46, 336, 296, 334, 293, 300, 276, 283, 282, 295, 285, 168, 6, 197, 195, 5, 48, 115, 220, 45, 4, 275, 440, 344, 278, 33, 246, 161, 160, 159, 158, 157, 173, 133, 155, 154, 153, 145, 144, 163, 7, 362, 398, 384, 385, 386, 387, 388, 466, 263, 249, 390, 373, 374, 380, 381, 382, 61, 185, 40, 39, 37, 0, 267, 269, 270, 409, 291, 375, 321, 405, 314, 17, 84, 181, 91, 146, 78, 191, 80, 81, 82, 13, 312, 311, 310, 415, 308, 324, 318, 402, 317, 14, 87, 178, 88, 95, ] def load_clip(clip_key, data_base): dirname, vidname = clip_key.split("/") lm_dir = data_base / "05_landmark" / dirname / vidname npys = sorted(lm_dir.glob("*.npy"), key=lambda p: int(p.stem)) frame_ids = [int(p.stem) for p in npys] pose_list, content_list = [], [] for fid in frame_ids: d = np.load(lm_dir / f"{fid}.npy", allow_pickle=True).item() for key, pts, n in [ ("pose_landmarks", pose_list, 74), ("content_landmarks", content_list, 57), ]: lm = sorted(d[key], key=lambda t: ORI_SEQUENCE_IDX.index(int(t[0]))) arr = torch.zeros(2, n) arr[0] = torch.tensor([float(t[1]) for t in lm]) arr[1] = torch.tensor([float(t[2]) for t in lm]) pts.append(arr) all_pose = torch.stack(pose_list) # shape: [N, 2, 74] all_content = torch.stack(content_list) # shape: [N, 2, 57] mel = np.load(data_base / "06_audio" / dirname / vidname / "audio.npy") return all_pose, all_content, mel, frame_ids pose, content, mel, fids = load_clip( "3p7dFrIx5bk/3p7dFrIx5bk_c0017", DATA_BASE, ) print( f"Frames: {len(fids)}, " f"pose: {pose.shape}, " f"content: {content.shape}, " f"mel: {mel.shape}" ) ``` --- ## Processing New Videos To generate the dataset from raw videos, use the pipeline provided in [`scripts/process_vilap_data_pipeline.py`](../../scripts/process_vilap_data_pipeline.py). ```text Step 1: Download or prepare raw .mp4 videos → 02_clips/ Step 2: Detect and crop faces → 03_face/ Step 3: Generate sketches, optional → 04_sketch/ Step 4: Extract MediaPipe landmarks → 05_landmark/ Step 5: Extract and resample audio → 06_audio/ ``` Requirements: - Python 3.10.2 - `mediapipe` - `librosa` - `opencv-python` - `ffmpeg` For Mel-spectrogram extraction details consistent with IP-LAP, see [`scripts/preprocess_audio.py`](../../third_party/IP_LAP/preprocess/preprocess_audio.py). --- --- --- ## License This dataset is released under the Creative Commons Attribution-NonCommercial 4.0 International License, CC BY-NC 4.0. The original videos are sourced from publicly available YouTube content. The dataset is intended for research and non-commercial use only.