Skip to content

AlexBlack2202/ImageAI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ImageAI

A python library built to empower developers to build applications and systems with self-contained Deep Learning and Computer Vision capabilities using simple and few lines of code.

An AI Commons project https://commons.specpal.science Developed and Maintained by Moses Olafenwa and John Olafenwa, brothers, creators of TorchFusion and Authors of Introduction to Deep Computer Vision


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 trained on COCO dataset.
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.0.1
What's new:

  • Addition of Custom Image Prediction model trainings using SqueezeNet, ResNet50, InceptionV3 and DenseNet121
  • Addition of Custom Image Prediction with custom trained models and generated model class json
  • Preview Release: Addition of Video Object Detection and Video Custom Objects Detection (object tracking)
  • Addition of file, numpy array and stream input types for all image prediction and object detection tasks (file inputs only for video detections)
  • Addition of file and numpy array output types for object detection and custom object detection in images
  • Introduction of 4 speed modes ('normal', 'fast', 'faster' and 'fastest') for image prediction, allowing prediction time to reduce by 50% at 'fastest' while maintaining prediction accuracy
  • Introduction of 5 speed modes ('normal', 'fast', 'faster', 'fastest' and 'flash') for all object detection and video object detection tasks, allowing detection time to reduce by over 80%
    with 'flash' detection accuracy balanced with 'minimum_percentage_probability' which is kept at low values
  • Introduction of rate of frame detections, allowing developers to adjust intervals of detections in videos in favour of real time/close to real time result.


TABLE OF CONTENTS

▣ Dependencies
▣ Installation
▣ Image Prediction
▣ Object Detection
▣ Video Object Detection and Tracking
▣ Custom Model Training
▣ Custom Image Prediction
▣ Sample Applications
▣ AI Practice Recommendations
▣ Contact Developers
▣ References



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) Download (Support for Python 2.7 coming soon)
- pip3 Install
- Tensorflow 1.4.0 (and later versions) Install or install via pip

 pip3 install --upgrade tensorflow 
- Numpy 1.13.1 (and later versions) Install or install via pip
 pip3 install numpy 
- SciPy 0.19.1 (and later versions) Install or install via pip
 pip3 install scipy 
- OpenCV Install or install via pip
 pip3 install opencv-python 
- Pillow Install or install via pip
 pip3 install pillow 
- Matplotlib Install or install via pip
 pip3 install matplotlib 
- h5py Install or install via pip
 pip3 install h5py 
- Keras 2.x Install or install via pip
 pip3 install keras 

Installation

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

pip3 install https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.1/imageai-2.0.1-py3-none-any.whl


or download the Python Wheel imageai-2.0.1-py3-none-any.whl and run the python installation instruction in the command line to the path of the file like the one below:

pip3 install C:\User\MyUser\Downloads\imageai-2.0.1-py3-none-any.whl

Image Prediction

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 SqueezeNet, ResNet, InceptionV3 and DenseNet. You will find below the result of an example prediction using the ResNet50 model, and the 'Tutorials & Documentation' link below the image. Click the link to see the full sample codes, explainations, best practices guide and documentation.

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

>>> Tutorials & Documentation



Object Detection

ImageAI provides very convenient and powerful methods to perform object detection on images and extract each object from the image. The 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. You will find below the result of an example object detection using the RetinaNet model, and the 'Tutorials & Documentation' link below the images. Click the link to see the full sample codes, explainations, best practices guide and documentation.

Input Image



Output Image


person : 91.946941614151

person : 73.61021637916565

laptop : 90.24320840835571

laptop : 73.6881673336029

laptop : 95.16398310661316

person : 87.10319399833679

>>> Tutorials & Documentation



Video Object Detection and Tracking

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. You will find below the result of an example object detection using the RetinaNet model, and the 'Tutorials & Documentation' link below the images. Click the link to see the full videos, sample codes, explainations, best practices guide and documentation.

Video Object Detection

Below is a snapshot of a video with objects detected.


Video Custom Object Detection (Object Tracking)

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


>>> Tutorials & Documentation



Custom Model Training

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 less than 12 lines of code. You will find below the 'Full Details & Documentation' link below the image. Click the link below the image to see the guide to preparing training images, sample training codes, explainations, best practices guide and documentation.


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


>>> Tutorials & Documentation



Custom Image Prediction

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 custom models trained with SqueezeNet, ResNet50, InceptionV3 and DenseNet and the JSON file containing the mapping of the custom object names. You will find the 'Tutorials & Documentation' link below the image. Click the link to see the guide to sample training codes, explainations, best practices guide and documentation.


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

mechanic : 76.82620286941528
chef : 10.106072574853897
waiter : 4.036874696612358
police : 2.6663416996598244
pilot : 2.239348366856575

>>> Tutorials & Documentation




Real-Time and High Perfomance Implementation

ImageAI provides abstracted and convenient implementations of state-of-the-art Computer Vision technologies. All of ImageAI implementations and code can work on any computer system with moderate CPU capacity. However, the speed of processing for operations like image prediction, object detection and others on CPU is slow and not suitable for real-time applications. To perform real-time Computer Vision operations with high performance, you need to use GPU enabled technologies.

ImageAI uses the Tensorflow backbone for it's Computer Vision operations. Tensorflow supports both CPUs and GPUs ( Specifically NVIDIA GPUs. You can get one for your PC or get a PC that has one) for machine learning and artificial intelligence algorithms' implementations. To use Tensorflow that supports the use of GPUs, follow the link below :

FOR WINDOWS
https://www.tensorflow.org/install/install_windows

FOR macOS
https://www.tensorflow.org/install/install_mac

FOR UBUNTU
https://www.tensorflow.org/install/install_linux

Sample Applications

As a demonstration of what you can do with ImageAI, we have built a complete AI powered Photo gallery for Windows called IntelliP , using ImageAI and UI framework Kivy. Follow this link to download page of the application and its source code.

We also welcome submissions of applications and systems built by you and powered by ImageAI for listings here. Should you want your ImageAI powered developments listed here, you can reach to us via our Contacts below.



AI Practice Recommendations

For anyone interested in building AI systems and using them for business, economic, social and research purposes, it is critical that the person knows the likely positive, negative and unprecedented impacts the use of such technologies will have. They must also be aware of approaches and practices recommended by experienced industry experts to ensure every use of AI brings overall benefit to mankind. We therefore recommend to everyone that wishes to use ImageAI and other AI tools and resources to read Microsoft's January 2018 publication on AI titled "The Future Computed : Artificial Intelligence and its role in society ". Kindly follow the link below to download the publication.

https://blogs.microsoft.com/blog/2018/01/17/future-computed-artificial-intelligence-role-society/

Contact Developers

Moses Olafenwa
Email: guymodscientist@gmail.com
Website: https://moses.specpal.science
Twitter: @OlafenwaMoses
Medium : @guymodscientist
Facebook : moses.olafenwa


John Olafenwa
Email: johnolafenwa@gmail.com
Website: https://john.specpal.science
Twitter: @johnolafenwa
Medium : @johnolafenwa
Facebook : olafenwajohn


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

About

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%