Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Darrenll opened this issue May 3, 2023 · 3 comments
Open

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

Darrenll opened this issue May 3, 2023 · 3 comments

Comments

@Darrenll
Copy link

Darrenll commented May 3, 2023

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

@EdjeElectronics
Copy link
Owner

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

@Darrenll
Copy link
Author

Darrenll commented Jul 5, 2023

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!

@Gottmituns2022
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants