Beginner questions after training my first custom object detection model

Hi!

I have trained my first custom object detection model with 2 classes and 100 test/500 train images and have some questions.
Nothing has been pretrained. I’m running efficientdet_d0_coco17_tpu-32 with my own labeled images created with LabelImg.

  • Low initial total loss from first step (starts from 1.5)

  • Total loss down to 0.2 after just 2000 steps, wth? After that loss is increased if continued

  • Low score when predicting

  • Should you resize your train/test images to one size or should they be the original size?

  • Should initial total loss not go up when you retrain with new train/test images? Started at last checkpoint with old images removed, right now it continues on last value (0.2)

  • My goal is to detect vehicles/license plates, is 500 images not enough for this?

  • I’m using my model in react-native (expo eas), the following has been done:

  1. Clone tensorflow models
    github/tensorflow/models
  2. Setup my configuration files, (using efficientdet_d0_coco17_tpu-32)
  3. Train model untill loss is no longer decreasing
  4. Export using exporter_main_v2
  5. Converted my saved model to tensorflowjs model
    github.com/tensorflow/tfjs-converter/blob/0.8.x/README.json.md
  6. Loaded my model using bundleResourceIO
    @tensorflow/tfjs-react-native - npm

Is this “the correct way” if you want to use your own custom object detection model in react-native? Maybe I should be using tflite instead?

Really appreciate the help!

It seems that you are going to overfit this dataset.

Have you tried to use image augmentation, collect more real images or generating synthetic one? 500 images with a from scratch model it seems to me a little bit too small dataset specially if you want to perform “in the wild”.

For the TF.js converter the Readme was moved here:

@Bhack

I did now know about image augmentation, will check that out thanks :slight_smile:

It seems like you are correct, here is my total loss from steps 0 to 10k. Really spiky and the loss on step one is only 1… So you’re saying I need additional data to solve this? My 500 image data I’ve been using is good so there should not be any problems there…

Imgur

For data augmentation you can find something at:

I think that you can try also to create syntetic images or collect more real data.

With synthetic images, real data and augmentation you need to try to cover your representative test distribution (plate type, numbers-letters, lighting, shadows, plate background, point of view etc…)