How to train TensorFlow object detection.


1.  Install PASCAL dataset.
ln -s PASCAL/ object_detection

PASCAL
└── VOC2012
    └── VOCdevkit
        ├── local
        │   └── VOC2012
        ├── results
        │   └── VOC2012
        │       ├── Action
        │       ├── Layout
        │       ├── Main
        │       └── Segmentation
        ├── VOC2012
        │   ├── Annotations
        │   ├── benchmark_RELEASE
        │   │   ├── benchmark_code_RELEASE
        │   │   │   ├── cp_src
        │   │   │   └── demo
        │   │   │       ├── datadir
        │   │   │       │   ├── cls
        │   │   │       │   ├── img
        │   │   │       │   └── inst
        │   │   │       ├── indir
        │   │   │       └── outdir
        │   │   └── dataset
        │   │       ├── cls
        │   │       ├── img
        │   │       └── inst
        │   ├── ImageSets
        │   │   ├── Action
        │   │   ├── Layout
        │   │   ├── Main
        │   │   └── Segmentation
        │   ├── JPEGImages
        │   ├── SegmentationClass
        │   └── SegmentationObject
        └── VOCcode






2. create a folder to store .record file.
mkdir object_detection/training/voc2007

3. create .record files
3.1 train.record
python object_detection/create_pascal_tf_record.py --data_dir=object_detection/PASCAL/VOC2007/VOCdevkit  --year=VOC2007 --set=train --output_path=object_detection/training/voc2007/pascal_train.record
 
3.2 val.record
python object_detection/create_pascal_tf_record.py --data_dir=object_detection/PASCAL/VOC2007/VOCdevkit  --year=VOC2007 --set=val --output_path=object_detection/training/voc2007/pascal_val.record



4. change  config file
vi ssd_mobilenet_v1_pets.config

แก้ตรง
 - label_map_path: "object_detection/data/pascal_label_map.pbtxt"
 - label_map_path: "object_detection/data/pascal_label_map.pbtxt"

 - tf_record_input_reader {
    input_path: "object_detection/training/voc2007/pascal_train.record"
 - tf_record_input_reader {
    input_path: "object_detection/training/voc2007/pascal_val.record"
 - #fine_tune_checkpoint: "PATH_TO_BE_CONFIGURED/model.ckpt"
(This is for fine_tune weight model)


5. Train
python object_detection/train.py  --train_dir=object_detection/ResultVoc2007/ --pipeline_config_path=object_detection/samples/configs

out:
INFO:tensorflow:global step 1278: loss = 9.8354 (0.651 sec/step)
INFO:tensorflow:global step 1279: loss = 10.4138 (0.684 sec/step)
INFO:tensorflow:global step 1280: loss = 9.6778 (0.710 sec/step)
INFO:tensorflow:global step 1281: loss = 8.7129 (0.676 sec/step)
INFO:tensorflow:global step 1282: loss = 8.9650 (0.695 sec/step)
INFO:tensorflow:global step 1283: loss = 9.4138 (0.688 sec/step


ความคิดเห็น

บทความที่ได้รับความนิยม