detrex icon indicating copy to clipboard operation
detrex copied to clipboard

Single Class detection

Open CloudRider-pixel opened this issue 1 year ago • 4 comments

Hi,

I successfully train detr_50 on my custom dataset. Nevertheless, it's a single-class one. What I have to change in order to train this model on a single class problem ? For example in projects/detr_r50 I saw that the number of classes is harcoded to 80 (coco), also loss is CE which normally is not suited.

In advance thanks,

Max.

CloudRider-pixel avatar May 29 '23 18:05 CloudRider-pixel

You can train your own custom dataset with one class as follows:

  1. Convert your dataset annotation to COCO format
  2. Register your own dataset follow: custom.py
  3. Modify the model config to model.num_classes=1
  4. Modify the criterion config to num_classes=1

rentainhe avatar May 30 '23 05:05 rentainhe

how can I modify model.num_classes and num_classes? I have not found them. In advance thanks.

wwhhh2000 avatar Jul 10 '23 07:07 wwhhh2000

how can I modify model.num_classes and num_classes? I have not found them. In advance thanks.

They have been defined in the model config, you can find them here: https://github.com/IDEA-Research/detrex/blob/f34380d3652c0dbc8f9de911626117943a8208c4/projects/dino_eva/configs/models/dino_r50.py#L76

@wwhhh2000

rentainhe avatar Jul 17 '23 01:07 rentainhe

how can I modify model.num_classes and num_classes? I have not found them. In advance thanks.

They have been defined in the model config, you can find them here:

https://github.com/IDEA-Research/detrex/blob/f34380d3652c0dbc8f9de911626117943a8208c4/projects/dino_eva/configs/models/dino_r50.py#L76

@wwhhh2000

Thank you so much!

wwhhh2000 avatar Jul 17 '23 01:07 wwhhh2000