Tensorflow Object_detection的训练步骤

xx_label_map.pbtxt文件中的内容如下:

 
  1. item {
  2. id: 1
  3. name: 'Abyssinian'
  4. }
  5.  
  6. item {
  7. id: 2
  8. name: 'american_bulldog'
  9. }
  10.  
  11. item {
  12. id: 3
  13. name: 'american_pit_bull_terrier'
  14. }
  15.  

先创建一个create_xx_tf_record.py文件,单独用来处理训练数据。可以直接从object_detection工程下的create_pacal_tf_record.py(如果是每个图片只有一个分类,可以使用create_pet_tf_record.py)复制而来。

修改起始参数配置:

  • data_dir: 数据目录,包含了图片和标注的目录
  • output_dir:输出目录,图片转换为tf_record之后存储的位置
  • label_map_path:上面提到的xx_label_map.pbtxt

修改dict_to_tf_example

参考你的标准xml文件,有些地方需要修改。

dict_to_tf

修改main

修改main

确保你的标注文件,图片目录对应的目录。标注文件目录下是否存在 trainval.txt文件是否存在,这个需要自己生成。我生成的列表(注意:没有带后缀)为:

trainval文件

执行完之后会在对应目录下生成 tf_record文件。

我的文件:

# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the s

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值