如何通过检测微小对象的声音来计算多个类别的多个对象?

时间:2018-07-11 03:18:38

标签: python-3.x count deep-learning counting yolo

我正在使用anaconda 3.6进行微小的YOLO物体检测。我正在努力统计由yolo模型实时检测到的对象。如图所示,我需要计算多个类的多个对象。请给我一个演示代码。谢谢

微型YOLO VOC的示例代码如下所示。

亲爱的, 我正在使用anaconda 3.6进行微小的YOLO物体检测。我正在努力统计由yolo模型实时检测到的对象。如图所示,我需要计算多个类的多个对象。请给我一个演示代码。谢谢

微型YOLO VOC的示例代码如下所示。

tfnet = TFNet(options)
colors = [tuple(255 * np.random.rand(3)) for _ in range(10)]

capture = cv2.VideoCapture(0)
capture.set(cv2.CAP_PROP_FRAME_WIDTH, 1920)
capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 1080)

while True:
    stime = time.time()
    ret, frame = capture.read()
    if ret:
        results = tfnet.return_predict(frame)
        for color, result in zip(colors, results):
            tl = (result['topleft']['x'], result['topleft']['y'])
            br = (result['bottomright']['x'], result['bottomright']['y'])
            X1= result['topleft']['x']
            Y1= result['topleft']['y']
            X2= result['bottomright']['x']
            Y2= result['bottomright']['y']
            area= (X2-X1)*(Y2-Y1)
            area_text = '{}: {:.0f}%'.format(area)
            label = result['label']
            confidence = result['confidence']
            text = '{}: {:.0f}%'.format(label, confidence * 100)
            frame = cv2.rectangle(frame, tl, br, color, 5)
            frame = cv2.putText(
                frame, text, area_text, tl, cv2.FONT_HERSHEY_COMPLEX, 1, (0, 0, 0), 2)
        cv2.imshow('frame', frame)
        print('FPS {:.1f}'.format(1 / (time.time() - stime)))
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

capture.release()
cv2.destroyAllWindows()

example image for counting multiple object of multiple categories

0 个答案:

没有答案