[PYTHON] Have Hisako's guitar replaced with her own guitar by machine learning -Execution-

Preparation (previous)

I wanted to have a good feeling with CycleGAN, so I first collected images of the guitar. I downloaded and resized the image. Click here for details (https://qiita.com/nozomi254/private/2fc55cc8ae8e6359f8a7)

Execution

My environment

Upload images using FileZilla

The folder name is the same so that it follows the procedure described in the README. After all, I didn't really have a black Jazzmaster, and I didn't have enough energy to do my best.

maps
├── trainA(Sunburst for learning:284 sheets)
├── trainB(Black for learning:94 sheets)
├── testA(Test sunburst:151 sheets)
└── testB(Test black:76 sheets)

It became a very unmotivated and unbalanced feeling. It doesn't look good, but thank you.

I thought that FileZilla used in the university class might be easy to use, so I connected it. You can't just type in the square above, but you should look it up like "AWS FileZilla" (http://support.amimoto-ami.com/en/articles/934126-filezilla- % E3% 82% 92% E4% BD% BF% E3% 81% A3% E3% 81% 9F-sftp-% E6% 8E% A5% E7% B6% 9A)

The nice thing about this is that you can upload folders and files by dragging and dropping, or I don't know how to do it other than doing this.

Before uploading the entire directory maps created in the first part, it is necessary to make sure that there is no maps on the AWS side now. It took me a light year trying to remove it with FileZilla.

mv maps maps_real

Solved with. mv can also be used to change the name. I think that even operations on FileZilla can be done in 1/200 million seconds

Execute

The folder names are also available, so [README on the original GitHub]( Follow the instructions in pytorch-CycleGAN-and-pix2pix). First learn.

python train.py --dataroot ./datasets/maps --name maps_cyclegan --model cycle_gan

Takes time

Image created in check_point after learning

It seems that the code is really well made and it makes a web page and shows the result, but I can not see it because it keeps loading forever Also, for some reason, the images (aerial photographs and map photographs) that were in the original maps are also mixed. For the time being, the one I saw in Atom's Preview that seems to work スクリーンショット 2020-01-21 12.08.04.png スクリーンショット 2020-01-21 12.08.18.png スクリーンショット 2020-01-21 12.08.43.png HM. rec and idt seem to mean reconstruction reconstruction and identity identity rec_A = F(G(A)) rec_B = G(F(B)) idt_A = G(B) idt_B = F(A) Reference: different outputs (images) # 326

Once the map is mixed, as far as the creation date and time is seen, it seems that only the result (I feel that it is not mixed with the one for learning), so just run the test as it is

python test.py --dataroot ./datasets/maps --name maps_cyclegan --model cycle_gan

result

The one that worked

スクリーンショット 2020-01-21 14.30.17.png スクリーンショット 2020-01-21 14.56.14.png スクリーンショット 2020-01-21 14.30.47.png

The one who couldn't

スクリーンショット 2020-01-21 14.33.36.pngスクリーンショット2020-01-2114.34.15.png It seems that it was difficult for the background to be black or for live video What if the background is transparent? I was advised, but I wanted people to do their best on the guitar they are playing ...

That Jazzmaster has changed like that

111_A_real_A.png111_A_fake_B.png There are still scratches and it looks like it

119_A_real_A.png119_A_fake_B.png Is this black and white? About

125_A_real_A.png125_A_fake_B.png This is just black and white

Summary and reflection

Summary

Reflection

Execution version ver.2

You can connect Pycharm and AWS, so I want to try that too

to be continued···

Recommended Posts

Have Hisako's guitar replaced with her own guitar by machine learning -Execution-
Classification of guitar images by machine learning Part 1
Classification of guitar images by machine learning Part 2
[Machine learning] Create a machine learning model by performing transfer learning with your own data set
Machine learning learned with Pokemon
Machine learning with Python! Preparation
Machine learning Minesweeper with PyTorch
Beginning with Python machine learning
4 [/] Four Arithmetic by Machine Learning
Try machine learning with Kaggle
Machine Learning with docker (42) Programming PyTorch for Deep Learning By Ian Pointer
[Introduction to StyleGAN] Unique learning of anime with your own machine ♬
I tried machine learning with liblinear
Machine learning with python (1) Overall classification
Machine learning summary by Python beginners
Try machine learning with scikit-learn SVM
Quantum-inspired machine learning with tensor networks
Get started with machine learning with SageMaker
"Scraping & machine learning with Python" Learning memo
Machine Learning with Spark (86) with Spark (1) "Machine Learning with Spark" By Rajdeep Dua, Manpreet Singh Ghotra, Nick Pentreath