The project was completed to have the source code to customize the Tensorflow model.
The repository contains the complete source code of the project.
Steps to follow:
-
cd C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations
-
Edit label_map.pbtxt
-
cd C:\Users\ajink\Documents\TensorFlow\scripts\preprocessing
-
Edit xml_to_csv.py
-
python xml_to_csv.py -i C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\images\train -o C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations\train_labels.csv
-
python xml_to_csv.py -i C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\images\test -o C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations\test_labels.csv
-
cd C:\Users\ajink\Documents\TensorFlow\scripts\preprocessing
-
Edit generate_tfrecord.py
-
python generate_tfrecord.py --label=ship --csv_input=C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations\train_labels.csv --output_path=C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations\train.record --img_path=C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\images\train
-
python generate_tfrecord.py --label=ship --csv_input=C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations\test_labels.csv --output_path=C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\annotations\test.record --img_path=C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\images\test
-
cd C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\training
-
Edit ssd_inception_v2_coco.config
-
cd C:\Users\ajink\Documents\Tensorflow\models\research
-
set PYTHONPATH=C:\Users\ajink\Documents\Tensorflow\models
-
set PYTHONPATH=C:\Users\ajink\Documents\Tensorflow\models\research
-
set PYTHONPATH=C:\Users\ajink\Documents\Tensorflow\models\research\slim
-
python setup.py build
-
python setup.py install
-
cd C:\Users\ajink\Documents\TensorFlow\workspace\training_demo
-
python train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/ssd_inception_v2_coco.config
-
cd C:\Users\ajink\Documents\TensorFlow\workspace\training_demo
-
tensorboard --logdir=training\
-
cd C:\Users\ajink\Documents\TensorFlow\workspace\training_demo\training
-
Sort all the files inside training_demo/training by descending time and pick the model.ckpt-* file that comes first in the list. Make a note of the file’s name, as it will be passed as an argument when we call the export_inference_graph.py script.
-
cd C:\Users\ajink\Documents\TensorFlow\workspace\training_demo
-
python export_inference_graph.py --input_type image_tensor --pipeline_config_path training/ssd_inception_v2_coco.config --trained_checkpoint_prefix training/model.ckpt-* --output_directory trained-inference-graphs/output_inference_graph_v1.pb
-
cd C:\Users\ajink\Documents\Tensorflow\workspace\training_demo
-
Edit tensorflow_object_detection.py
-
activate tensorflow_gpu
-
python tensorflow_object_detection.py