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.
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:
ffmpeg, ffmpeg-python==0.1.17, opencv-python, pillow==6.2.2, tensorboardX==1.6, youtube-dl==2020.01.24
and finally, the Apt packages and click continue.
4. Now we will mount the pretrained model that is already in the Spell Public resources folder into our workspace. In the Resources area navigate to public/models/DeOldify and select the ColorizeVideo_gen.pth model, then edit the Mounted at path to be /spell/models/ColorizeVideo_gen.pth
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.