You give a style image and the model learns the features and transfers it to the content image Best recommended to run with a GPU for the fastest result
Neural style transfer is an optimization technique that involves creating a new image that merges the content of one image with the style of another. Here's a high-level overview of how the AI-Art-Generator works:
- Load the content image and the style image.
- Preprocess the images by resizing and normalizing them.
- Create a model that combines a pre-trained convolutional neural network (CNN) with the VGG19 architecture.
- Define loss functions that measure the content loss and style loss between the generated image and the target image.
- Set up the optimization process using gradient descent to minimize the total loss.
- Iterate the optimization process to update the generated image and minimize the loss.
- Generate the final stylized image.
By minimizing the content loss, the generated image retains the content of the original content image. By minimizing the style loss, the generated image captures the artistic style of the style image. The balance between the content and style losses can be adjusted to control the final result.
Tensorflow article (It was for version TensorFlow V1)
git clone https://github.com/Rohith04MVK/AI-Art-Generator
conda create -n AI-Art-Generator python=3.8.5
conda activate AI-Art-Generator
pip install -r requirement.txt
conda install --file requirement.txt
Replace line 10 content_path
with the image you want to transform
Replace line 11 style_path
with the style picture you want to transfer
python aiart.py