google-coral / edgetpu

Coral issue tracker (and legacy Edge TPU API source)
https://coral.ai
Apache License 2.0
411 stars 124 forks source link

AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS' #823

Open quarinteen opened 4 months ago

quarinteen commented 4 months ago

Hello I am going through the setup documentation for the usb accelerator, and I am getting this error when I try to run the image test. Any help would be appreciated.

=========================================

$ py -3.9 examples/classify_image.py --model test_data/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels test_data/inat_bird_labels.txt --input test_data/parrot.jpg Traceback (most recent call last): File "C:\Users\owner\OneDrive\Documents\Coral.ai\coral\pycoral\examples\classify_image.py", line 121, in main() File "C:\Users\owner\OneDrive\Documents\Coral.ai\coral\pycoral\examples\classify_image.py", line 79, in main image = Image.open(args.input).convert('RGB').resize(size, Image.ANTIALIAS) AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'

cwhinton commented 4 months ago

I just had this issue tonight and found both this issue and the stack overflow question AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'.

With that information, I edited examples/classify_image.py and commented out the existing line 79 and added image = Image.open(args.input).convert('RGB').resize(size, Image.Resampling.LANCZOS) in its place. Saved it and it worked. This is on a new Debian 12 install.