| 64 | }; |
| 65 | |
| 66 | void get_input_data_ssd(std::string& image_file, float* input_data, int img_h, int img_w) |
| 67 | { |
| 68 | image img = imread(image_file.c_str()); |
| 69 | |
| 70 | image resImg = resize_image(img, img_w, img_h); |
| 71 | resImg = rgb2bgr_premute(resImg); |
| 72 | float* img_data = ( float* )resImg.data; |
| 73 | int hw = img_h * img_w; |
| 74 | |
| 75 | float mean[3] = {127.5, 127.5, 127.5}; |
| 76 | for(int c = 0; c < 3; c++) |
| 77 | { |
| 78 | for(int h = 0; h < img_h; h++) |
| 79 | { |
| 80 | for(int w = 0; w < img_w; w++) |
| 81 | { |
| 82 | input_data[c * hw + h * img_w + w] = 0.007843 * (*img_data - mean[c]); |
| 83 | img_data++; |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | void post_process_ssd(std::string& image_file, float threshold, float* outdata, int num, const std::string& save_name) |
| 90 | { |
no test coverage detected