【问题标题】:TensorFlow Object Detection API - Out of MemoryTensorFlow 对象检测 API - 内存不足
【发布时间】:2018-11-17 11:01:09
【问题描述】:

我正在使用 Tensorflow 对象检测 API 来训练我自己的对象检测器。我从模型动物园(here)下载了faster_rcnn_inception_v2_coco_2018_01_28,并制作了我自己的数据集(train.record (~221Mo)、test.record 和标签图)对其进行微调。

但是当我运行它时:

python train.py --logtostderr --pipeline_config_path=/home/username/Documents/Object_Detection/training/faster_rcnn_inception_v2_coco_2018_01_28/pipeline.config --train_dir=/home/username/Documents/Object_Detection/training/

进程在填充 shuffle 缓冲区操作期间被杀死,看起来像是 OOM 问题(16Go RAM)...

2018-06-07 12:02:51.107021: I tensorflow/core/kernels/data/shuffle_dataset_op.cc:94] Filling up shuffle buffer (this may take a while): 410 of 2048
Process stopped

是否存在减小随机缓冲区大小的方法?什么影响它的大小?

然后,我添加了一些交换(115Go 交换 + 16Go RAM)并完成了填充随机缓冲区操作,但我的训练在第 4 步之后占用了所有 RAM 和交换,而我的 train.record 大约是 221 Mo!

我已经将这些行添加到我的 pipeline.config > train_config:

batch_size: 1
batch_queue_capacity: 10
num_batch_queue_threads: 8
prefetch_queue_capacity: 9

这些到我的 pipeline.config > train_input_reader :

queue_capacity: 2
min_after_dequeue: 1
num_readers: 1

关注此post。

我知道我的图像非常(非常非常)大:每张 25 个月,但由于我只拍摄了 9 张图像来制作我的 train.record(只是为了测试我的安装是否顺利),所以它不应该如此消耗内存吧?

关于它为什么使用这么多 RAM 的任何其他想法?

(顺便说一句,我只使用 CPU)

【问题讨论】:

    标签: python tensorflow object-recognition


    【解决方案1】:

    图像数量不是问题。问题是您的输入图像分辨率(在您的设置 .config 文件中)。您需要在此处更改高度和宽度值(在您的 .config 文件中类似):

    image_resizer {
      # TODO(shlens): Only fixed_shape_resizer is currently supported for NASNet
      # featurization. The reason for this is that nasnet.py only supports
      # inputs with fully known shapes. We need to update nasnet.py to handle
      # shapes not known at compile time.
      fixed_shape_resizer {
        height: 1200
        width: 1200
      }
    }
    

    将宽度和高度设置为较小的值,您将能够完美训练。

    【讨论】:

      猜你喜欢
      • 2021-06-08
      • 2017-12-02
      • 1970-01-01
      • 1970-01-01
      • 2020-07-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-04-24
      相关资源
      最近更新 更多