DOsinga/deep_learning_cookbook

09.1 TypeError: an integer is required (got type tuple)

Opened this issue · 0 comments

Running the following from the "cookbook" gives the result: "TypeError: an integer is required (got type tuple)"

target_size = max(x for x in model.layers[0].input_shape if x)
img = img.resize((target_size, target_size), Image.ANTIALIAS)
imshow(np.asarray(img))

TypeError Traceback (most recent call last)
in
1 target_size = max(x for x in model.layers[0].input_shape if x)
----> 2 img = img.resize((target_size, target_size), Image.ANTIALIAS)
3 imshow(np.asarray(img))

/usr/lib/python3/dist-packages/PIL/Image.py in resize(self, size, resample, box, reducing_gap)
1871 )
1872
-> 1873 return self._new(self.im.resize(size, resample, box))
1874
1875 def reduce(self, factor, box=None):

TypeError: an integer is required (got type tuple)

Is it due to changed dependencies or components that I should have installed?
Thanks for help!