google-coral / pycoral

Python API for ML inferencing and transfer-learning on Coral devices
https://coral.ai
Apache License 2.0
355 stars 146 forks source link

Object Detection Reshape error #136

Open Sridharanraja opened 9 months ago

Sridharanraja commented 9 months ago

Description

python3 examples/detect_image.py --model test_data/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite --labels test_data/coco_labels.txt --input test_data/grace_hopper.bmp output: ValueError: cannot reshape array of size 76800 into shape (300,256,3)

Click to expand! ### Issue Type _No response_ ### Operating System Windows 10 ### Coral Device USB Accelerator ### Other Devices _No response_ ### Programming Language Python 3.8 ### Relevant Log Output ```shell python examples/detect_image.py --model test_data/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite --labels test_data/coco_labels.txt --input test_data/grace_hopper.bmp examples/detect_image.py:78: DeprecationWarning: ANTIALIAS is deprecated and will be removed in Pillow 10 (2023-07-01). Use LANCZOS or Resampling.LANCZOS instead. interpreter, image.size, lambda size: image.resize(size, Image.ANTIALIAS)) Traceback (most recent call last): File "examples/detect_image.py", line 108, in main() File "examples/detect_image.py", line 78, in main interpreter, image.size, lambda size: image.resize(size, Image.ANTIALIAS)) File "C:\Users\Admin\anaconda3\envs\edgetpu\lib\site-packages\pycoral\adapters\common.py", line 99, in set_resized_input tensor[:h, :w] = np.reshape(result, (h, w, channel)) File "<__array_function__ internals>", line 6, in reshape File "C:\Users\Admin\anaconda3\envs\edgetpu\lib\site-packages\numpy\core\fromnumeric.py", line 298, in reshape return _wrapfunc(a, 'reshape', newshape, order=order) File "C:\Users\Admin\anaconda3\envs\edgetpu\lib\site-packages\numpy\core\fromnumeric.py", line 54, in _wrapfunc return _wrapit(obj, method, *args, **kwds) File "C:\Users\Admin\anaconda3\envs\edgetpu\lib\site-packages\numpy\core\fromnumeric.py", line 43, in _wrapit result = getattr(asarray(obj), method)(*args, **kwds) ValueError: cannot reshape array of size 76800 into shape (300,256,3) ```