小编J. *_*Doe的帖子

使用 Tensorflow 对象检测 api 打乱训练数据集

我正在使用 Faster-RCNN 模型和 Tensorflow 对象检测 API 来开发徽标检测算法。我的数据集按字母顺序排列(因此有一百个阿迪达斯徽标,然后是一百个苹果徽标等)。我希望在训练时对其进行洗牌。

我在配置文件中添加了一些值:

train_input_reader:{
          shuffle: true
          queue_capacity: some value
          min_after_dequeue : some other value}
Run Code Online (Sandbox Code Playgroud)

然而,无论我输入什么值,算法首先对所有 a 的徽标(阿迪达斯、苹果等)进行训练,并且在开始看到 b 的徽标(宝马等)后仅经过一段时间,然后c 是一个等等。

当然,我可以直接打乱输入数据集,但我想了解其背后的逻辑。

PS:我看过这篇关于 shuffle 和 min_after_dequeue 的文章,但我仍然不太明白。我的批量大小是 1,所以它不应该使用,tf.train.shuffle_batch()但只能使用tf.RandomShuffleQueue

我的训练数据集大小是 5000,如果我写min_after_dequeue: 4000 or 5000它仍然没有正确洗牌。为什么呢?


更新:@AllenLavoie 这对我来说有点难;因为有很多依赖项,而且我是 Tensorflow 的新手。但最终队列是由

tf.contrib.slim.parallel_reader.parallel_read(    _, string_tensor = parallel_reader.parallel_read(
        config.input_path,
        reader_class=tf.TFRecordReader,
        num_epochs=(input_reader_config.num_epochs
                    if input_reader_config.num_epochs else None),
        num_readers=input_reader_config.num_readers,
        shuffle=input_reader_config.shuffle,
        dtypes=[tf.string, tf.string],
        capacity=input_reader_config.queue_capacity,
        min_after_dequeue=input_reader_config.min_after_dequeue)
Run Code Online (Sandbox Code Playgroud)

似乎当我放入num_readers = 1配置文件时,数据集最终按照我想要的方式进行洗牌(至少在开始时),但是当开始时有更多内容时,徽标将按字母顺序排列。

queue shuffle object-detection tensorflow

5
推荐指数
1
解决办法
2178
查看次数

标签 统计

object-detection ×1

queue ×1

shuffle ×1

tensorflow ×1