Cator生成的LMDB数据加载在Pytorch中崩溃

时间:2017-07-01 11:34:58

标签: dataset load caffe pytorch lmdb

我正在尝试加载在Caffe中准备的LMDB数据集。我使用LSUNClass作为参考来加载数据。

dataloader = Data.DataLoader(LSUNClass(db_path=path),batch_size=50,  
                             shuffle=True, num_workers=6, pin_memory=False)

创建dataLoader对象时没有任何问题。但是,当我遍历

for step,(x,y) in enumerate(dataloader):

程序崩溃了@ getitem

def __getitem__(self, index):
    img, target = None, None
    env = self.env
    with env.begin(write=False) as txn:
        imgbuf = txn.get(self.keys[index])
        print('The buffer information :',len(imgbuf),index,self.keys[index])
    buf = six.BytesIO()
    buf.write(imgbuf)
    buf.seek(0)
    img = Image.open(buf).convert('RGB')


File "", line 30, in getitem
img = Image.open(buf).convert('RGB')
File "/anaconda/envs/py35/lib/python3.5/site-packages/PIL/Image.py", line 2319, in open
% (filename if filename else fp))
OSError: cannot identify image file <_io.BytesIO object at 0x7f677db0b570>

但是,如果我从Pytorch加载LSUN LMDB数据集默认,那么它工作正常。使用了一组代码,但Caffe Lmdb崩溃了。

任何意见都将受到赞赏。

0 个答案:

没有答案