Skip to content

Latest commit

 

History

History
126 lines (108 loc) · 5.83 KB

File metadata and controls

126 lines (108 loc) · 5.83 KB

[Japanese/English]

TFLite-ModelMaker-EfficientDet-Colab-Hands-On


Hands-on for TensorFlow Lite Model Maker.
Annotation with VoTT is performed on the local PC, and learning-inference is performed on Colaboratory.
You can also use the annotated dataset without annotating it.

This repository contains the following:

  • Dataset (Annotation not implemented)
  • Dataset (Annotated)
  • Script for Google Colaboratory(Environment setting, model training, inference result confirmation)

Requirement

Tensorflow 2.5.0 or later

Overview

This hands-on assumes about 1.5 hours.

  1. VoTT:Annotation(30-60minutes)
  2. Colaboratory:Environmental preparation
  3. Colaboratory:Convert to format read by object_detector
  4. Colaboratory:Model training(About 5-10minutes)
  5. Colaboratory:Inference

Preparations

The following is required as a preliminary preparation.

  • Clone this repository to your local PC.
  • VoTT installation.

1. VoTT:Annotation

Annotate using VoTT and output in CSV format.
If you use annotated datasets, skip this chapter.

VoTT project settings

Select "New Project"

2020-09-19 (3)

Make project settings

Display name:TFLite-ModelMaker-EfficientDet-Colab-Hands-On
Security token:Generate New Security Token
Source connection:Press「Add Connection」
2021-06-09 (1)

Set the connection of the source connection

Display name:TFLite-ModelMaker-EfficientDet-Colab-Hands-On-TrainData 2021-06-09 (2) Provider: Local file system 2021-06-09 (3) Folder path:Specify the "01_dataset" directory of the cloned repository 2021-06-09 (4)

Set the connection of the target connection

Target connection:Add Connection 2021-06-09 (5) Display name:TFLite-ModelMaker-EfficientDet-Colab-Hands-On-Target
Provider:Local file system
Folder path:Arbitrary directory
2021-06-09 (6)

Add tags and save settings

Tags:Add "Fish"
Press "Save Project" 94047577-3d9dc080-fe0d-11ea-9f4f-b5fe7727fc12

Annotate using VoTT

Select a fish by left dragging the mouse

2020-09-19 (13)

Select "Fish" from TAGS

You can lock the tag you want to use by selecting the padlock mark. 2020-09-19 (14)

CSV export

Export settings

Provider:Comma separated values(CSV)
Asset status: Tagged assets only
Press "Save Export Settings" 2021-06-09 (8) Click the export icon from the annotation screen to export CSV. 2020-09-19 (14)

2. Colaboratory:Environmental preparation

Open In Colab
Subsequent work will be performed on Google Colaboratory.
Open your notebook from the [Open In Colab] link and run it in the following order.

  • Install the required packages
  • Import the required packages

3.Colaboratory:Convert to format read by object_detector

After executing "!mkdir dataset", store the image file and CSV file exported from VoTT.
After storing, execute the following.
If you do not want to perform the annotation hands-on, or if you want to try using the annotated data, change the following "if False:" to "if True:" and execute it.

if False:
    !git clone https://github.com/Kazuhito00/TFLite-ModelMaker-EfficientDet-Colab-Hands-On
    !cp -r TFLite-ModelMaker-EfficientDet-Colab-Hands-On/02_dataset\(Annotated\)/* ./dataset
  • Read CSV
  • Split Training data/validation data/Test data
  • Convert to format read by object_detector

4. Colaboratory:Model training

Please execute in the following order.

  • Import csv file with Model Maker
  • Choose an object detection model archiecture
  • Training
  • Model evaluate
  • Export to TensorFlow Lite format(Full integer quantization)
  • Export to TensorFlow Lite format(Float16 quantization)

5. Colaboratory:Inference

Please execute in the following order.

  • Inference(Full integer quantization)
  • Inference(Float16 quantization)

Author

Kazuhito Takahashi(https://twitter.com/KzhtTkhs)

License

TFLite-ModelMaker-EfficientDet-Colab-Hands-On is under MIT license.