GitHub Profile: Erik Linder-Norén
MIT License
This project is licensed under the MIT License - see the original repo for details.
This project is designed to perform style transfer on images and videos, applying artistic styles to media via convolutional neural networks. It leverages models trained on various artistic images to transform the aesthetic of input images and videos, allowing users to create stylized media in real-time.
Pre-trained Style Transfer Models:
The pre-trained models can be downloaded from the following Google Drive folder. Please download all the files at once to ensure you have the complete set of necessary models for this project.
To access and download all the models in one go, please follow these simplified steps:
- Visit the Google Drive folder with pre-trained models.
- Click on the "Download all" button to download the models as a single compressed (zip) file.
- Unzip the downloaded file into the
models
directory within your project folder.
Images Supported:
- JPEG (.jpg, .jpeg)
Videos Supported:
- AVI (.avi)
- GIF (.gif)
Python Packages:
- torch
- torchvision
- numpy
- PIL
- tqdm
- ipywidgets
- skvideo
Resource Requirements:
- CPU or GPU (GPU recommended for faster processing)
From the folder where this README.md
is, run:
# Run one of the following commands:
# podman command
podman run --rm -it --userns=keep-id --device nvidia.com/gpu=all -e WANTED_UID=`id -u` -e WANTED_GID=`id -g` -e CoreAI_VERBOSE="yes" -v `pwd`:/iti -p 8888:8888 docker.io/infotrend/coreai:latest /run_jupyter.sh
# docker command
docker run --rm -it --runtime=nvidia --gpus all -e WANTED_UID=`id -u` -e WANTED_GID=`id -g` -e CoreAI_VERBOSE="yes" -v `pwd`:/iti -p 8888:8888 infotrend/coreai:latest /run_jupyter.sh
Follow the instructions in the notebook fast-neural-style-transfer.ipynb
.
You can stop the Notebook by using the File -> Shutdown
option.
Alternatively, you can stop the container by pressing Ctrl + C
in the terminal where the container is running.
-
Setup Environment:
- Clone the repository or download the specific project files.
- Ensure Python 3.x is installed.
-
Install Required Packages:
- To enhance the functionality of the CoreAI environment, you may need to install some libraries not pre-installed but required for this notebook. Follow these steps to install the necessary libraries from the
requirements.txt
file:
2.1 Create and Activate the Virtual Environment:
Open your terminal or command prompt within the jupyter notebook.
File -> New -> Terminal
Navigate to the project directory where you want to set up the environment.
Execute the following commands to create and activate the virtual environment:
python3 -m venv --system-site-packages myvenv #myvenv is name of virtual environment you can change it bash source myvenv/bin/activate pip3 install ipykernel python -m ipykernel install --user --name=myvenv --display-name="Python (myvenv)"
2.2 Install Required Libraries:
- To enhance the functionality of the CoreAI environment, you may need to install some libraries not pre-installed but required for this notebook. Follow these steps to install the necessary libraries from the
-
Before running the following commands, load the "Python (myvenv)" kernel to limit the chances of altering the underlying container. Ensure you are in the directory where the Jupyter Notebook and the
myvenv
directory are located. Usecd
to change to your project directory andpwd
to verify your current directory.!. ./myvenv/bin/activate; pip install -r requirements.txt
- Run the Notebook:
- Open the
fast-neural-style-transfer.ipynb
notebook in a Jupyter environment. - Execute the notebook cells sequentially to upload media, perform style transfer, and view the results.
- Media Processing:
- Upload images or videos through the interactive widgets.
- Select the desired pre-trained style transfer model.
- Execute style transfer and view the stylized outputs directly in the notebook.
- Ensure that the model and media files are placed in the correct directories (
models
andinput/images
orinput/videos
respectively). - Check that all dependencies are installed correctly within the virtual environment.
- Make sure CUDA is available for GPU usage if a GPU is being utilized for processing.
- Integrated image and video style transfer capabilities into a single Jupyter notebook.
- Enhanced user interaction through the use of IPython widgets for file upload and model selection.
- Optimized image processing workflows to support real-time media transformation.