thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.14k stars 2.08k forks source link

hyperparameters to tune for custom data object detection. #583

Open Adnation opened 6 years ago

Adnation commented 6 years ago

I am trying to train on my custom dataset however it fails to find object in many images. I tried changing threshold values but identifications were not good. What I want to do is to improve model accuracy. My dataset has 850 images for training for 5 classes.

What I want is to understand is how can I tune different parameters you have set in the model for my dataset. Also it will be good if you can explain how this parameters affects model training. There are many parameters like coors, object_scale, noobject_scale, class_scale, coord_scale. My dataset has many images which contains multiple objects, so for that is there any explicit parameter I need to set for this property.

Additionally how many anchors I can pass to training?

I also want to know why flip operation is used for image augmentation? and How can I incorporate different image augmentation in the model?

Also objects in rotated images are completely missed. Can you help me in that?

Thank you for the great package!!

ShreyVaghela commented 6 years ago

Hi, did you found out which parameters are you going to choose as hyperparameters?

Adnation commented 6 years ago

In my case I kept the parameters same as example but what I did is I added image augmentation. Rotated and saturated images were added to my dataset which helped me in getting better model and I would suggest you to do the same. Try to add more image augmentation.

kmsravindra commented 6 years ago

Hi @Adnation, Just wanted to check from your previous response, did you do the image augmentation and annotation of those augmented images manually? because I didn't notice this pre-processing step in the YOLO v2 of darkflow that handles this augmentation on the fly. Please let me know how you went about it.

Adnation commented 6 years ago

I did that programmatically, for saturation you dont have to recalculate the bounding boxes and for rotation here is the SO link that helped me. So overall it was not at all manual work.

kmsravindra commented 6 years ago

@Adnation, Thanks for the response. I also noticed there are few github reps available off the shelf that do image augmentation and annotation transformations for complex stuff as well. Maybe I will try one of those. Also, just wanted to understand if you did an offline data augmentation or data augmentation-on-the-fly just before feeding the model?

Adnation commented 6 years ago

Since my dataset was large and I was facing memory issue I stored all the images first and their annotations and then fitted the model. If you are trying different models I would suggest you to check Tensorflow's object detection. I used darkflow and tensorflow object detection api and tensorflow api gave me better results and it also provides out of the box image augmentation so you just have to set augmentation option in configuration file.

Ztrimus commented 4 years ago

Here, This article might help you. We need to change, add and remove some parameters from the .config file. you can find information about those parameters in protos file.

I find that by increasing the height and width of the image_resizer parameter, I am able to get better accuracy than the previous model.

image_resizer {
      fixed_shape_resizer {
        height: 700
        width: 700
        resize_method : AREA
      }
    }

Still, it's trial and error method which required more GPU hours. which I am not happy about.

Is there any efficient solution do hyperparameter tuning for object detection? Like Automated ML

@Adnation Have you found any robust method?