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

Update - Image Classification #420

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lite/examples/image_classification/raspberry_pi/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ def run(model: str, max_results: int, score_threshold: float, num_threads: int,
categories = classifier.classify(tensor_image)

# Show classification results on the image
for idx, category in enumerate(categories.classifications[0].classes):
class_name = category.class_name
for idx, category in enumerate(categories.classifications[0].categories):
category_name = category.category_name
score = round(category.score, 2)
result_text = class_name + ' (' + str(score) + ')'
result_text = category_name + ' (' + str(score) + ')'
text_location = (_LEFT_MARGIN, (idx + 2) * _ROW_SIZE)
cv2.putText(image, result_text, text_location, cv2.FONT_HERSHEY_PLAIN,
_FONT_SIZE, _TEXT_COLOR, _FONT_THICKNESS)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
argparse
numpy>=1.20.0 # To ensure compatibility with OpenCV on Raspberry Pi.
opencv-python~=4.5.3.56
tflite-support==0.4.0
protobuf>=3.18.0,<4
tflite-support>=0.4.2
protobuf>=3.18.0,<4