HomeArtificial IntelligenceArtificial Intelligence DIYCreation of new detection models in AI

Creation of new detection models in AI

An DeepQuest AI (A Brand of AI Commons Global Limited) project deepquestai.com.

Developed and Maintained by Moses Olafenwa and John Olafenwa, brothers, creators of TorchFusion, Authors of Introduction to Deep Computer Vision and creators of DeepStack AI Server.

Built with simplicity in mind, ImageAI supports a list of state-of-the-art Machine Learning algorithms for image prediction, custom image prediction, object detection, video detection, video object tracking and image predictions trainings. ImageAI currently supports image prediction and training using 4 different Machine Learning algorithms trained on the ImageNet-1000 dataset. ImageAI also supports object detection, video detection and object tracking using RetinaNet, YOLOv3 and TinyYOLOv3 trained on COCO dataset. Finally, ImageAI allows you to train custom models for performing detection and recognition of new objects.

Eventually, ImageAI will provide support for a wider and more specialized aspects of Computer Vision including and not limited to image recognition in special environments and special fields.

New Release : ImageAI 2.1.5

What’s new:

  • Tensorboard logging for all prediction and detection model training.
  • Progress bar for detection training
  • Allow prediction and detection in multi-threaded code
  • Automatic Multi-GPU utilization for detection training
  • Custom detection model metrics retrieval
  • Bug fix: change custom model probability from string to float

Dependencies

To use ImageAI in your application developments, you must have installed the following dependencies before you install ImageAI :

  • Python 3.5.1 (and later versions)
  • Tensorflow 1.4.0 (and later versions) (Tensorflow 2.0 coming soon)
  • OpenCV
  • Keras 2.x
pip install -U tensorflow keras opencv-python

Installation

To install ImageAI, run the python installation instruction below in the command line:

pip3 install imageai --upgrade

Image Prediction

convertible : 52.459555864334106
sports_car : 37.61284649372101
pickup : 3.1751200556755066
car_wheel : 1.817505806684494
minivan : 1.7487050965428352

ImageAI provides 4 different algorithms and model types to perform image prediction, trained on the ImageNet-1000 dataset. The 4 algorithms provided for image prediction include SqueezeNetResNetInceptionV3 and DenseNet.

Object Detection

Creation of new detection models in AI 1
Creation of new detection models in AI 11
Creation of new detection models in AI 2
Creation of new detection models in AI 12
person : 91.946941614151
--------------------------------
person : 73.61021637916565
--------------------------------
laptop : 90.24320840835571
--------------------------------
laptop : 73.6881673336029
--------------------------------
laptop : 95.16398310661316
--------------------------------
person : 87.10319399833679
--------------------------------

ImageAI provides very convenient and powerful methods to perform object detection on images and extract each object from the image. The object detection class provides support for RetinaNet, YOLOv3 and TinyYOLOv3, with options to adjust for state of the art performance or real time processing.

Video Object Detection and Tracking

Video Object Detection & Analysis

Below is a snapshot of a video with objects detected.

Creation of new detection models in AI 3

Video Custom Object Detection (Object Tracking)

Below is a snapshot of a video with only person, bicycle and motorcyle detected.

Creation of new detection models in AI 4

Video Analysis Visualization

Below is a visualization of video analysis returned by ImageAI into a ‘per_second’ function.

Creation of new detection models in AI 5

ImageAI provides very convenient and powerful methods to perform object detection in videos and track specific object(s). The video object detection class provided only supports the current state-of-the-art RetinaNet, but with options to adjust for state of the art performance or real time processing. Click the link to see the full videos, sample codes, explanations and best practices guide.

Custom Model Training

A sample from the IdenProf Dataset used to train a Model for predicting professionals.

Creation of new detection models in AI 6

ImageAI provides classes and methods for you to train a new model that can be used to perform prediction on your own custom objects. You can train your custom models using SqueezeNet, ResNet50, InceptionV3 and DenseNet in 5 lines of code. Click the link below to see the guide to preparing training images, sample training codes, explanations and best practices.

Custom Image Prediction

Prediction from a sample model trained on IdenProf, for predicting professionals

Creation of new detection models in AI 7
Creation of new detection models in AI 13

