[PYTHON] Try to generate a death metal jacket image with DCGAN + scrape the metal database site for that

Overview

as its name suggests. As you can see in DCGAN's github page, it seems that DCGAN can generate a fictitious album jacket. Generated Album Covers Image quote: * dcgan_code * Certainly it looks like that when viewed from a distance. So I tried to do the same with my favorite death metal jacket. As shown below, death metal jackets are often horror-like, dark fantasy-like, or ** are ** styles, but can images with such characteristics be generated ... !!

Domination, by Morbid AngelSlowly We Rot, by ObituaryMortification by Mortification Image quote: * Domination *, by Morbid Angel, * Slowly We Rot *, by Obituary //en.wikipedia.org/wiki/Slowly_We_Rot "Slowly We Rot, by Obituary"), * Mortification *, by Mortification

Implementation of DCGAN by Torch

Here has published an implementation by Torch of DCGAN, where you can generate images using your own images. (Thank you!) So, the work that will be needed this time will be to collect as many death metal CD jacket images as possible.

Here, this time, we will use Encyclopaedia Metallum, which is a database site of metal bands in the east and west. The discography of all metal bands is covered in this site, and this time, this site is [scraped](https://ja.wikipedia.org/wiki/%E3%82%A6%E3%82%A7 % E3% 83% 96% E3% 82% B9% E3% 82% AF% E3% 83% AC% E3% 82% A4% E3% 83% 94% E3% 83% B3% E3% 82% B0, " What is scraping? ") And collect images. For scraping, use the script only_coverart_mining.py </ b> (code is on github) using the python scraping module BeautifulSoup. Use. I won't go into details about this script, but its function is to access the band page described in the input data text file input.txt </ b>, which shows a part of it below, and release it. The jacket image of the album is automatically collected. This time, only death metal bands are targeted, but the bands collected here are List of death metal bands on English Wikipedia.

Here, the numbers written together with the band name in input.txt </ b> are information used when used in another project, and the explanation here is omitted. You can also add information about other artists to this file, so if you want to learn the jacket image of this band too! In that case, please add it by yourself.

input.txt


Aborted,0,Death
Cannibal_Corpse,0,Death
Immolation,0,Death
Deicide,0,Death
Suffocation,0,Death
...

Death Metal Scraping

$ python only_coverart_mining.py

This will automatically start scraping the band described in input.txt </ b>. Encyclopaedia Metallum It takes a little time to check the data on the data and whether the image file is appropriate, but scraping is safe. When is completed, 128x128 size image files are saved (the save destination is placed under imgs / generated directly under the current directory unless otherwise specified with the --imgdir option). By default, jacket images are collected only for full-length albums, but EPs, singles, and live albums can also be collected by specifying options.

As a result of scraping, 2057 jacket photos were collected (including EP and singles, excluding live albums).

Run DCGAN

As mentioned above, DCGAN uses Implementation by Torch. If the environment has been built, as shown on that page, just type the following command to start learning (here myimages is the parent directory of imgs).

$ DATA_ROOT=myimages dataset=folder th main.lua
Training Process

When the script is executed, the generated image and training image are displayed in this way, and while the Generator and Discriminator gradually update the parameters, the generated image on the left side becomes like that (I prepared a GIF image that shows the change at the bottom) ).

Midway results

After learning about 1000 epoch, it seems that you can get a slightly like that, so to speak, a death metal-like, dark feeling, or a surprisingly frightening image. experiment1(7).jpg

Some of them have band logos or album titles in the images! is there. logo

Changes in generated images when trained up to 5000 epoch

When the conditions were changed from the above experiment (the number of epochs was increased to 5000) and learning and image generation were performed again, the following results were obtained. 1491319404dfKavNZhgXvi4Rq1491319397.gif

Image near the end of learning (epoch number: 4770) epoch@4770.jpg It's very difficult to comment, but it seems that there are many images like abstract paintings ...

Impressions, future prospects

If you look at it from a distance, it looks like you would see it in the death metal corner of a CD shop, but if you look at it properly, it's an image that you don't quite understand (well, there are jackets like that). I don't know how many jacket images were used for learning the generated jacket photos at the beginning, but was it still difficult to learn enough with the 2000 or more jacket images used this time? In the future, I would like to see how the results will change by increasing the number of training images. Also, although I chose death metal as an extreme example this time, I would like to do the same experiment with jacket images of power metal, black metal, and thrash metal.

Code etc.

All the files needed for scraping are on github. I want a collection of metal jacket images! In that case, please.

Recommended Posts