Skip to content

Instantly share code, notes, and snippets.

@OlafenwaMoses
Created August 1, 2019 12:55
Show Gist options
  • Save OlafenwaMoses/6c948aa66ff19aeaa9fa6d4f5f462981 to your computer and use it in GitHub Desktop.
Save OlafenwaMoses/6c948aa66ff19aeaa9fa6d4f5f462981 to your computer and use it in GitHub Desktop.
Code for training custom object detection model with ImageAI
from imageai.Detection.Custom import DetectionModelTrainer
trainer = DetectionModelTrainer()
trainer.setModelTypeAsYOLOv3()
trainer.setDataDirectory(data_directory="hololens")
trainer.setTrainConfig(object_names_array=["hololens"], batch_size=4, num_experiments=100, train_from_pretrained_model="pretrained-yolov3.h5")
trainer.trainModel()
@jmcasat
Copy link

jmcasat commented Aug 6, 2020

I am having an issue where it is not seeing, or evaluating my validation samples.

As per the walk through provided at https://medium.com/deepquestai/train-object-detection-ai-with-6-lines-of-code-6d087063f6ff
I have split my images and annotations roughly 75% 25% between train and validation folders.
there are 69 files in each of the respective images and annotations folder within the validation folder.

when I run the 6lines I am returned

Generating anchor boxes for training images and annotation...
Average IOU for 9 anchors: 0.91
Anchor Boxes generated.
Detection configuration saved in Samples_forTraining\json\detection_config.json
Evaluating over 0 samples taken from Samples_forTraining\validation
Training over 203 samples given at Samples_forTraining\train
Training on: ['SnowMeter']
Training with Batch Size: 4
Number of Training Samples: 203
Number of Validation Samples: 0
Number of Experiments: 100
Training with transfer learning from pretrained Model

Copy link

ghost commented Mar 15, 2021

It giving an error
i can give object name correctly but it shows file not found error pls clarify it

FileNotFoundError: [Errno 2] No such file or directory: 'Number plate/train/annotations'
Screenshot (25)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment