| 73 | } |
| 74 | |
| 75 | void 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 | |
| 96 | struct tensor_dump_header |
| 97 | { |