If you want to train a neural network model in tensorflow, you need to convert the training data to tfrecord format before it can be read, and the corresponding script file is provided directly in the model file of tensorflow in the following folder:
cd tensorflow/models/research/object_detection/dataset_tools
Among them are:
1.create_coco_tf_record.py: note that this code needs to parse the json format tag file
2. create_pascal_tf_record.py: note that this code needs to parse the xml format label file
......
We need to choose the appropriate script for our label format.
Specific ways to use it:Take create_pascal_tf_record.py as an example, first open the script, and then modify the corresponding information in the file, such as the training set, the validation set of the routing, etc., which you need to modify according to your own situation.
Usage:
python object_detection/dataset_tools/create_pascal_tf_record.py \ --data_dir=/home/user/VOCdevkit\ # routes for data storage, next level subfolder must be voc2012 --year=VOC2012 \ --output_path=/home/user/ # Route and filename of the output file
Above this Tensorflow implementation of the image and label data into a tfRecord file is all I have to share with you, I hope to be able to give you a reference, and I hope you will support me more.