Skip to content

Latest commit

 

History

History
45 lines (40 loc) · 2.28 KB

File metadata and controls

45 lines (40 loc) · 2.28 KB

Object-Detection-Using-TensorFlow-JS

This example illustrates how to train a model to perform simple object detection in TensorFlow.js. It includes the full workflow:

  • Usage of Pascal VOC detection dataset
  • Creation of a model for the object-detection task based on a pretrained computer-vision model (MobileNet)
  • Training of the model in Node.js using tfjs-node
  • Transfering the model from the Node.js environment into the browser through saving and loading

How to use this example

First clone the tfjs-examples repository using:

https://github.com/tensorflow/tfjs-examples.git

After that navigate to simple-object-detection directory using:

cd tfjs-examples/mple-object-detection/

Once you are inside simple-object-detection directory download the train.js, package.json, dataprep.js files and copy them. Next to install all the dependencies use:

yarn

Once all the dependenices are installed start training by using the command:

yarn train

To make certain modificaions in the training process you can start training by using:

yarn train \
    --numExamples 20000 \
    --initialTransferEpochs 100 \
    --fineTuningEpochs 200

How to prepare dataset

  • Download the Pascal VOC data set from their offical webiste
  • Once dataset is downloaded navigate to JPEGImages folder and resize all images with size of 224 x 224 and adjust all their annotations accordingly.
  • Convert2Yolo and resize_dataset_pascalvoc might help in accomplishing above mentioned task.

Before starting training make a directory named DataSet and inside this directory make two more directories namely JPEGImage and YOLO. In the directory JPEGImages resized jpeg images should be copied from pascal voc dataset and in YOLO directory all the annotations files should be copied.