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

Function get_input_data

tests/bin/test_node_dump.cpp:75–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void get_input_data(const char* image_file, float* input_data, int img_h, int img_w, const float* mean, float scale)
76{
77#if 1
78 image img = imread(image_file);
79 img = rgb2bgr_premute(img);
80 image resImg = resize_image(img, img_w, img_h);
81
82 // int index = 0;
83 int hw = img_h * img_w;
84 for(int c = 0; c < 3; c++)
85 for(int h = 0; h < img_h; h++)
86 for(int w = 0; w < img_w; w++)
87 {
88 {
89 input_data[c * hw + h * img_w + w] = (resImg.data[c * hw + h * img_w + w] - mean[c]) * scale;
90 }
91 }
92
93#endif
94}
95
96struct tensor_dump_header
97{

Callers 6

mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70

Calls 3

imreadFunction · 0.85
rgb2bgr_premuteFunction · 0.85
resize_imageFunction · 0.85

Tested by

no test coverage detected