如何使用yolov4的检测来绘制边界框?

时间:2020-06-07 16:38:59

标签: python tensorflow object-detection yolo

Traceback (most recent call last):
  File "D:\vehicle detection and counting\FinalProject\tensorflow-yolov4-tflite-master\run.py", line 8, in <module>
    d.Counting(video_path='videos/hw.mp4',output_path='output/hw.mp4',skip_frames=20,confidence_tresh=0.27)     
  File "D:\vehicle detection and counting\FinalProject\tensorflow-yolov4-tflite-master\Count.py", line 154, in Counting
    confidence = scores[class_id]
IndexError: index 1329146 is out of bounds for axis 0 with size 71

抛出错误的代码段是

image_data = image_data[np.newaxis, ...].astype(np.float32)
pred_bbox = self.model.predict(image_data)


for out in pred_bbox:
    for detection in out:
        # print(len(detection))                     
        scores = detection[5:]
        print()
        class_id = np.argmax(scores)
        print(class_id)
        confidence = scores[class_id]
        print(confidence)

如何从预测中获得bbox和课程?

我用来建立模型的链接是https://github.com/hunglc007/tensorflow-yolov4-tflite 和权重用于darknet

0 个答案:

没有答案