Skip to content

Inference/demo.py的一个小问题 #46

@YizhuoYu

Description

@YizhuoYu

首先非常感谢作者的工作,知乎的那篇中国特色CenterNet也写得非常有趣。
但是当我在自己的数据集上复现这个工程,想要用inference/demo.py来跑推理的时候,遇到了点小问题,输出的图片上始终没有框。
我尝试检查了下results这个变量,cls,bbox,scores其实并没有什么问题。
然后我发现在inference/demo.py中有这样一段:

       for c,(x1,y1,x2,y2),s in zip(cls,bbox,scores):
            if c != 0.0 or s < 0.35:
                continue

其中c对应类别,一般定义0.0为背景吧?但是这里的逻辑是,如果不是背景则跳过输出框的循环,这样岂不是永远输出不了目标的框了?
将其改成 :
if c == 0.0 or s < 0.35:
后,就可以得到正确的输出了。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions