Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config for num_classes #25

Open
LemonWei111 opened this issue Jan 24, 2025 · 6 comments
Open

config for num_classes #25

LemonWei111 opened this issue Jan 24, 2025 · 6 comments

Comments

@LemonWei111
Copy link

I am confused that do we need to set the background as a class. Cause most models for object detection like YOLO and DETR set num_classes to the original number of classes plus 1. Does DEIM also need plus 1?
Moreover, the question is, why is the num_classes configuration for COCO 80? Shouldn't it be 90 (+1)?

@LemonWei111
Copy link
Author

Of course when I fintune it, I set num_classes as right the num of classes. And all is right.

@LemonWei111
Copy link
Author

When I set num_classes = num of classes plus 1, so many boxes are predicted to be background, but AP and Recall increases while FNR decreases, which means the model is like to find the minority class better in my example.

@LemonWei111
Copy link
Author

当我设置 num_classes = 类数加 1 时,预测许多框是背景,但 AP 和 Recall 增加,而 FNR 减少,这意味着在我的示例中,模型似乎能更好地找到少数类。

According to the logic of the code, it should be set to plus 1, but it is strange to have a complete lack of focus on most classes

@LemonWei111
Copy link
Author

I found what happened! 80 object categories for coco. But I haven't find the document of them to check whether the category id is begin with 0 or 1.

我很困惑,我们是否需要将背景设置为一个类。导致大多数对象检测模型(如 YOLO 和 DETR)num_classes设置为原始类数加 1。DEIM 也需要加 1 吗?而且,问题是,为什么 COCO 80 的 num_classes 配置呢?不应该是 90 (+1) 吗?

@LemonWei111
Copy link
Author

I found it! The id of the object the author used is from 0 to 79, not 1 to 90 as I thought before. So just set num_classes as the num of your dataset, but check your annotation.

@Jobiis
Copy link

Jobiis commented Feb 3, 2025

Did you find why it does do +1? I have a dataset that has 1 class but it doesn't work when I set cum_classes to 1. It only works when I set it to 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants