This project demonstrates Neural Style Transfer, a method of creating a new image by combining the content of one image with the style of another, using deep learning.
It uses pretrained VGG16 and VGG19 convolutional neural networks to extract and blend features from two images. (Using VGG16 and VGG19 pretrained on Imagenet dataset)
Content Image | Style Image | Result |
---|---|---|
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Art-Transfer applies the concept of Neural Style Transfer by:
- Extracting content features from a content image.
- Extracting style features (Gram matrices) from a style image.
- Iteratively updating a target image to match the desired content and style.
The models used are:
- VGG16 (from torchvision models)
- VGG19 (from torchvision models)
- Load a pretrained VGG model (convolution layers only).
- Extract:
- Content features from deeper layers (e.g.,
conv4_2
). - Style features from shallower layers (e.g.,
conv1_1
,conv2_1
, etc.).
- Content features from deeper layers (e.g.,
- Initialize the target image as a copy of the content image.
- Define loss:
- Content Loss: Mean squared error between content and target features.
- Style Loss: Mean squared error between Gram matrices of style and target features.
- Optimize the target image to minimize the total loss.