Add new class to dataset mscoco, object detection tensorflow

2.1k Views Asked by At

I would like to add a new class(example: Handgun) to the coco dataset(90 classes) so I would detect 91 different classes.

I have this:

dataset: 300 image about Handgun

labelmap.pbtxt:

item {
    id: 1
    name: 'Handgun'
}

pipeline.config:

num_classes: 1
fine_tune_checkpoint: "/media/Shared/faster_rcnn_resnet101_coco_2018_01_28/model.ckpt"
from_detection_checkpoint: true
load_all_detection_checkpoint_vars: true

Possible solution: Change num_classes: 1 to num_classes: 90+1?

Thank you so much for answer me.

2

There are 2 best solutions below

0
On

The one way you can do it is to use the new dataset and the existing dataset like COCO and club them, create a new training record and then train it

1
On

Unfortunately you cannot just add one class, retrain and able to recognize all 91 classes. If you want to have model trained for all 91 classes, download the coco dataset , add your own dataset with labels and then train the model. Other option is to retrain a second model only with one class and infer that one class using this newly trained second model. You will have to infer other 90 classes using the available model seperately. You can learn about doing custom object detection using response in following post Tensorflow real time object detection