tf_inceptionv3训练自己的数据

实习中用到,记录一下:

首先下载retrain.py文件,下载地址https://github.com/tensorflow/tensorflow/tree/r1.1

根据自己的tf版本选择branch

retrain.py的路径在tensorflow-examples-image_retraining-retrain.py

打开retrain.py设置一些参数

  parser.add_argument(
      '--image_dir',
      type=str,
      default='/home/user/inception_v3_retrain/train/',
      help='Path to folders of labeled images.'
  )
  parser.add_argument(
      '--output_graph',
      type=str,
      default='/home/user/inception_v3_retrain/tmp/output_graph.pb',
      help='Where to save the trained graph.'
 parser.add_argument(
      '--output_labels',
      type=str,
      default='/home/user/inception_v3_retrain/tmp/output_labels.txt',
      help='Where to save the trained graph\'s labels.'
  )
parser.add_argument(
      '--model_dir',
      type=str,
      default='/home/user/inception_v3_retrain/tmp/imagenet',
      help="""\
      Path to classify_image_graph_def.pb,
      imagenet_synset_to_human_label_map.txt, and
      imagenet_2012_challenge_label_map_proto.pbtxt.\
      """
  )
  parser.add_argument(
      '--bottleneck_dir',
      type=str,
      default='/home/user/inception_v3_retrain/tmp/bottleneck',
      help='Path to cache bottleneck layer values as files.'
  )

只需要将训练数据按类别存放在不同的子文件夹,并将这些子文件夹存放在一个文件夹中,运行retrain.py

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值