TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi icon indicating copy to clipboard operation
TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi copied to clipboard

TypeError: object of type 'numpy.float32' has no len()

Open Darrenll opened this issue 2 years ago • 3 comments
trafficstars

Line 177 has a type error. The example in your 19 year video ran smoothly, but I trained a new one to encounter this error. pi@raspberrypi:~ $ cd tflite1/ pi@raspberrypi:~/tflite1 $ source tflite1-env/bin/activate (tflite1-env) pi@raspberrypi:~/tflite1 $ python3 TFLite_detection_webcam.py --modeldir=custom_model_lite Traceback (most recent call last): File "TFLite_detection_webcam.py", line 177, in for i in range(len(scores)): TypeError: object of type 'numpy.float32' has no len() ^CException ignored in: <module 'threading' from '/usr/lib/python3.7/threading.py'> Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 1281, in _shutdown t.join() File "/usr/lib/python3.7/threading.py", line 1032, in join self._wait_for_tstate_lock() File "/usr/lib/python3.7/threading.py", line 1048, in _wait_for_tstate_lock elif lock.acquire(block, timeout): KeyboardInterrupt May I ask if there is a problem with my training set or with the version? Please help

Darrenll avatar May 03 '23 02:05 Darrenll

Which model are you using? I've seen that error before when trying to train a different model than ssd-mobilenet-v2.

EdjeElectronics avatar May 03 '23 12:05 EdjeElectronics

Which model are you using? I've seen that error before when trying to train a different model than ssd-mobilenet-v2.

It is indeed a version issue, and I have solved the problem using your code from last year's version of TF. Thank you very much!

Darrenll avatar Jul 05 '23 07:07 Darrenll

Hello everyone. I used the ssd-mobilnet-v2 version, teaching her on this collab notebook https://colab.research.google.com/github/EdjeElectronics/TensorFlow-Lite-Object-Detection-on-Android-and-Raspberry-Pi/blob/master/Train_TFLite2_Object_Detction_Model.ipynb?authuser=2#scrollTo=6t8CMarqBqP9 and I got the same error as you. Can you tell me how to fix it?

Gottmituns2022 avatar Jul 21 '23 22:07 Gottmituns2022