This is an application to detect emotions from Tom and Jerry videos.
The repository can either be cloned or downloaded as a zip.
UPDATE: No more complex setup! Refer READMEDocker.md for instructions to easily set it up using Docker :)
The trained yolo detector and facial expression detector's weights should be first downloaded from the following links :
The YOLO Detector weights (1) should be placed inside the yolo_predictor directory and the Facial Expression weights (2) should be placed in the root directory.
As long videos may take longer time, it would be better to convert the video into small clips as in
ffmpeg -i movie.mp4 -ss 00:00:03 -t 00:00:08 -async 1 cut.mp4
To run on the default video cut.mp4, following command can be run from the root directory
python main.py
To run on some other video (ex : movie.mp4 )
python main.py -i movie.mp4
OpenCV allows us to generate videos with no audio. Hence the audio has to be extracted separately and combined with the output video file. We use ffmpeg for this purpose.
For generating audio file from the input video
ffmpeg -i filename.mp4 filename.mp3
For combining the audio and generated video
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac output.mp4
The details of implementation can be found in Implementation.md
Click above picture to view video
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Thanks for reading :)