Centernet: Data labels for fine-tuning object detection

Created on 20 Feb 2020  ·  8Comments  ·  Source: xingyizhou/CenterNet

Could you please help in the labels preparation ? To fine tune the object detection of one class with my own dataset what data-format should be used ? Any example or reference will be helpful.

Thank You !

Most helpful comment

maybe you can translate into english to read
https://blog.csdn.net/weixin_42634342/article/details/97756458

All 8 comments

maybe you can translate into english to read
https://blog.csdn.net/weixin_42634342/article/details/97756458

I have followed this blog and its quite useful. Thank You !

However, I just have to detect one class and I have followed the instructions per the blog. But when I am trying to load the pre-trained weights using --load_model per this repository to fine-tune I get the below error. I haven't modified the architecture, and my num_classes=1 is set in opts file as well. Anything else I am missing here? Please let me know ! Thank You !!

Error Message:

Skip loading parameter hm.2.weight, required shapetorch.Size([1, 256, 1, 1]), loaded shapetorch.Size([80, 256, 1, 1]). If you see this, your model does not fully load the pre-trained weight. Please make sure you have correctly specified --arch xxx or set the correct --num_classes for your own dataset.
Skip loading parameter hm.2.bias, required shapetorch.Size([1]), loaded shapetorch.Size([80]). If you see this, your model does not fully load the pre-trained weight. Please make sure you have correctly specified --arch xxx or set the correct --num_classes for your own dataset.

@akshu281

Here is a list of all the py files you need to modify:

  • Copy coco.py file to be customized (I defined it as custom.py here)
  • centernet/src/lib/opts.py
  • centernet/src/lib/datasets/dataset_factory.py
  • centernet/src/lib/utils/debugger.py

You need to check for list one by one.
In addition, if it is your dedicated data set, I suggest that you do not use pre-training weights, but start over

When everythings go ready
python main.py ctdet --exp_id custom --batch_size 16 --lr 1.25e-4 --gpus 0

I have made the below changes already, is there anything else ??

Copy coco.py file to be customized (I defined it as custom.py here)
  yes I have created custom.py and changed the following,
  num_classes =1 
  self.class_name = ['__background__', 'xxxx'] (My object label xxx)
  self._valid_ids = [3] (My given ID)
  I am retaining the class name and other things as COCO -- Is that an issue ?

centernet/src/lib/opts.py
  'ctdet': {'default_resolution': [512, 512], 'num_classes': 1, 
            'mean': [0.408, 0.447, 0.470], 'std': [0.289, 0.274, 0.278],
            'dataset': 'xxx'},

centernet/src/lib/datasets/dataset_factory.py

dataset_factory = {
# 'coco': COCO,
'pascal': PascalVOC,
'kitti': KITTI,
'coco_hp': COCOHP,
'xxx': COCO
}

centernet/src/lib/utils/debugger.py
elif num_classes == 1 or dataset == 'xxx':
self.names = cap_class_name
   .....
cap_class_name = ['xxx']

@akshu281
def init(self, args=''): default_dataset_info = { 'ctdet': {'default_resolution': [512, 512], 'num_classes': 14, 'mean': [0.49401256, 0.51401981, 0.53022468], 'std': [0.14567583, 0.14387697, 0.14387015], 'dataset': 'graduation'},

Thanks much for the reference blogs. So I think all the references you have mentioned is to train the network with pre-trained Imagenet features on a custom dataset. I am able to run the training from scratch but is it possible to re-train using the coco weights for training on my custom dataset ? Coz I think there will come an issue in the dimensions difference (80 and 1 mismatch ?)

What do you suggest ?

Sorry for jump in...
Hey @Clemente420, Do you know how can I train the model from scratch on only two classes of coco dataset? Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ycxxn picture ycxxn  ·  3Comments

deandiakov picture deandiakov  ·  5Comments

David-19940718 picture David-19940718  ·  5Comments

merckxiaan picture merckxiaan  ·  7Comments

huang229 picture huang229  ·  4Comments