MCPcopy Index your code
hub / github.com/tensorpack/tensorpack / decoder

Function decoder

tensorpack/dataflow/format.py:192–201  ·  view source on GitHub ↗
(k, v)

Source from the content-addressed store, hash-verified

190 lmdb_data = LMDBData(lmdb_path, shuffle, keys)
191
192 def decoder(k, v):
193 try:
194 datum = cpb.Datum()
195 datum.ParseFromString(v)
196 img = np.fromstring(datum.data, dtype=np.uint8)
197 img = img.reshape(datum.channels, datum.height, datum.width)
198 except Exception:
199 log_once("Cannot read key {}".format(k), 'warn')
200 return None
201 return [img.transpose(1, 2, 0), datum.label]
202 logger.warn("Caffe LMDB format doesn't store jpeg-compressed images, \
203 it's not recommended due to its inferior performance.")
204 return LMDBDataDecoder(lmdb_data, decoder)

Callers 1

fMethod · 0.85

Calls 2

log_onceFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected