The following is a step-by-step tutorial for colorizing black and white videos using Jason Antic's - DeOldify VideoColorizer.ipynb Jupyter notebook and DeOldify pretrained model using the Spell Jupyter Workspace.
The DeOldify pretrained model is optimized for smooth, consistent, and flicker-free video. The video model has been trained on 2.2% of Imagenet data once at 192px, using only the initial generator/critic pretrain/GAN NoGAN training (1 hour of direct GAN training).
An example of the output of the tutorial here is 50 iconic black and white music videos colorized:
The following tutorial assumes you have Spell account and are logged in. Get $10 GPU credit when you sign up for a new account.
Prepare and Upload Files
1. In terminal create a folder called models
$ mkdir models
2. Download the DeOldify video colorization model into a folder called models.
$ wget https://www.dropbox.com/s/336vn9y4qwyg9yz/ColorizeVideo_gen.pth?dl=0 -O /models
3. Upload the downloaded model into Spell Resources.
$ spell upload models
Setup Jupyter Workspace
1. Login into the Spell Web Panel https://web.spell.run and click on Workspaces > Create Workspace.
2. Give a friendly name to your Workspace like DeOldify and enter https://github.com/jantic/DeOldify in the Add code section. This will add the DeOldify files into your Workspace. Click continue.
3. In this step, we will configure our environment. We will require a GPU for running the program, so under Machine Type, select V100, for Framework select fastai and under Jupyter select Lab. Specify the Pip Packages:
tensorboardX==1.6, ffmpeg, ffmpeg-python==0.1.17, youtube-dl==2019.4.17, opencv-python, pillow
and finally, the Apt packages and click continue.
4. Now we will mount the models folder that we uploaded into our workspace. In the Resources area you will see your models folder, check the box to add it to Your Mounts.
Colorizing our black and white video
An example black and white video can be downloaded here to use
1. Open the VideoColorizer.ipynb notebook located within the JupyterLab Folder.
2. Execute the first three cells to load the colorizer function.
3. In the Colorize code cell there are two ways of loading your video:
3.1 Specify a URL within the source_url = 'your URL here'
3.2 Upload your video to Jupyter Lab
Create a video/source folder in the root directory, if not already there and upload your video
Now replace source_url value= None and add file_name = 'your file name without extension'
4. Execute the cell to colorize your video! Once completed the video will display like so:
5. You can download your colorized video by navigating to the video/result folder. Right-click the file name and download.