LogoTL
LogoTL copied to clipboard
Using Transfer Learning to build an logo Object Detection model for Tensorflow and Tensorflow Lite #ShadowML
Cloudera Logo Object Detection
Deep Learning
Transfer Learning with Tensorflow
Introduction - Corporate Logo Object Detection
The goal of this project is to build a Tensorflow Object Detection model designed to detect the Cloudera and Hortonworks logos. This project will include the scripts, photos, and instructions that are required to follow this project at home. This Github repo include annotated images and completed models for quick testing.

Language: Python
Requirements:
- Python 3.8
- Tensorflow 2.3.1
Author: Ian R Brooks
Follow: LinkedIn - Ian Brooks PhD
Table of Contents
-
Introduction
-
Links
- Object Detection
- Image Augmentation For Object Detection
- Converting Tensorflow Models to Tensorflow Lite Models
- Google Coral Dev Board
- Tools
-
Image Preprocessing - Image and Label Preparation (Optional)
-
Data Augmentation - Synthetic Image Creation
-
Build Tensorflow Model Instructions
- CDSW/CML Run Instructions
- Quick Instructions
- Step By Step Command Line Instructions
-
Convert Tensorflow Models
Links
Object Detection:
- TensorFlow 2 Object Detection API tutorial
- Object Detection Tutorial Link
- Another Object Detection Tutorial
- Yet Another Object Detection Tutorial
- Logo Object Detection Article
- Logo Object Detection Article Using SSD
Image Augmentation For Object Detection:
- Great Read on Data Augmentation for Object Detection
- Image Augmentation Examples in Python
- Image Augmentation Using Keras
Converting Tensorflow Models:
- Importing a TensorFlow GraphDef based Models into TensorFlow.js
- Getting Started With TensorFlow.js
- Convert TensorFlow Saved Model to TF Lite Model
- Exporting Tained Model for Inference
- Convert Tensorflow Model for TPU
- Convert Tensorflow Model to TFLite
Google Coral Dev Board:
- Coral Board Hardware
- Coral Board Getting Started
- Retrain Object Detection Model Tutorial
- Coral Dev Board - Hands On
Tools:
- Tensorflow Object Detection API
- Online Edge TPU Compiler
- LabelImg - Free Object Labeling Tool
- Data Augmentation for Object Detection GitHub
- ImageMagick - Free Image Processing Tool
- SSD: Single Shot MultiBox Detector
- Gif Maker!!!
Image Preprocessing - Image and Label Preparation (Optional)
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 LabelImg can create the object's label annotation into XML files. Please note this step is optional, these files have been provided in this project, and they are avaiable in the Images/train/ or Images/test/ directories. Below is a screenshot of the the application.

Data Augmentation - Synthetic Image Creation
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 this library, this project will take the originally provided photos and create synthetic images for training to boost model performance. This article on the subject is a must read to fully understand this project.
This process is automated by provided scripts, but the user will need to determine the amount of synthetic training examples that will be created.
Below are a few different examples, please note the object labels are updated for the image.

Build Tensorflow Object Detection Model Instructions
Please Note: Any scripts that use '~/' in the path are assuming this is the home directory of the downloaded project. This is the default for CDSW.
CDSW/CML Run Instructions
- In CSDW/CML, download the project using the git url for here.
- Open a new session, run the CDSW-build.sh script at the terminal prompt, which contains the following operating code.
Manual Instructions
Download and Install Libraries
-
Download the project using the git url for here.
-
Project Setup
./scripts/setup.sh
Preprocessing Images
- Convert CSV labels to Tensorflow TF-Record type.
./scripts/imagePrep.sh
- (Optional) Validate images for sizing errors
python3 scripts/checkImages.py
Build Model Using Transfer Learning - Retrain Model With New Detection Objects
- Start model training process.
./scripts/buildModel.sh

- Evaluate model
./scripts/evalModel.sh

Export TensorFlow Model to Saved Model Format
- Export model
./scripts/exportModel.sh

Convert TensorFlow Saved Model To Java Script
- Export model
./scripts/exportModelJS.sh

(Optional) Convert TensorFlow Saved Model To TFLite Model
- Export model
./scripts/convertTF2TFL.sh

