Style transfer for augmented city
Project idea
Using fast-style-transfer neural networks techniques we generate and transfer images from cities, using images from forest and other green and blue areas.
The project is one of the projects of City Interaction lab in Paris https://sites.google.com/cri-paris.org/cityinteractionlab/
Technical details
Using the package developed by Gene Kogan https://github.com/genekogan/fast-style-transfer and inspired from @lengstrom (GitHub repository https://github.com/lengstrom/fast-style-transfer) we first follow the installation patterns as suggested in fast-style-transfer:
Step 1:Install Anaconda
https://docs.anaconda.com/anaconda/install/
Step 2:Build a virtual environment
Run the following commands in sequence in Anaconda Prompt:
conda create -n tf-gpu tensorflow-gpu=2.1.0
conda activate tf-gpu
conda install jupyterlab
jupyter lab
Run the following command in the notebook or just conda install the package:
!pip install moviepy==1.0.2
Then we follow the commands below to use fast-style-transfer:
Before the next lines you should run setup.sh
from https://github.com/lengstrom/fast-style-transfer
Then follow:python style.py --style path/to/style/img.jpg \
--checkpoint-dir checkpoint/path \
--test path/to/test/img.jpg \
--test-dir path/to/test/dir \
--content-weight 1.5e1 \
--checkpoint-iterations 1000 \
--batch-size 20
What style.py is doing? style.py
trains networks that can transfer styles from artwork into images.
We need to create checkpoint-directory and then call the example of code:
python style.py --style example/style/la_muse.jpg \
--checkpoint-dir checkpoint-directory \
For any problems or questions check also the notebook here https://www.tensorflow.org/hub/tutorials/tf2_arbitrary_image_stylization
Results can be like
Notes on issues:
1. If you run into an issue of tensorflow package missing compat run: pip install tensorflow-estimator==2.1.*
2. You may need another module ‘imageio’. Then run simplypip install imageio
You can read more about this module here https://pypi.org/project/imageio/
3. You will also need module ‘moviepy’:pip install moviepy