为Caffe生成LMDB [英] Generating LMDB for Caffe

查看:70
本文介绍了为Caffe生成LMDB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用caffe建立一个用于深度分析的深度学习模型(我正在使用python包装器).但是我无法理解如何为此目的生成lmdb数据结构.我已经浏览了Imagenet和mnist示例,并且了解到我应该以

I am trying to build a deep learning model for Saliency analysis using caffe (I am using the python wrapper). But I am unable to understand how to generate the lmdb data structure for this purpose. I have gone through the Imagenet and mnist examples and I understand that I should generate labels in the format

my_test_dir/picture-foo.jpg 0

但是在我的情况下,我将用0或1标记每个像素,以指示该像素是否显着.那不会是图像的单一标签.

But in my case, I will be labeling each pixel with 0 or 1 indicating whether that pixel is salient or not. That won't be a single label for an image.

如何为基于像素的标签生成lmdb文件?

How to generate lmdb files for a per pixel based labeling ?

推荐答案

您可以通过两种方式解决此问题:

You can approach this problem in two ways:

1..使用HDF5数据层而不是LMDB. HDF5更加灵活,可以支持标签图像的大小.您可以查看此答案,以获取构造和使用HDF5输入数据层的示例.

1. Using HDF5 data layer instead of LMDB. HDF5 is more flexible and can support labels the size of the image. You can see this answer for an example of constructing and using HDF5 input data layer.

2..您可以具有两个LMDB输入层:一层用于图像,一层用于标签.请注意,在构建LMDB时,必须使用'shuffle'选项才能使图像及其标签同步.

2. You can have two LMDB input layers: one for the image and one for the label. Note that when you build the LMDB you must not use the 'shuffle' option in order to have the images and their labels in sync.

更新:我最近在此处给出了更详细的答案.

Update: I recently gave a more detailed answer here.

这篇关于为Caffe生成LMDB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