[PYTHON] I tried moving food with SinGAN

Introduction

I'm sorry to disturb you in the empty space of Manufacturer / Counting Advent Calendar 2019.

Recently, I've been playing around with "SinGAN", so I'll summarize the results roughly. SinGAN is a paper that became a hot topic because it was selected as the best paper at ICCV 2019. Besides learning with just one image to generate an image of any size with the same features, it's also great. Screenshot from 2019-12-24 18-23-29.png

Paper: https://arxiv.org/abs/1905.01164 Code: https://github.com/tamarott/SinGAN Video: https://youtu.be/xk8bWLZk4DU

What's more, ** I can easily try it with one image and one GPU **. It's also a nice point. With one GPU, it took several hours to learn each time in my environment.

Regarding the content of the dissertation, I have to write a master's thesis as soon as possible, so I will omit it here because there are other people who have already explained it. I found several cases in Qiita alone.

-[SinGAN] Various image generation tasks are possible from just one image -[Paper commentary] SinGAN: Learning a Generative Model from a Single Natural Image -ICCV2019 Best Paper "SinGAN" I read it briefly and summarized it briefly

By the way, in this article, I will try various functions (mainly Animation) according to SinGAN's README. If you want to reproduce it, clone the repository. stay here.

In addition, the result of playing with SinGAN is tweeted in detail at #SinGAN.

Animation To make a video from a still image, use this command in one shot.

$ python animation.py --input_name <input_file_name> 

ramen

First of all, from the classic ramen. This delicious ramen ... This street. It looks lively and delicious! alpha=0.100000_beta=0.850000.gif

What about Jiro ramen? This chilled Chinese ... This street. It looks lively and delicious! alpha=0.100000_beta=0.900000.gif

pizza

This pizza is ... This street. It's hot and fresh! alpha=0.100000_beta=0.950000.gif

Bowl of rice topped with sashimi

This seafood bowl is ... This street. It's fresh! alpha=0.100000_beta=0.950000.gif

Latte art

This latte is ... This street. It looks lively and delicious! alpha=0.100000_beta=0.850000.gif

"Cry"

Munch's "The Scream" ... This street. The ego is collapsing! alpha=0.100000_beta=0.850000.gif

Blue Cave (Shibuya)

Illuminations in Shibuya ... That's right. I think this was the most correct way to use it. alpha=0.100000_beta=0.900000.gif

Harmonization To make the collage natural, you first need to train the model. Specify the background image.

$ python main_train.py --input_name <input_file_name>

The second command will harmonize the cut and pasted image and the mask image. This will be completed soon.

$ python harmonization.py --input_name <training_image_file_name> --ref_name <naively_pasted_reference_image_file_name> --harmonization_start_scale <scale to inject>

I referred to here for creating the mask image. [Create a black and white mask image of a specific area with Gimp – Urusu Lambda Web](https://urusulambda.wordpress.com/2018/07/23/gimp%E3%81%A7%E7%89%B9%E5% AE% 9A% E9% A0% 98% E5% 9F% 9F% E3% 81% AE% E7% 99% BD% E9% BB% 92% E3% 83% 9E% E3% 82% B9% E3% 82% AF% E7% 94% BB% E5% 83% 8F% E3% 82% 92% E4% BD% 9C% E6% 88% 90% E3% 81% 99% E3% 82% 8B /)

By the way, this time I would like to synthesize Santa Claus with Monet's "Water Lilies". This cut and pasted image is ... lilly_naive.jpg It looks like this. It's small and hard to see. lilly_santa.png

Super Resolution SinGAN can also super-resolution, so let's enlarge the previous image. This command is one shot. If nothing is specified, the height and width will be quadrupled.

$ python SR.py --input_name <LR_image_file_name>

lilly_santa_HR.png

Merry Christmas! Have a nice year!

bonus

I tried to collaborate famous paintings and Pokemon with Harmonization and SR.

Ito Jakuchu and Ho-Oh. image.png

Turner and Lugia. image.png

Both are not good. I still don't know the knack of Harmonization.

Recommended Posts

I tried moving food with SinGAN
I tried moving EfficientDet
I tried fp-growth with python
I tried scraping with Python
I tried Learning-to-Rank with Elasticsearch!
I tried clustering with PyCaret
I tried gRPC with Python
I tried scraping with python
I tried to implement a volume moving average with Quantx
I tried trimming efficiently with OpenCV
I tried summarizing sentences with summpy
I tried machine learning with liblinear
I tried web scraping with python.
I tried implementing DeepPose with PyTorch
I tried face detection with MTCNN
I tried running prolog with python 3.8.2.
I tried SMTP communication with Python
I tried sentence generation with GPT-2
I tried learning LightGBM with Yellowbrick
I tried face recognition with OpenCV
I tried multiple regression analysis with polynomial regression
I tried sending an SMS with Twilio
I tried using Amazon SQS with django-celery
I tried to implement Autoencoder with TensorFlow
I tried linebot with flask (anaconda) + heroku
I tried to visualize AutoEncoder with TensorFlow
I tried scraping Yahoo News with Python
I tried using Selenium with Headless chrome
I tried factor analysis with Titanic data!
I tried learning with Kaggle's Titanic (kaggle②)
I tried moving DeepLabCut for biological tracking
I tried sending an email with python.
I tried non-photorealistic rendering with Python + opencv
I tried a functional language with Python
[Introduction to Pytorch] I played with sinGAN ♬
I tried batch normalization with PyTorch (+ note)
I tried recursion with Python ② (Fibonacci sequence)
I tried implementing DeepPose with PyTorch PartⅡ
I tried to implement CVAE with PyTorch
I tried playing with the image with Pillow
I tried to solve TSP with QAOA
I tried simple image recognition with Jupyter
I tried CNN fine tuning with Resnet
I tried natural language processing with transformers.
#I tried something like Vlookup with Python # 2
I tried scraping
I tried PyQ
I tried AutoKeras
I tried papermill
I tried django-slack
I tried Django
I tried spleeter
I tried cgo
I tried handwriting recognition of runes with scikit-learn
I tried to predict next year with AI
I tried hundreds of millions of SQLite with python
I tried to detect Mario with pytorch + yolov3
I tried to implement reading Dataset with PyTorch
I tried to use lightGBM, xgboost with Boruta
I tried image recognition of CIFAR-10 with Keras-Learning-
I tried to learn logical operations with TF Learn