google-research / disentanglement_lib

disentanglement_lib is an open-source library for research on learning disentangled representations.
Apache License 2.0
1.38k stars 205 forks source link

Bug during ScreamDSprites initialization #34

Open bonheml opened 3 years ago

bonheml commented 3 years ago

I have noticed a bug when trying to use ScreamDsprites:

from disentanglement_lib.data.ground_truth.dsprites import ScreamDSprites
ScreamDSprites([1,2,3,4,5])

Raises an error: Traceback (most recent call last): File "<input>", line 1, in <module> File "disentanglement_lib/disentanglement_lib/data/ground_truth/dsprites.py", line 183, in __init__ scream.thumbnail((350, 274, 3)) File ".venv/disentanglement_lib/lib/python3.6/site-packages/PIL/Image.py", line 2299, in thumbnail x, y = map(math.floor, size) ValueError: too many values to unpack (expected 2)

The issue seems to be that thumbnail size is taking a tuple of 3 values instead of 2. I have modified l.182 of dsprites.py from scream.thumbnail((350, 274, 3)) to scream.thumbnail((350, 274)) and this is working properly.

I am using Pillow 8.0.1, but the thumbnail size was already 2D in Pillow 5.0.0 so this is not a compatibility issue.

I should add that the bug is also present in cars3D