Become Indian (domain conversion by Cycle-GAN)

Begin I'd like to enjoy authentic curry in India, but the corona vortex doesn't make it happen. So, if I couldn't go to the site, I thought that if the Indians' face became Indian at least, that curry desire would be satisfied (?), So I decided to test that hypothesis.

** Nakami ** Create a domain converter for Indian and Japanese faces with CycleGAN. I implemented it with reference to the following. I implemented CycleGAN with pytorch

The images of Indian faces and Japanese faces necessary for learning were obtained with reference to the following. [Collect images from Google without hitting the API] (https://qiita.com/naz_/items/efc296ae1bf0e62f6704)

image_collector.py


class Google(object):
    def __init__(self):
        self.GOOGLE_SEARCH_URL = "https://www.google.co.jp/search"
        self.session = requests.session()
        self.session.headers.update(
            {
                "User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:10.0) \
                    Gecko/20100101 Firefox/10.0"
            }
        )

Self.GOOGLE_SEARCH_URL is "http://www.google.co.jp/search" I changed it to. It seems that SSL authentication did not pass successfully.

It's a slapstick, but even if I searched for words such as "Japanese man", many pictures of foreign women were confused and the removal work was difficult. It seems that he had obtained an image of an article such as "5 characteristics of Japanese men who marry overseas women!" I can get many faces that seem to be Indian men if they are "indian men" or "indian men".

For face cutting, I used openCV's cascade classification. [Let's use PyTorch to classify the faces of Hinatazaka46! ] (https://qiita.com/coper/items/b1fd51062642d624e26f)

About 400 images (128 * 128) like this were collected.

0_287_1.jpg

a_190_3.jpg

I will let you learn here. Click here for the output of the generator trained for about 200 epochs

Indian Indians A2B_2.png

A2B_17.png

Although it deviates from the purpose,

Indian Prime Minister Suga A2B_2.png

A2B_7.png

It seems that the Indian color and shine, and the domain around the depth of the beard and the hori around the eyes can be converted. I feel that my desire for India has been satisfied.

** Saigo ** The amount of data and the number of epochs seemed to be small, and the image output from the generator was rough. I thought I might try a little more, but it seems that the original purpose will be achieved by eating curry at noon, so I will end here for the time being, although it is miscellaneous.

Thank you to everyone who has read this far.

Recommended Posts

Become Indian (domain conversion by Cycle-GAN)
Style conversion by neural style