google-coral / tflite

Examples using TensorFlow Lite API to run inference on Coral devices
https://coral.withgoogle.com
Apache License 2.0
181 stars 67 forks source link

Same predicted score for various oobjects #59

Closed DanilZittser closed 2 years ago

DanilZittser commented 2 years ago

Description

Hi to all!

Why model often predict same score for various objects?

Below code snippet from detection README.md

INFO: Initialized TensorFlow Lite runtime.
----INFERENCE TIME----
Note: The first inference is slow because it includes loading the model into Edge TPU memory.
33.92 ms
19.71 ms
19.91 ms
19.91 ms
19.90 ms
-------RESULTS--------
tie
  id:     31
  score:  0.83984375  # <--- this
  bbox:   BBox(xmin=228, ymin=421, xmax=293, ymax=545)
person
  id:     0
  score:  0.83984375    # <--- this
  bbox:   BBox(xmin=2, ymin=5, xmax=513, ymax=596)

I have a similar situation in my custom dataset: many identical scores.

02-custom 01-original

Click to expand! ### Issue Type Support ### Operating System Mendel Linux ### Coral Device Dev Board ### Other Devices _No response_ ### Programming Language Python 3.7 ### Relevant Log Output _No response_
hjonnala commented 2 years ago

Can you please point me to the source of edgetpu model you are using and try the below steps:

git clone https://github.com/google-coral/pycoral.git

cd pycoral

bash examples/install_requirements.sh detect_image.py

mendel@queen-shrimp:~/pycoral$ 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 ${HOME}/grace_hopper_processed.bmp
----INFERENCE TIME----
Note: The first inference is slow because it includes loading the model into Edge TPU memory.
41.56 ms
16.21 ms
15.27 ms
13.50 ms
15.66 ms
-------RESULTS--------
tie
  id:     31
  score:  0.83984375
  bbox:   BBox(xmin=227, ymin=419, xmax=292, ymax=541)
person
  id:     0
  score:  0.8046875
  bbox:   BBox(xmin=2, ymin=4, xmax=513, ymax=595)
DanilZittser commented 2 years ago

Thanks!

I get the same result as you: Screenshot_20220727_201302

But in detection README.md the following problem: Screenshot_20220727_201705

What is the reason of this behavior?

hjonnala commented 2 years ago

It's because detection README.md is using the old model from edgetpu repo. Please get the updated models form test_data repo. Thanks!

google-coral-bot[bot] commented 2 years ago

Are you satisfied with the resolution of your issue? Yes No