用自己的 Dataset 來訓練模型
  • 48 views,
  • 10-23,
  • 上傳者: Kuann Hung,
  •  0
74134d1edd57c411538bfb2fb7fddfb7.jpeg
步驟
1.
安裝相關套件
pip install glob2
pip install opencv-python
2.
下載相關使用到的 model
# FROM models/research/object_detection
wget http://download.tensorflow.org/models/object_detection/faster_rcnn_inception_v2_coco_2018_01_28.tar.gz
tar -zxvf faster_rcnn_inception_v2_coco_2018_01_28.tar.gz
3.
TFRecordWriter
透過 TFRecordWriter 產生 train.record / eval.record
產生的方式可以參考
def create_tf_example(ex):


  height = ex['height']
  width = ex['width']
  filename = ex['filename']
  image_format = ex['image_format']
  xmins = ex['xmins']
  xmaxs = ex['xmaxs']
  ymins = ex['ymins']
  ymaxs = ex['ymaxs']
  classes_text = ex['classes_text']
  classes = ex['classes']

  print(classes_text)
  print(classes)

  tf_example = tf.train.Example(features=tf.train.Features(feature={
    'image/height': dataset_util.int64_feature(height),
    'image/width': dataset_util.int64_feature(width),
    'image/filename': dataset_util.bytes_feature(filename),
    'image/source_id': dataset_util.bytes_feature(filename),
    'image/format': dataset_util.bytes_feature(image_format),
    'image/object/bbox/xmin': dataset_util.float_list_feature(xmins),
    'image/object/bbox/xmax': dataset_util.float_list_feature(xmaxs),
    'image/object/bbox/ymin': dataset_util.float_list_feature(ymins),
    'image/object/bbox/ymax': dataset_util.float_list_feature(ymaxs),
    'image/object/class/text': dataset_util.bytes_list_feature(str(classes_text)),
    'image/object/class/label': dataset_util.int64_list_feature(classes),
  }))


  return tf_example
訪客如要回應,請先 登入
    資料夾 :
    發表時間 :
    2018-10-23 20:39:38
    觀看數 :
    48
    發表人 :
    Kuann Hung
    部門 :
    老洪的 IT 學習系統
    QR Code :