qiaoguan / Person-reid-GAN-pytorch

A Pytorch Implementation of "Unlabeled Samples Generated by GAN Improve the Person Re-identification Baseline in vitro"(ICCV17)
158 stars 49 forks source link

Transforms not working though the image does exist in the path #4

Closed jpainam closed 6 years ago

jpainam commented 6 years ago

Hi! I'm trying to reproduce your results but this line

result = {'img': data_transforms['train'](img), 'label': self.img_label[idx], 
                                          'flag':self.img_flag[idx]} 
# flag=0 for ture data and 0 for generated data

raise this error

File "C:\Users\Paul\AppData\Local\Programs\Python\Python36\lib\site-packages\torchvision\transforms\transforms.py", line 399, in get_params
    i = random.randint(0, h - th)
raise ValueError("empty range for randrange() (%d,%d, %d)" % (istart, istop, width))
ValueError: empty range for randrange() (0,-111, -111)

I have verified that the image does exist. So the problem my come from the transformation settings` Thank f

jpainam commented 6 years ago

I think i have solved the problem. My input images were (224,224) size and the transforms code was trying to RandomCrop(256, 128) So I had to un/comment these lines

#transforms.Resize(144, interpolation=3),
#transforms.RandomCrop((256,128)),
transforms.Resize(256,interpolation=3),
transforms.RandomCrop(224,224),

It might help someone

qiaoguan commented 6 years ago

the original training image and the generated images(by DCGAN) are not the same size, make sure they are the same size. i provide a script(resizeImage.py) in the DCGAN-tensorflow folder to resize the image, you can use it!

jpainam commented 6 years ago

Thanks, solved by using resizeImage.py too