google-coral/edgetpu

About option "keep_aspect_ratio" in examples/object_detection.py

tongtybj opened this issue · 1 comments

I followed the instruction here, then I got the following result and first figure:

$ python3 examples/object_detection.py --model='test_data/ssd_mobilenet_v1_fine_tuned_edgetpu.tflite' --label='test_data/pet_labels.txt' --input='test_data/pets.jpg' --keep_aspect_ratio
-----------------------------------------
german_shorthaired
score =  0.37109375
box =  [1762.1801829338074, 838.6267263974463, 2210.349624156952, 1173.771092295647]
-----------------------------------------
shiba_inu
score =  0.32421875
box =  [1916.2815427780151, 784.8315710467953, 2195.608711242676, 1104.3338206197534]
Please check  object_detection_result.jpg

object_detection_result

I can see both two bounding boxes are assigned to the right dog.

Then I remove --keep_aspect_ratio form command line, which gave a better result.

$ python3 examples/object_detection.py --model='test_data/ssd_mobilenet_v1_fine_tuned_edgetpu.tflite' --label='test_data/pet_labels.txt' --input='test_data/pets.jpg' -----------------------------------------
staffordshire_bull_terrier
score =  0.37109375
box =  [712.9122591018677, 272.12397533655167, 1122.5919842720032, 674.8110462427139]
-----------------------------------------
staffordshire_bull_terrier
score =  0.35546875
box =  [1831.8864297866821, 770.1564584970474, 2190.160117149353, 1146.7327305078506]
Please check  object_detection_result.jpg

object_detection_result

@tongtybj Thanks for submitting the issue.
I believe this is most likely just due to the input images that was feed to the model during training did not have paddings. You can check the option here and here