Skip to content

Transfers an image style to an entire youtube video, using the power of neural networks! 🧠🤕

License

Notifications You must be signed in to change notification settings

blablabliam/VideoStyleTransfer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VideoStyleTransfer

Contributors Forks Stargazers MIT License


Scarlet

Neural Network Style Transfer for Youtube using Python!

Transfers an image style to an entire youtube video, using the power of neural networks! 🧠 🤕

Table of Contents

  1. About The Project
  2. Design
  3. License
  4. Contact
  5. Acknowledgments

About The Project

I always wanted to make my own unique BadApple!! version, but could never come up with an interesting way to do it that hadn't already been done. I decided to try and crank it out using a deep dream neural network, but it just took FOREVER on my hardware. My first time estimate to run the video was more than 2 years!!! Over time, I was able to slim down and speed up the program, scrapping a full neural net approach for the rapid speed of a pre-built model and style transfer! This changed everything, bringing the time estimate from 2 years to just 2 hours. 😆

Dancing

Built With

Design and Build

The jupyter notebook here runs in a special conda environment, to make sure all modules have proper dependencies. I also use a few simple add-ons for jupyter to make things easier for myself, which are totally optional. All of this code might run on Windows or Mac, but it was tested and designed to run on Linux (Ubuntu). The notebook has all instructions for setting up the conda environment, but in case you are not sure or can't read the notebook, here are the steps to set up the build.

#Non Python Stuff

We need a way to get the youtube video frames. Easiest method is to use youtube-dl to download the video and use ffmpeg to extract the frames. This is handled inside the script, but can be useful as a standalone command line tool as well and I highly recommend it.

#Conda Env Setup

This program is currently tested on Ubuntu with Python3.8.8. If this is your first time using conda environments, here is a basic walkthrough. Start with installing Anaconda.

https://www.anaconda.com/

Once you have Anaconda installed, open a terminal and create a new conda environment for tensorflow.

conda create -n tf tensorflow

Before activating the conda environment, we want to make sure we can use it on our notebook. The easy way to do this is to install nb conda kernels.

conda install nb_conda_kernels

Now, activate your environment!

conda activate tf

Your module imports from now on, until you deactivate the environment, will be contained and version locked inside the environment, without disturbing other parts of your python installation. Machine learning tends to require specific versions of modules, to avoid running into incompatibility problems. To make sure we don't run into module version errors, lets install our modules by referring to their version. youtube_dl and ffmpk are for downloading youtube video, and extracting/stacking frames, respectively.

conda install tensorflow==2.6.0 conda install tensorflow-hub==0.12.0 conda install ipykernel==6.4.1 pip install youtube_dl pip install ffmpy

Now, the environment should be ready to use! I like to use one last modification to detect memory issues; machine learning is extremely memory intensive and can crash your computer if not managed properly. To see the memory usage of the notebook itself, add the jupyter resource usage tool.

conda install -c conda-forge jupyter-resource-usage

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Liam Plybon - [email protected]

Project Link: https://github.com/blablabliam/VideoStyleTransfer

Acknowledgements

About

Transfers an image style to an entire youtube video, using the power of neural networks! 🧠🤕

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published