MCPcopy
hub / github.com/DingXiaoH/RepVGG / __getitem__

Method __getitem__

data/lmdb_dataset.py:56–77  ·  view source on GitHub ↗
(self, index)

Source from the content-addressed store, hash-verified

54 self.keys = loads_pyarrow(txn.get(b'__keys__'))
55
56 def __getitem__(self, index):
57 env = self.env
58 with env.begin(write=False) as txn:
59 byteflow = txn.get(self.keys[index])
60
61 unpacked = loads_pyarrow(byteflow)
62
63 # load img
64 imgbuf = unpacked[0]
65 buf = six.BytesIO()
66 buf.write(imgbuf)
67 buf.seek(0)
68 img = Image.open(buf).convert('RGB')
69 if self.transform is not None:
70 img = self.transform(img)
71
72 # load label
73 target = unpacked[1]
74 if self.target_transform is not None:
75 target = self.transform(target)
76
77 return img, target
78# if self.transform is not None:
79# img = self.transform(img)
80#

Callers

nothing calls this directly

Calls 1

loads_pyarrowFunction · 0.85

Tested by

no test coverage detected