【问题标题】:can you get results returned other than using pandas on yolov5?除了在 yolov5 上使用 pandas 之外,你还能得到返回的结果吗?
【发布时间】:2022-11-03 01:27:49
【问题描述】:

在 yolov5 教程中,它说 pandas().xyxy[0] 从推理中获得结果。

results = model(testa) # inference

boxes = results.pandas().xyxy[0] # gets the results

但是是否可以使用熊猫以外的其他东西(如极地)来获得返回的结果?因为使用 pandas 太慢了,我的代码需要更快。 如果有人能告诉我,我将不胜感激(一个简单的例子也很好!)

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如它目前所写的那样,很难准确地说出你在问什么。

标签: python pandas yolov5


【解决方案1】:

您可以使用 NumPy 处理检测。不清楚你想要什么。就我而言,基于检测类和 X0 坐标,我想做出决定。 “boxes”数组分别由 bbox 坐标、置信度分数和类 id 组成。我使用了返回标准化坐标的“xywhn”格式。所以我检查每一行的最后一个元素和第一个元素,“wanted”数组返回满足条件的行索引。

results = model(img)
boxes = results.xywhn[0].detach().cpu().numpy()
wanted = np.where(((boxes[:,-1] == 1) & (boxes[:,0] > 0.4)))

print(results)
print(wanted)

[[    0.64899     0.64092    0.096527     0.25932     0.92479           2]
 [    0.72146     0.70188    0.058451     0.14613     0.90287           1]
 [    0.71426       0.931    0.091868     0.11923     0.88958           3]]
(array([1]),)

如果您不需要存储检测并立即处理它们,此解决方案可能会起作用。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-28
    • 2017-11-21
    • 2016-08-19
    • 1970-01-01
    • 2021-11-30
    • 1970-01-01
    • 2015-12-08
    相关资源
    最近更新 更多