MCPcopy Create free account
hub / github.com/BVLC/caffe / datum_to_array

Function datum_to_array

python/caffe/io.py:84–93  ·  view source on GitHub ↗

Converts a datum to an array. Note that the label is not returned, as one can easily get it by calling datum.label.

(datum)

Source from the content-addressed store, hash-verified

82
83
84def datum_to_array(datum):
85 """Converts a datum to an array. Note that the label is not returned,
86 as one can easily get it by calling datum.label.
87 """
88 if len(datum.data):
89 return np.fromstring(datum.data, dtype=np.uint8).reshape(
90 datum.channels, datum.height, datum.width)
91 else:
92 return np.array(datum.float_data).astype(float).reshape(
93 datum.channels, datum.height, datum.width)
94
95
96## Pre-processing

Callers

nothing calls this directly

Calls 1

reshapeMethod · 0.45

Tested by

no test coverage detected