Open torakoneko opened 4 years ago
Hi, for creating image from raw, there is assumption that all images in source folder have been resized to the desired size. You may try to print the name and dimension of the image to find out the problematic piece. (sometimes there are hidden image files in the folder). Or you may try to add some resize logic.
Hi, for creating image from raw, there is assumption that all images in source folder have been resized to the desired size. You may try to print the name and dimension of the image to find out the problematic piece. (sometimes there are hidden image files in the folder). Or you may try to add some resize logic.
All the files are 320x448 according to my computer. How would I check for hidden files? I have the "show hidden files" thing checked in explorer on my computer and there's no extra files showing. I'm not great at python, sorry...
Hi, for creating image from raw, there is assumption that all images in source folder have been resized to the desired size. You may try to print the name and dimension of the image to find out the problematic piece. (sometimes there are hidden image files in the folder). Or you may try to add some resize logic.
All the files are 320x448 according to my computer. How would I check for hidden files? I have the "show hidden files" thing checked in explorer on my computer and there's no extra files showing. I'm not great at python, sorry...
Resizing all the images in the form 2^n * 2^n
of width and height worked for me.
Images must be square and should have same width and height.
Here the code to resize all the images in 512*512 shape. 2^9
from PIL import Image
import os, sys
import glob
for filename in glob.iglob('../path_to_my_dataset' + '/*.jpg', recursive=True):
print(filename)
im = Image.open(filename)
imResize = im.resize((512,512), Image.ANTIALIAS)
imResize.save(filename , 'JPEG', quality=90)
Hope it helps.
@torakoneko
i'm attempting to create a dataset from images that are 320x448 (5x7 res-log2 = 6) but when i attempt to run the dataset tool with
!python /content/stylegan2/dataset_tool.py create_from_images_raw --res_log2=6 ./dataset/CADGAN_320_448 '/content/CADGAN_320_448'
i get this errorLoading images from "/content/CADGAN_320_448" detected 7114 images ... Shuffle the images... Creating dataset "./dataset/CADGAN_320_448" Added 0 images. Traceback (most recent call last): File "/content/stylegan2/dataset_tool.py", line 950, in <module> execute_cmdline(sys.argv) File "/content/stylegan2/dataset_tool.py", line 944, in execute_cmdline func(**vars(args)) File "/content/stylegan2/dataset_tool.py", line 710, in create_from_images_raw tfr.create_tfr_writer(img.shape) File "/content/stylegan2/dataset_tool.py", line 96, in create_tfr_writer assert self.shape[1] % (2 ** self.res_log2) == 0 AssertionError
i assume this has something to do with the size of the images, but i'm kind of at a loss otherwise.