ImageAI provides classes and methods for you to run image prediction your own custom objects using your own model trained with ImageAI Model Training class. You can use your custom models trained with SqueezeNet, ResNet50, InceptionV3 and DenseNet and the JSON file containing the mapping of the custom object names. 

Custom Detection Model Training

Training detection models to detect and recognize new objects.

Creation of new detection models in AI 8

ImageAI provides classes and methods for you to train new YOLOv3 object detection models on your custom dataset. This means you can train a model to detect literally any object of interest by providing the images, the annotations and training with ImageAI.

Custom Object Detection

Detection result from a custom YOLOv3 model trained to detect the Hololens headset.

Creation of new detection models in AI 9
hololens  :  39.69653248786926  :  [611, 74, 751, 154]
hololens  :  87.6643180847168  :  [23, 46, 90, 79]
hololens  :  89.25175070762634  :  [191, 66, 243, 95]
hololens  :  64.49641585350037  :  [437, 81, 514, 133]
hololens  :  91.78624749183655  :  [380, 113, 423, 138]

ImageAI now provides classes and methods for you detect and recognize your own custom objects in images using your own model trained with the DetectionModelTraining class. You can use your custom trained YOLOv3 mode and the detection_config.json file generated during the training.

Custom Video Object Detection & Analysis

Video Detection result from a custom YOLOv3 model trained to detect the Hololens headset in a video.

Creation of new detection models in AI 10

Now you can use your custom trained YOLOv3 model to detect, recognize and analyze objects in videos.

Contributors

We are inviting anyone who wishes to contribute to the ImageAI project to reach to us. We primarily need contributions in translating the documentation of the project’s code to major languages that includes but not limited to French, Spanish, Portuguese, Arabian and more. We want every developer and researcher around the world to benefit from this project irrespective of their native languages.

We give special thanks to Kang vcar for his incredible and excellent work in translating ImageAI‘s documentation to the Chinese language. Find below the contact details of those who have contributed immensely to the ImageAI project.

Citation

You can cite ImageAI in your projects and research papers via the BibTeX entry below.

@misc {ImageAI,
    author = "Moses and John Olafenwa",
    title  = "ImageAI, an open source python library built to empower developers to build applications and systems  with self-contained Computer Vision capabilities",
    url    = "https://github.com/OlafenwaMoses/ImageAI",
    month  = "mar",
    year   = "2018--"
}

>>> Basic Sponsors

References

  1. Somshubra Majumdar, DenseNet Implementation of the paper, Densely Connected Convolutional Networks in Keras https://github.com/titu1994/DenseNet
  2. Broad Institute of MIT and Harvard, Keras package for deep residual networks https://github.com/broadinstitute/keras-resnet
  3. Fizyr, Keras implementation of RetinaNet object detection https://github.com/fizyr/keras-retinanet
  4. Francois Chollet, Keras code and weights files for popular deeplearning models https://github.com/fchollet/deep-learning-models
  5. Forrest N. et al, SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size https://arxiv.org/abs/1602.07360
  6. Kaiming H. et al, Deep Residual Learning for Image Recognition https://arxiv.org/abs/1512.03385
  7. Szegedy. et al, Rethinking the Inception Architecture for Computer Vision https://arxiv.org/abs/1512.00567
  8. Gao. et al, Densely Connected Convolutional Networks https://arxiv.org/abs/1608.06993
  9. Tsung-Yi. et al, Focal Loss for Dense Object Detection https://arxiv.org/abs/1708.02002
  10. O Russakovsky et al, ImageNet Large Scale Visual Recognition Challenge https://arxiv.org/abs/1409.0575
  11. TY Lin et al, Microsoft COCO: Common Objects in Context https://arxiv.org/abs/1405.0312
  12. Moses & John Olafenwa, A collection of images of identifiable professionals. https://github.com/OlafenwaMoses/IdenProf
  13. Joseph Redmon and Ali Farhadi, YOLOv3: An Incremental Improvement. https://arxiv.org/abs/1804.02767
  14. Experiencor, Training and Detecting Objects with YOLO3 https://github.com/experiencor/keras-yolo3

This article has been published from the source link without modifications to the text. Only he headline has been changed.

Source link

Most Popular