在tensorflow下实现SSD的目标检测

训练自己的数据集环境配置1.生成数据集2.训练数据3.根据自己生成的模型进行预测4.总结环境配置tensorflow-gpu == 1.15.0keras == 2.3.1 (可以不用安装)CUDN == 10.0CUDNN == 7.61.生成数据集在SSD目标检测中需要将VOC数据集转化成.tf格式。运行tf_convert_data.py文件#需要编辑的代码import tensorflow as tffrom datasets import pascalvoc_to_tfr
摘要由CSDN通过智能技术生成

环境配置

tensorflow-gpu == 1.15.0
keras == 2.3.1 (可以不用安装)
CUDA == 10.0
CUDNN == 7.6

1.生成数据集

在SSD目标检测中需要将VOC数据集转化成.tf格式。
运行tf_convert_data.py文件

#需要编辑的代码
import tensorflow as tf

from datasets import pascalvoc_to_tfrecords

FLAGS = tf.app.flags.FLAGS

tf.app.flags.DEFINE_string(
    'dataset_name', 'pascalvoc',
    'The name of the dataset to convert.')
tf.app.flags.DEFINE_string(
    'dataset_dir', "./VOC2007/test/",
    'Directory where the original dataset is stored.')
tf.app.flags.DEFINE_string(
    'output_name', 'voc_2012_train',
    'Basename used for TFRecords output files.')
tf.app.flags.DEFINE_string(
    'output_dir', './tfrecords',
    'Output directory where to store TFRecords files.')

–dataset_name=pascalvoc(此处不需要更改,默认VOC数据)
–dataset_dir=./VOC2007/test(数据集保存位置)
–output_name=voc_2007_train (输出文件名)
–output_dir=./tfrecords(输出文件位置)

2.训练数据

tf.app.flags.DEFINE_float(
    'loss_alpha', 1., 'Alpha parameter in the loss function.')
tf.app.flags.DEFINE_float(
    'negative_ratio', 3., 'Negative ratio in the loss function.')
tf.app.flags.DEFINE_float(
    'match_threshold', 0.5, 'Matching threshold in the loss function.')

# =========================================================================== #
# General Flags.
# =========================================================================== #
tf.app.flags.DEFINE_string(
    'train_dir', './logs/',
    'Directory where checkpoints and event logs are written to.')
tf.app.flags.DEFINE_integer('num_clones', 1,
                            'Number of model clones to deploy.')
#48 True->False
tf.app.flags.DEFINE_boolean('clone_on_cpu', False,
                            'Use CPUs to deploy clones.')
tf.app.flags.DEFINE_integer(
    'num_readers', 4,
    'The number of parallel readers that read data from the dataset.')
tf.app.flags.DEFINE_integer(
    'num_preprocessing_threads', 4,
    'The number of threads used to create the batches.')

tf.app.flags.DEFINE_integer(
    'log_every_n_steps', 10,
    'The frequency with which logs are print.')
tf.app.flags.DEFINE_integer(
    'save_summaries_secs', 60,
    'The frequency with which summaries are saved, in seconds.')
tf.app.flags.DEFINE_integer(
    'save_interval_secs', 600,
    'The frequency with which the model is saved, in seconds.')
tf.app.flags.DEFINE_float(
    'gpu_memory_fraction', 0.7, 'GPU memory fraction to use.')

# ===========&
  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值