1

I am trying to load LMDB dataset that was prepared in Caffe. I use LSUNClass as reference to load the data.

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

The dataLoader object is created without anyissue. But when I iterate through

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

The program crashes @ 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>

However, if I load LSUN LMDB dataset default from Pytorch then it works fine.Same set of code is used but with Caffe Lmdb is crashes.

Any inputs will be appreciated.

user437777
  • 1,423
  • 4
  • 17
  • 28

0 Answers0