Imageai
At the moment since I need no subpage there is just net training information from here
Hello everyone, I really appreciate the patience you have all exercised since the beginning of this thread.
I am glad to announce that training and performing image detection, video detection and video analysis with YOLOv3 on your custom image datasets is now available. KINDLY READ THE DETAILS BELOW.
N.B: The new features have been released but not documented yet in README and official API documentation. This will will done before the end of the week.
However, we have provided sufficient example codes, example datasets and sample trained models for you to start using this feature. Everything you need to start using the new features are detailed below.1) INSTALLATION:
ImageAI (v2.0.1) is now available on PyPi. To install the latest release, install via the command below.pip3 install imageai --upgrade
2) ANNOTATING YOUR CUSTOM DATASET
For custom detection model training, ImageAI uses the Pascal VOC format for image annotation. You can easily annotate your dataset using the tool LabelIMG which is available on Windows, Linux and MacOShttps://github.com/tzutalin/labelImg
Also, I will advice that your image dataset contains up to about 200 image samples, from which you can allocate 150 for training and 50 for validation. Your dataset can contain one or many objects.
3)ORGANIZING YOUR CUSTOM DATASET
Once you have annotated your dataset in the Pascal VOC format, ensure your dataset directory is organized as in the sample below.`
train >> images >> img_1.jpg
train >> images >> img_2.jpg
train >> images >> img_3.jpg
train >> annotations >> img_1.xml
train >> annotations >> img_2.xml
train >> annotations >> img_3.xmlvalidation >> images >> img_151.jpg
validation >> images >> img_152.jpg
validation >> images >> img_153.jpg
validation >> annotations >> img_151.xml
validation >> annotations >> img_152.xml
validation >> annotations >> img_153.xml`4) TRAINING ON YOUR CUSTOM DATASET
You can train your custom detection model completely from scratch or use transfer learning (recommended for better accuracy) from a pre-trained YOLOv3 model. Below is the link to the pre-trained model and also sample datasets you can use.
https://github.com/OlafenwaMoses/ImageAI/releases/tag/essential-v4
The example code to train your object detection model is as linked below after the notes.
N.B:
- The default batch_size is 4. If you are training with Google Colab, this will be fine. However, I will advice you use a more powerful GPU than the K80 offered by Colab as the higher your batch_size (8, 16), the better the accuracy of your detection model.
- If you experience '_TfDeviceCaptureOp' object has no attribute '_set_device_from_string' in Google Colab, it is due to a bug in Tensorflow. You can solve this by installing Tensorflow GPU 1.13.1 pip3 install tensorflow-gpu==1.13.1.
https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection_train.py
Once your training starts, your models and the _detection_config.json_ file you need for performing custom detection will be saved in your dataset/models and dataset/json folder respectively.
5) EVALUATING YOUR MODEL's mAP
After traing your model, you can evaluate the mAP of your models by specifying your desired IoU and Non-maximum suppression values. The sample codes are linked below.
Single Model Evaluation = https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection_single_model_evaluation.py
Multi-Model Evaluation = https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection_multi_model_evaluation.py
6)IMAGE AND VIDEO OBJECT DETECTION WITH YOUR CUSTOM MODEL
We have provided a number of sample codes for using your custom detection model in detecting objects in images and videos. In addition, we have provided a sample model trained to detect the Hololens headset. See the links below for all the resources.
https://github.com/OlafenwaMoses/ImageAI/releases/tag/essential-v4
https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection.py
https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection_array_input_output.py
https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection_extract_objects.py
https://github.com/OlafenwaMoses/ImageAI/blob/master/examples/custom_detection_video.py
All you need to do is keep all images of all objects in the same folder as well as their corresponding annotation XMLs in the same folder. Then set your object_names_array in the .setTrainConfig() function to the names of the unique objects as seen in the example below.
trainer.setTrainConfig(object_names_array=["hololens", "google-glass", "oculus"], ........)
- Last Author
- chrisw
- Last Edited
- Apr 14 2020, 8:01 PM