How to count objects in Tensorflow Object Detection API

前端 未结 5 1265
旧巷少年郎
旧巷少年郎 2020-12-05 16:23

I am executing https://github.com/tensorflow/tensorflow this example of detecting objects in image.

I want to get count of detected objects following is the code tha

5条回答
  •  無奈伤痛
    2020-12-05 16:35

    add this part to count objects

    final_score = np.squeeze(scores)    
        count = 0
        for i in range(100):
            if scores is None or final_score[i] > 0.5:
                    count = count + 1
    

    count is the number of objects detected

    this part will print count but will print it in continuous manner can it be used to print only once like final count = some value instead of printing it repeatedly

提交回复
热议问题