Lyken17 / Efficient-PyTorch

My best practice of training large dataset using PyTorch.
1.09k stars 138 forks source link

read lmdb file #30

Open jS5t3r opened 1 year ago

jS5t3r commented 1 year ago
from folder2lmdb import ImageFolderLMDB
from torch.utils.data import DataLoader
from torchvision.transforms import transforms
import torchvision

dir_folder = "/home/DATA//lsun/church/church_outdoor_train_lmdb/data.mdb"

transform = transforms.Compose([
    transforms.ToTensor(),
])

dataset = ImageFolderLMDB(dir_folder, transform, transform) # <--- error is here
loader = DataLoader(dataset, batch_size=64)

Error

     31     # self.length = pa.deserialize(txn.get(b'__len__'))
     32     # self.keys = txn.stat().keys()
---> 33     self.keys = pa.deserialize(txn.get(b'__keys__'))

TypeError: a bytes-like object is required, not 'NoneType'