Updated lite/examples/object_detection/raspberry_pi/utils.py and changed requirements.txt #471
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I tried running the object detection example provided in the examples library of tensorflow lite but it gave me an error (Error 1) that I could not solve no matter what and I found out that the tflite-support 0.4.4 version was deprecated and did not work on raspberry pi 4 b so I downgraded it to 0.4.0
Error 1 (from above paragraph):
But when i did that it still gave me an error (Error 2) so i traced the error back all the way to the utils.py file in the same folder and figured out what the problem was in the code.
Error 2 (from paragraph above):
Problem was as follows:
Incorrect variable names were used in the utils.py file in lite/examples/object_detection/raspberry_pi
I changed line 48 from "category = detection.categories[0]" to "category = detection.classes[0]"
and line 49 from "category_name = category.category_name" to "category_name = category.class_name"
After making these changes the code worked perfectly on my raspberry pi 4 b