tristandeleu / pytorch-meta

A collection of extensions and data-loaders for few-shot learning & meta-learning in PyTorch
https://tristandeleu.github.io/pytorch-meta/
MIT License
1.98k stars 256 forks source link

Can you update the dependecy to Pillow which has version more than 7.0.0? #47

Closed nonconvexopt closed 4 years ago

nonconvexopt commented 4 years ago

The new version of torch and torchvision was released, and it seems that they utilize Pillow version more than 7.0.0. But torchmeta has requirements about the pilllow version < 7.0.0, so it made a conflict.

C:\ProgramData\Anaconda3\lib\site-packages\torchmeta\transforms\augmentations.py in call(self, image) 28 raise ValueError() 29 return F.rotate(image, self.angle % 360, self.resample, ---> 30 self.expand, self.center, fill = (0,)) 31 32 def hash(self):

C:\ProgramData\Anaconda3\lib\site-packages\torchvision\transforms\functional.py in rotate(img, angle, resample, expand, center, fill) 727 fill = tuple([fill] * 3) 728 --> 729 return img.rotate(angle, resample, expand, center, fillcolor=fill) 730 731

C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py in rotate(self, angle, resample, expand, center, translate, fillcolor) 2053 w, h = nw, nh 2054 -> 2055 return self.transform((w, h), AFFINE, matrix, resample, fillcolor=fillcolor) 2056 2057 def save(self, fp, format=None, **params):

C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py in transform(self, size, method, data, resample, fill, fillcolor) 2369 raise ValueError("missing method data") 2370 -> 2371 im = new(self.mode, size, fillcolor) 2372 im.info = self.info.copy() 2373 if method == MESH:

C:\ProgramData\Anaconda3\lib\site-packages\PIL\Image.py in new(mode, size, color) 2577 color = im.palette.getcolor(color) 2578 -> 2579 return im._new(core.fill(mode, size, color)) 2580 2581

TypeError: function takes at least 3 arguments (1 given)

tristandeleu commented 4 years ago

What is your version of Torchmeta? The requirements should now be Pillow >= 7.0.0 since version 1.4 if I remember correctly: https://github.com/tristandeleu/pytorch-meta/blob/52547d2090d7c69a119ebb08acd40336292a070a/setup.py#L36

nonconvexopt commented 4 years ago

Oh, you are right. I naively thought that the default version of torchmeta in pip is the latest version if I just call 'pip install torchmeta' But I think it is necessary to specify the version >= 1.4.0 to download it. i.e 'pip install torchmeta==1.4.0' In conclusion, I could fix every errors and problems related to pillow dependencies after I update the torchmeta version to >= 1.4.0.

Thank you for your help.

tristandeleu commented 4 years ago

That's odd, it should have downloaded the latest version if you called pip install torchmeta. Next time try to do pip install --upgrade torchmeta to be sure to download the latest version if you already had one installed. Glad that solved your issue!