- python 3
- tensorflow cpu or gpu >= 1.5.0
pip3 install tensorflow-gpu
pip3 install Cython
pip3 install pillow
pip3 install lxml
pip3 install jupyter
pip3 install matplotlib
- DOWNLOAD : https://github.com/google/protobuf/releases/tag/v3.4.0
- SET ENVIRONMENT VARIABLE
- REPLACE "YOUR_SYSTEM_PATH"
set PYTHONPATH=YOUR_SYSTEM_PATH/models;YOUR_SYSTEM_PATH/models/research;YOUR_SYSTEM_PATH/models/research/slim
set PATH=%PATH%;%PYTHONPATH%
protoc ./object_detection/protos/*.proto --python_out=.
py -3 setup.py build
py -3 setup.py install
jupyter notebook object_detection_tutorial.ipynb
- LABEL THE IMAGES USING : https://github.com/tzutalin/labelImg
- PUT IMAGES AT models/research/object_detection/images
- DIVIDE THE IMAGES INTO train AND test
./images
--/test
--/train
py -3 xml_to_csv.py
- OPEN generate_tfrecord.py AND EDIT THE LABEL MAP
# TO-DO replace this with label map
def class_text_to_int(row_label):
if row_label == 'one':
return 1
elif row_label == 'two':
return 2
elif row_label == 'three':
return 3
else:
None
THEN,
py -3 generate_tfrecord.py --csv_input=images/train_labels.csv --image_dir=images/train --output_path=train.record
py -3 generate_tfrecord.py --csv_input=images/test_labels.csv --image_dir=images/test --output_path=test.record
item {
id: 1
name: 'one'
}
item {
id: 2
name: 'two'
}
item {
id: 3
name: 'three'
}
- EXAMPLE AT models/research/object_detection/data
- PUT label_map.pbtxt IN THE models/research/object_detection/training
- COPY THE CONFIG FILE models/research/object_detection/samples/configs/XXXX.config
- PUT THE CONFIG IN THE models/research/object_detection/training
- DOWNLOAD : https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
- EXTRACT AND PUT THE FINE TUNE MODEL IN THE models/research/object_detection
- num_classes = NUM OF CLASSES
- REPLACE all "PATH_TO_BE_CONFIGURED"
- eval_config>num_examples = NUMBER OF TEST IMAGES
- max_detections_per_class = 1
- max_total_detections = 1
- REPLACE XXXX
py -3 train.py --logtostderr --train_dir=training/ --pipeline_config_path=training/XXXX.config
- REPLACE XXXX
py -3 eval.py --logtostderr --train_dir=training/ --pipeline_config_path=training/XXXX.config --checkpoint_dir=training/ --eval_dir=eval/
tensorboard --logdir=training
tensorboard --logdir=eval
- REPLACE XXXX and YYYY
py -3 export_inference_graph.py --input_type image_tensor --pipeline_config_path training/XXXX.config --trained_checkpoint_prefix training/model.ckpt-YYYY --output_directory inference_graph
- "ValueError: Tried to convert 't' to a tensor and failed. Error: Argument must be a dense tensor: range(0, 3) - got shape [3], but wanted []" = ref : EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10#11