Step-by-step SSD training on own dataset
git clone https://github.com/tensorflow/models.git
- Install dependencies required in Requirement
- New data can be labeled using lableImg Repo
Note: label files should be in VOC format (.xml files) - Split data into train and validation sets:
Split randomly with 80% training and 20% validation Convert .xml files into train.tfrecord and valid.tfrecord files
- Modify .config file in /samples/configs/<>.config
- Train SSD as show in Tensorflow Repo
# From the tensorflow/models/research/ directory
PIPELINE_CONFIG_PATH={path to pipeline config file}
MODEL_DIR={path to model directory}
NUM_TRAIN_STEPS=50000
SAMPLE_1_OF_N_EVAL_EXAMPLES=1
python object_detection/model_main.py \
--pipeline_config_path=${PIPELINE_CONFIG_PATH} \
--model_dir=${MODEL_DIR} \
--num_train_steps=${NUM_TRAIN_STEPS} \
--sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES \
--alsologtostderr
- Turn trained model into frozen graph
- Convert model into TensorRT version for inference
- Hardware: Jetson Nano
- Installation:
Setup Jetson Nano as required in NVIDIA Site Build tensorflow 1.12.2 sited in jkjung-avt.github
sudo pip3 uninstall -y tensorboard tensorflow
cd <PROJECT_DIR>
git clone https://github.com/jkjung-avt/jetson_nano.git
cd jetson_nano
./install_protobuf-3.6.1.sh
./install_bazel-0.15.2.sh
./install_tensorflow-1.12.2.sh
Note when building tensorflow on Jetson Nano: error: not found line #define #define NV_TENSORRT_SONAME_MAJOR in /usr/include/aar.../Nvinfer.h can be solve by placing the following lines in Nvinfer.h file.
#define NV_TENSORRT_SONAME_MAJOR 4
#define NV_TENSORRT_SONAME_MINOR 0
#define NV_TENSORRT_SONAME_PATCH 1