简体   繁体   中英

How to choose hyperparameters to train a good object detection model on AWS sagemaker?

Object detection with AWS sagemaker algorithm .

I have created object detection models with and without automatic tuning. Some of them have good mAP and some don't and when I test it on new pictures, not all of my objects can be detected.

Which parameters and hyperparameters should I choose for it to have the best model?

Also, How many pictures do you think I need?

Thanks in advance!

For now, I am trying to detect Lipton tea, (square boxes). I have 5 different teas (so 5 classes) and 500 images in total. 100 for each class. I split my data to 90% for training and 10% for validation. Then I would run tests with new pictures.

tuned_hyperparameters_ranges = {
    'learning_rate': ContinuousParameter(0.001, 0.05),
    'momentum': ContinuousParameter(0.4, 0.99),
}

I need it to have at least 90% of detection.

100 images per class sounds like a reasonable amount to begin with. What I'd recommend:

  1. Try with base_network set to resnet-50 As shown in this gluoncv model zoo visualization , a resnet50 backbone gives better perf than a vgg16 backbone on the pretty general COCO detection task
  2. use transfer learning by setting use_pretrained_model=1
  3. Check in the training job metrics the look of the validation mAP epoch after epoch. If training curve is not flattening, consider just training longer by increasing epochs
  4. use learning rate scheduling to progressively reduce the grain of your weight update. This can take multiple forms but to begin with you could divide learning rate by 10 every 1/3 of your epochs count. For example if you have 60 epochs, set lr_scheduler_step='20,40' and lr_scheduler_factor=0.1

Then you can run hyperparameter tuning on at least learning_rate and mini_batch_size

If this still isn't satisfying, consider collecting more data or a implementing a different detector with custom code, based on the cost of each option. The SageMaker Detector is an SSD, and alternative architectures such as Faster-RCNN or YoloV3 with appropriate tricks may give better performance. You can find great detector architecture in python to implement in the MXNet container in the model zoo linked above. This will be much more effort that using the built-in SageMaker detector though, so I would first try the 4 options above

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM