MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / ReadFileToDatum

Function ReadFileToDatum

rtpose_wrapper/src/caffe/util/io.cpp:145–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143#endif // USE_OPENCV
144
145bool ReadFileToDatum(const string& filename, const int label,
146 Datum* datum) {
147 std::streampos size;
148
149 fstream file(filename.c_str(), ios::in|ios::binary|ios::ate);
150 if (file.is_open()) {
151 size = file.tellg();
152 std::string buffer(size, ' ');
153 file.seekg(0, ios::beg);
154 file.read(&buffer[0], size);
155 file.close();
156 datum->set_data(buffer);
157 datum->set_label(label);
158 datum->set_encoded(true);
159 return true;
160 } else {
161 return false;
162 }
163}
164
165#ifdef USE_OPENCV
166cv::Mat DecodeDatumToCVMatNative(const Datum& datum) {

Callers 4

ReadImageToDatumFunction · 0.70
TEST_FFunction · 0.50
TYPED_TESTFunction · 0.50
DataLayerSetUpMethod · 0.50

Calls 1

closeMethod · 0.80

Tested by 2

TEST_FFunction · 0.40
TYPED_TESTFunction · 0.40