gpt4 book ai didi

python - 给定Keras预测,如何在OpenCV中绘制边界框?

转载 作者:行者123 更新时间:2023-12-02 16:09:00 31 4
gpt4 key购买 nike

我的代码是:

model = ResNet50(weights='imagenet')

ret_val, frame = video_capture.read()
frame = cv2.resize(frame,(224,224))
cv2.imshow(windowName, frame)
frame = np.expand_dims(frame, axis=0)
frame = preprocess_input(frame)

preds = model.predict(frame)
print('Predicted:', decode_predictions(preds, top=3)[0])

我得到的结果是:
Predicted: [('n04550184', 'wardrobe', 0.40715462), ('n04209239', 'shower_curtain', 0.09730709), ('n04005630', 'prison', 0.04603362)]

我没有 x, y, w, h,所以我不知道在哪里绘制边界框。

有小费吗?

最佳答案

您不能使用ResNet。 ResNet具有一个FC层,用于处理位置信息。尝试改用YOLO。它具有非常高效的位置和对象分类功能。对此的另一种解决方案不是使用Keras,而是使用OpenCV的内置Haar小波变换级联。 This link具有培训OpenCV Haar级联所需的全部知识。

关于python - 给定Keras预测,如何在OpenCV中绘制边界框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54380000/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com