### Install Fairseq Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Install the fairseq library by navigating to its directory and using pip with an editable install. ```Shell cd tools/fairseq/ pip install --editable . ``` -------------------------------- ### Install Face Detection Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Install the face_detection library using pip with an editable install. ```Shell cd ../face_detection/ pip install --editable . ``` -------------------------------- ### Install Face Alignment Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Install the face_alignment library using pip with an editable install. ```Shell cd ../face_alignment/ pip install --editable . ``` -------------------------------- ### Install Other Dependencies Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Install remaining project dependencies listed in the requirements file. ```Shell cd ../../ pip install -r reqs.txt ``` -------------------------------- ### Install PyTorch and Related Libraries Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Install specific versions of PyTorch, torchaudio, torchvision, and other related libraries using conda. ```Shell conda install pytorch-lightning==1.9.3 pytorch==2.0.1 torchaudio==2.0.2 torchvision==0.15.2 torchmetrics==0.11.2 pytorch-cuda==11.8 cudatoolkit==11.8 -c pytorch -c nvidia -y ``` -------------------------------- ### Configure Training for Full Dataset (Stage 2) Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Initialize the model with the checkpoint from Stage 1 and train on the full dataset. This configuration uses the checkpoint from the short utterance training. ```Shell # Example configuration setting: # Use checkpoint from Stage 1 # Train with full dataset ``` -------------------------------- ### Run Testing with main.py Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Use main.py for testing. Ensure the correct config filename is specified within the script. ```python import main # Specify the config filename here main.recognize("your_config_filename.yaml") ``` -------------------------------- ### Running Data Preparation Scripts Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/preparation/README.md These Python scripts are used to prepare the dataset. `prepare_filescp.py` generates a list file, and `detect_landmark_list.py` extracts lip videos based on this list. Modify the bash variables to match your paths and dataset configuration. ```Shell python prepare_filescp.py \ --src $DOWNLOAD_DATA_PATH \ --dst $TARGET_DATA_PATH \ --dataset $DATASET_NAME \ --split $SPLIT python detect_landmark_list.py --list $DATASET_NAME-$SPLIT.scp --rank 0 --shard 1 ``` -------------------------------- ### Clone Repository and Initialize Submodules Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Clone the repository, navigate into it, and initialize/update git submodules. This step also includes pulling large files using git-lfs. ```Shell git clone git@github.com:MKT-Dataoceanai/CNVSRC2023Baseline.git cd CNVSRC2023Baseline git submodule init git submodule update cd tools/face_detection git lfs pull cd ../../ ``` -------------------------------- ### Run Training from Pre-trained Model Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Execute the main training script using a pre-trained model configuration. Ensure 'ckpt_path' and 'remove_ctc' are set appropriately in the YAML file. ```Shell python main.py ``` -------------------------------- ### Train VSR/ASR Model on Custom Dataset Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/INSTRUCTION.md Use this command to initiate training on a custom dataset. Set `data/dataset` to `cstm` to load the custom dataset. Ensure all placeholder values like `[exp_dir]`, `[exp_name]`, `[modality]`, `[ckpt_path]`, and `[num_nodes]` are replaced with your specific configuration. ```Shell python main.py exp_dir=[exp_dir] \ exp_name=[exp_name] \ data.modality=[modality] \ ckpt_path=[ckpt_path] \ data/dataset=[dataset] \ trainer.num_nodes=[num_nodes] ``` -------------------------------- ### Configure Training for Short Utterances (Stage 1) Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Configure training to use only short utterances (<= 4 seconds/100 frames) by setting 'data.max_length=100' in the YAML file. This stage also sets the learning rate. ```Shell # Example configuration setting: data.max_length=100 optimizer.lr=0.0002 ``` -------------------------------- ### Run Testing with predict.py Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Use predict.py for testing to observe real-time output. Ensure the correct config filename is specified within the script. ```python import predict # Specify the config filename here predict.recognize("your_config_filename.yaml") ``` -------------------------------- ### Save Pre-processed Audio-Visual Pairings and Text Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/INSTRUCTION.md Use this code to save pre-processed video, audio, and text data for a custom dataset. Ensure the AVSRDataLoader and save_vid_aud_txt functions are imported. ```Python from preparation.data.data_module import AVSRDataLoader from preparation.utils import save_vid_aud_txt # Initialize video and audio data loaders video_loader = AVSRDataLoader(modality="video", detector="retinaface", convert_gray=False) audio_loader = AVSRDataLoader(modality="audio") # Specify the file path to the data data_path = 'data_filename' # Load video and audio data from the same data file video_data = video_loader.load_data(data_path) audio_data = audio_loader.load_data(data_path) # Load text text = ... # Define output paths for the processed video, audio, and text data output_video_path = 'cstm/cstm_video_seg24s/test_file_1.mp4' output_audio_path = 'cstm/cstm_video_seg24s/test_file_1.wav' output_text_path = 'cstm/cstm_text_seg24s/test_file_1.txt' # Save the loaded video, audio, and associated text data save_vid_aud_txt(output_video_path, output_audio_path, output_text_path, video_data, audio_data, text, video_fps=25, audio_sample_rate=16000) ``` -------------------------------- ### Create and Activate Conda Environment Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/README.md Create a new conda environment named 'cnvsrc' with Python 3.10.11 and activate it. ```Shell conda create -y -n cnvsrc python==3.10.11 conda activate cnvsrc ``` -------------------------------- ### Decompressing CNVSRC2023 Dataset Files Source: https://github.com/dataoceanai/cnvsrc2023baseline/blob/master/preparation/README.md Execute these shell commands to decompress all downloaded tar.gz files for both the development and evaluation sets of the CNVSRC2023 dataset. Ensure you are in the correct directory before running. ```Shell # cd CNVSRC/CNVSRC2023/ # cd cncvs/news/ # tar -xzvf news_part01.tar.gz # tar -xzvf news_part02.tar.gz # cd ../speech/ # tar -xzvf speech_part01.tar.gz # tar -xzvf speech_part02.tar.gz # tar -xzvf speech_part03.tar.gz # tar -xzvf speech_part04.tar.gz # tar -xzvf speech_part05.tar.gz # tar -xzvf speech_part06.tar.gz # tar -xzvf speech_part07.tar.gz # tar -xzvf speech_part08.tar.gz # tar -xzvf speech_part09.tar.gz # tar -xzvf speech_part10.tar.gz # tar -xzvf speech_part11.tar.gz # tar -xzvf speech_part12.tar.gz # cd ../../ # tar -xzvf cnvsrc-multi-dev.tar.gz # tar -xzvf cnvsrc-single-dev.tar.gz ``` ```Shell # cd CNVSRC/CNVSRC2023/ # tar -xzvf cnvsrc-multi-eval.tar.gz # tar -xzvf cnvsrc-single-eval.tar.gz ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.