Git Product home page Git Product logo

mono2binaural-conv-tasnet's Introduction

End-to-End Mono to Binaural Conversion with Conv-TasNet


This repository is the result of a research project in the Bachelor's Degree in Data Science and Engineering in Universitat Politècnica de Catalunya (UPC).

It is an end-to-end approach to mono to binaural conversion, having 2.5D Visual Sound as the baseline and focused on Conv-TasNet's architecture.

More information can be found in paper_mono2binaural_tasnet.pdf.

Training and Testing

(The code has beed tested under the following system environment: Ubuntu 18.04.5 LTS, CUDA 11.1, Python 3.6.9, PyTorch 1.6.0)

  1. Download the FAIR-Play dataset.

  2. Generate the frames from the mp4 videos with the script generate_frames.py.

  3. Set relative path to the splits with the script generate_splits.py.

  4. [OPTIONAL] Preprocess the audio files using reEncodeAudio.py to accelerate the training process.

  5. Use the following command to train a model:

python3 train.py --hdf5FolderPath /YOUR_CODE_PATH/2.5d_visual_sound/hdf5/ --name mono2binaural --model MODEL_NAME --checkpoints_dir /YOUR_CHECKPOINT_PATH/ --save_epoch_freq 50 --display_freq 10 --save_latest_freq 100 --batchSize 32 --learning_rate_decrease_itr 10 --niter 1000 --lr_visual 0.0001 --lr_audio 0.001 --nThreads 32 --gpu_ids 0,1,2,3,4,5,6,7 --validation_on --validation_freq 100 --validation_batches 50 --tensorboard True --use_visual_info |& tee -a training.log

The model parameter refers to either tasnet or audioVisual.

If it does not fit into the gpu, use the stepBatchSize parameter.

  1. Use the following command to test your trained mono2binaural model:
python3 demo.py --input_audio_path /BINAURAL_AUDIO_PATH --video_frame_path /VIDEO_FRAME_PATH --weights_visual /VISUAL_MODEL_PATH --weights_audio /AUDIO_MODEL_PATH --output_dir_root /YOUT_OUTPUT_DIR/ --input_audio_length 10 --hop_size 0.05 --model MODEL_NAME --use_visual_info
  1. Use the following command for evaluation:
python evaluate.py --results_root /YOUR_RESULTS --normalization True

Acknowlegements

This code is manly based on 2.5 Visual Sound.

The Conv-TasNet implementation is based on Demucs.

Licence

The code is CC BY 4.0 licensed, as found in the LICENSE file.

mono2binaural-conv-tasnet's People

Contributors

paumarquez avatar

Stargazers

 avatar Josiah Crovo avatar jiantang avatar Antoni Jubés Monforte avatar Albert Dominguez Mantes avatar Vinayak Sharma avatar Kranti Kumar Parida avatar

Watchers

 avatar

Forkers

ishine

mono2binaural-conv-tasnet's Issues

Saving first images

Hi, Thanks for sharing the pre-processing code. It is really helpful. I have a question about the frame extraction code.
In line 35-36 of the script generate_frame.py script, black images are saved. why is it done so? I guess this part only runs if in the dataset there are some files that are less than 10 seconds. Are there any such files? If so instead of the first images the last images should be save liked that. Please correct me if I have grossly misunderstood something.

Error While Testing

Hi, as far I understood that while testing the video frames also needs to be passed but I'm facing an issue. In the demo.py

data = dataset.dataset.__getitem__(
                curr_audio_path,
                audio,
                audio_start_time=sliding_window_start / opt.audio_sampling_rate,
                audio_end_time=sliding_window_end / opt.audio_sampling_rate,
                audio_start=sliding_window_start,
                audio_end=sliding_window_end
            )

In this I'm getting the error
"TypeError: getitem() got an unexpected keyword argument 'audio_start_time''
.
If you can help me in this regard, it would be helpful.

Error showing while training

While training it's giving error in train.py line number 182 as well as in data/custom_dataset_data_loader.py in line 50 for i, data in enumerate(dataset):. If you can help me!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.