class MiniImagenetLMDB(MiniImagenet): """LMDB version of MiniImagenet. Assume the miniImagenet images are serialized in the target `lmdb` database. A valid lmdb database is required. """ def __init__(self, root, version, phase, label_indent=-1, lmdb=None): super().__init__(root, version, phase, label_indent, imagenet=None) self.lmdb = VisionLMDBDatabase(lmdb) def load_image(self, x): """Load PIL image. Args: @param x: str, the image name, e.g. 'n01614925_1001.JPEG' Return: The corresponding PIL Image object. """ label,_ = x.split(".")[0].split("_") key = os.path.join(label, x).encode('ascii') return self.lmdb.getitem_by_key(key)
def __init__(self, root, version, phase, label_indent=-1, lmdb=None): super().__init__(root, version, phase, label_indent, imagenet=None) self.lmdb = VisionLMDBDatabase(lmdb)
def __init__(self, root, version, phase, factor=0.8, category_pool_name=None, label_indent=-1, lmdb=None): super().__init__(root, version, phase, factor, category_pool_name, label_indent, imagenet=None) self.lmdb = VisionLMDBDatabase(lmdb)