This project implements neural style transfer using a pre-trained VGG19 model. The process involves transferring the style of one image onto another while preserving the content of the latter.
Make sure you have the following libraries installed:
- torch
- torchvision
- numpy
- matplotlib
- opencv-python
- pillow
You can install them using pip:
pip install torch torchvision numpy matplotlib opencv-python pillow
Import necessary libraries and load the pre-trained VGG19 model.
Set the device for computation (CPU or GPU).
Load the content and style images using OpenCV.
Resize the images to a suitable size for processing.
Visualize the content, target, and style images using Matplotlib.
Extract feature maps from the VGG19 model for both content and style images.
Compute the Gram matrix for style representation.
Optimize the target image to match the content and style representations.
Visualize the final stylized image alongside the content and style images.
This project is licensed under the MIT License - see the LICENSE file for details.