How to train an object detection model - Valentyn1997/xray GitHub Wiki

Training your model is an easy task if all steps are performed precisely.

It is a 3 major-step process:

1. Install tensorflow:

pip install --ignore-installed --upgrade tensorflow==1.9

2. Install tensorflow models:

2.1 Protobuf Installation:

Download the protobuf for your pc: (For mac it is already in dvc)

Then paste it into /TensorFlow/ folder of dvc.

Then Open Terminal: cd into TensorFlow/models/research

Then shoot up this command: python ../../../../src/model_creation/use_probuf.py object_detection/protos/ ../../protoc-3.8.0-osx-x86_64/bin/protoc

(Non-mac: please update the protoc_folder_name in above command)

2.2 Setting Envt Variable: This step is important as you need to set up path for "Slim"

export PYTHONPATH=$PYTHONPATH:/Users/hitansh/Documents/dvc_new/xray/data/TensorFlow/models/research/object_detection

export PYTHONPATH=$PYTHONPATH:/Users/hitansh/Documents/dvc_new/xray/data/TensorFlow/models/research:/Users/hitansh/Documents/dvc_new/xray/data/TensorFlow/models/research/slim

Then test your installation:

From within TensorFlow/models/research/object_detection

jupyter notebook Then run object_detection_tutorial

2.3 Cocoapi installation is not necessary

2.4 Prepare your workspace as shown in the link

2.5 Label your images: (see [tutorial])

It is already done for our project.

3. Start Training

3.1 After labelling images and setting up workspaces, you need to create a label map. It is already done for our project.

3.2 Then you need to create records: It is already done for our project.

3.3 Pipeline: It is already done for our project.