Closed zjbaby closed 6 years ago
@YijinLiu
I modify the void AnnotateMat(cv::Mat& mat, int batch_index){}
function:
change
const std::string cls = labels_[detection_classes[d]];
to
const std::string cls = labels_[detection_classes[d] + 1];
and I get a right result: Detected 0 of '84: clock' with score 0.765625 @[1110,20:1185,87] Detected 1 of '0: person' with score 0.738281 @[732,48:1039,626] Detected 2 of '0: person' with score 0.710938 @[574,179:830,567] Detected 3 of '0: person' with score 0.679688 @[178,63:387,627] Detected 4 of '84: clock' with score 0.597656 @[436,66:510,138] Detected 5 of '61: chair' with score 0.585938 @[396,423:564,615] Detected 6 of '0: person' with score 0.574219 @[387,173:565,438] Detected 7 of '0: person' with score 0.574219 @[1046,114:1189,378] Detected 8 of '0: person' with score 0.574219 @[1,221:171,607] Detected 9 of '0: person' with score 0.523438 @[1033,137:1190,556]
why do the output detection_classes ID value smaller? the label "people" is corresponds to ID 1 in "labelmap.txt".
When an object detection model is trained, the model adds a background class as 0. For normal tensorflow model, they add a empty label for this background class. I guess this is what you have in "labelmap.txt". However, for tflite, the conversion script intentionally removes the background class from the model. You should have used models/objdetect/coco_labels.txt instead of labelmap.txt.
@YijinLiu I see, thank you very much!~
@YijinLiu Hi, I test your obj_detect_lite.cpp use "coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip" model which downloaded from "https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip" , and I found I got an error result of object classes: I use a test picture with some people, the detection boxes are correct, but the labels shows '???' : the detect results shows: Detected 0 of 'book' with score 0.765625 @[1110,20:1185,87] Detected 1 of '???' with score 0.738281 @[732,48:1039,626] Detected 2 of '???' with score 0.710938 @[574,179:830,567] Detected 3 of '???' with score 0.679688 @[178,63:387,627] Detected 4 of 'book' with score 0.597656 @[436,66:510,138] Detected 5 of 'cake' with score 0.585938 @[396,423:564,615] Detected 6 of '???' with score 0.574219 @[387,173:565,438] Detected 7 of '???' with score 0.574219 @[1046,114:1189,378] Detected 8 of '???' with score 0.574219 @[1,221:171,607] Detected 9 of '???' with score 0.523438 @[1033,137:1190,556]