20
Building an Object Detection TensorFlow Model Using a Limited Training Set Ian R Brooks Ph.D. AI DevWorld 2019

Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Building an Object Detection TensorFlow Model Using a Limited

Training Set

Ian R Brooks Ph.D. AI DevWorld 2019

Page 2: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Who Is The Data Dude?

• Completed Ph.D. in Computer Science in 2015.

• Involved in Big Data and Hadoop since 2015.

• Joined HWX/Cloudera in 2016 -SE US Federal

• DS SME Lead 2018

Page 3: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Why Are We Here Today?

• The goal is to build an end-to-end project to detect images that contain the Cloudera, Hortonworks, Cloudera Orange logos

Page 4: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Why Else Are We Here?

• Review the image preparation steps involved to build a working Object Detection model

Page 5: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Methodology

• Find and label images

• Create synthetic images using data augmentation

• Find a pre-existing Object Detection Model

• Use TensorFlow’s Transfer Learning library to train DL model

• Live Test: deploy model to Google Coral

Page 6: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Label Images

• Since this is an Object Detection model, images and annotation labels, which X, Y coordinate information on the location of the object in the image, are both required for training

• To create these label annotations, the software package Label-Img can create the object's label annotation into XML files

Page 7: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Data Augmentation

• Considering this is a Deep Learning model, the training set should be in the 1000s of photographs, but this project only has 10s of photos

• In order to create trainset that is proper size, Data Augmentation will be required to create synthetic images for training

• Using a library, it will create synthetic images for training to boost model performance

Page 8: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Data Augmentation

Page 9: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Data Augmentation

Page 10: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Object Detection

• Object detection is a computer technology related to computer vision and image processing that deals with detecting instances of semantic objects of a certain class (such as humans, buildings, or cars) in digital images and videos.

• Well-researched domains of object detection include face detection and pedestrian detection.

• Object detection has applications in many areas of computer vision, including image retrieval and video surveillance.

• https://en.wikipedia.org/wiki/Object_detection

Page 11: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Object Detection

• Object detection is a computer technology related to computer vision and image processing that deals with detecting instances of semantic objects of a certain class in digital images and videos.

• Object detection has applications in many areas of computer vision, including image retrieval and video surveillance.

• https://en.wikipedia.org/wiki/Object_detection

Page 12: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Preexisting COCO Object Detection Model

• COCO is a large-scale object detection, segmentation, and captioning dataset. COCO has several features:

• Object segmentation

• Recognition in context

• Superpixel stuff segmentation

• 330K images (>200K labeled)

• 1.5 million object instances

• 80 object categories

• 91 stuff categories

• 5 captions per image

• 250,000 people with keypoints

http://cocodataset.org

Page 13: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Region - CNN

• R-CNN systems try to solve it is to locate objects in an image (object detection).

• What do you do to solve this? You could start with a sliding window approach.

• When using this method you just go over the whole image with different sized rectangles and look at those smaller images in a brute-force-method.

• https://towardsdatascience.com/r-cnn-3a9beddfd55a

Page 14: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Transfer Learning

• Transfer learning is a research problem in machine learning that focuses on storing knowledge gained while solving one problem and applying it to a different but related problem

• For example, knowledge gained while learning to recognize cars could apply when trying to recognize trucks

• https://en.wikipedia.org/wiki/Transfer_learning

Page 15: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Advantages to Transfer Learning

• Higher start. The initial skill (before refining the model) on the source model is higher than it otherwise would be.

• Higher slope. The rate of improvement of skill during training of the source model is steeper than it otherwise would be.

• Higher asymptote. The converged skill of the trained model is better than it otherwise would be.

Page 16: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Results – Cloudera Orange

Page 17: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Results – Hortonworks Elephants

Page 18: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Results – Cloudera

Page 19: Building an Object Detection TensorFlow Model Using a ... › AIDevWorld › ... · •Use TensorFlow’s Transfer Learning library to train DL model •Live Test: deploy model to

Live Model Test – Google Coral

• Using the online Coral compiler, the TensorFlow model will be converted to a TensorFlow Lite model

• The TF Lite model can be deployed to the Google Coral single board computer for live testing