rkjones4 / GANGogh

Using GANs to create Art
358 stars 123 forks source link

picStuff.py missing images to resize #4

Closed ghost closed 6 years ago

ghost commented 6 years ago

This project is amazing. I’m trying to run the code though and picStuff.py keeping saying “missed it”. It creates the right folders but doesn’t seem to be resizing the pictures. Any ideas on how to solve this problem?

rkjones4 commented 6 years ago

Can you edit the code to print the error message you are getting instead of missed it: and then post it here? could be that imread changed

ghost commented 6 years ago

RIght on. Checking the scipy docs it seems like the functions imread, imresize, and imsave are depreciated: https://docs.scipy.org/doc/scipy/reference/misc.html

Due to the depreciated functions picStuff.py returns this error for every image from the fullimages folder generated from scrape_wiki.py. I tried downgrading scipy from 1.0 to 0.19.1 and 0.19.0 but it still returns the same errors::

0fullimages/genre-painting\anders-zorn+in-my-gondola-1894.jpg
missed it: fullimages/genre-painting\anders-zorn+in-my-gondola-1894.jpg
ghost commented 6 years ago

Alright, so I changed line 27 of picStuff.py from

source = style + '\\' + f

to

source = style + '/' + f

Now it's resizing the pictures correctly and magically works with the depreciated scipy functions even though I'm on scipy 1.0. This is great, but now it's putting resized images in a folder called "smallimagesfullimages". We want it to just put resized images in a folder called "small images" right? Also, the images are being named like this: figurative\105.png. Is this what we want?

rkjones4 commented 6 years ago

Oh are you running this on a mac? This code is set up to run on windows. In the file processing stuff you might need to change some of the logic, but in the end ideally the folder is called smallimages and there are sub-folders within it i.e. figurative and then the ##.png go inside the sub-folders

smallimages --figurative

etc

ghost commented 6 years ago

I'm running this on a VM (linux debian-9-stretch). As long as the images are organized in the structure you described though, the GANgogh.py model should be able to work with them right?

rkjones4 commented 6 years ago

You'll definitely need to change some code in tflib/wikiartGenre (i.e. the path, maybe more), and maybe some code in ganGogh.py that saves the images but otherwise I think it should work, if you run into any errors paste them here and I'll try to help!

ghost commented 6 years ago

Alright. Well looks like I got the images to resize and save correctly. After trying 20+ variations on the save function at line 32 I woke up and started my computer and it just worked... Simply had to replace the '\' with '/' . Not sure why that didn't work the first time I tried it, but hey it's working now. old

scipy.misc.imsave(PATH + name + '\\' + str(i) + '.png',image)

new

scipy.misc.imsave(PATH + name + '/' + str(i) + '.png',image)

In summary: if you're running this on linux just change '\' to '/' in all parts of picStuff.py and it should work fine.