roytseng-tw / Detectron.pytorch

A pytorch implementation of Detectron. Both training from scratch and inferring directly from pretrained Detectron weights are available.
MIT License
2.82k stars 565 forks source link

Training with a custom dataset #81

Open vsd550 opened 6 years ago

vsd550 commented 6 years ago

Can anyone suggest how can we train this model from scratch using a custom dataset other than COCO. Like how to prepare data and the steps involved in training?

Thanks

AruniRC commented 6 years ago
  1. See how the city-scape dataset is converted to COCO JSON format from this example. I copied that setup and created my own dataset mirroring what is done for Cityscapes. This generates a JSON file, similar to the MS-COCO JSON, that can be used by Detectron.

  2. Add your dataset to the dataset catalogue. The paths to image directory and JSON file of course will depend on the annotation conversion procedure in the earlier step.

  3. Add this dataset in the net training script, otherwise you will get an "unknown dataset" error.

For Step 1, you may find this sample gist useful, where I converted face bounding boxes from the WIDER-dataset into the MS-COCO format.

liaozp1 commented 5 years ago

@AruniRC now i want to fine tune on my own dataset,my object classes is 200,how can i complete this task?(1)transfor my dataset to the coco format,(2)Add your dataset to the dataset catalogue (3)Add this dataset in the net training script,but then should i change the last output network to 201 instead of 81? I have problem with this,how can i do?thx for your help!

liaozp1 commented 5 years ago

@roytseng-tw if u have time to help me solve this ,i just want fine tune on my dataset of 200 classes , i am not clear of your codebase, if i want to retrain on my dataset, should i must change the code?and if so,where to change the code?appreciate it very much! thank u very much!

yuyijie1995 commented 5 years ago

@AruniRC Hi I made the custom dataset like coco2017 ,but my dataset only have 2 classes , I changed the number of class in the net training script. But I don't know how to change the name of classes ,is the codes can get the classes name by my dataset's annotation?