MCPcopy Create free account
hub / github.com/OAID/Tengine / ReadEntireFile

Function ReadEntireFile

examples/tensorflow_wrapper/label_image/label_image.cpp:37–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35using namespace std;
36
37static int ReadEntireFile(const char* fname, vector<char>& buf)
38{
39 ifstream fs(fname, ios::binary | ios::in);
40 if(!fs)
41 {
42 cout << fname << " does not exist" << endl;
43 return -1;
44 }
45
46 fs.seekg(0, ios::end);
47 int fsize = fs.tellg();
48
49 fs.seekg(0, ios::beg);
50 buf.resize(fsize);
51 fs.read(buf.data(), fsize);
52
53 fs.close();
54 return 0;
55}
56
57static float* ReadImageFile(const char* image_file, cv::Mat& img, const int input_height, const int input_width,
58 const float input_mean, const float input_std)

Callers 1

LoadGraphFunction · 0.85

Calls 1

dataMethod · 0.45

Tested by

no test coverage detected