| 161 | } |
| 162 | |
| 163 | int main(int argc, char* argv[]) |
| 164 | { |
| 165 | // Load image file |
| 166 | std::vector<std::string> images; |
| 167 | LoadImageFile(images, image_file); |
| 168 | // Load Label file |
| 169 | std::vector<int> labels; |
| 170 | LoadLableFile(labels, label_file); |
| 171 | |
| 172 | /* |
| 173 | 1. prototxt |
| 174 | 2. mobile |
| 175 | 3. mean |
| 176 | 4. scale |
| 177 | 5. input tensor |
| 178 | 6. output tensor |
| 179 | 7. input weight and input height |
| 180 | 8. image_path |
| 181 | */ |
| 182 | if(argc < 9) |
| 183 | { |
| 184 | std::cout << "The params are not enough \n"; |
| 185 | } |
| 186 | |
| 187 | std::string text_file = argv[1]; |
| 188 | std::string model_file = argv[2]; |
| 189 | std::string mean_val = argv[3]; |
| 190 | std::string scale_val = argv[4]; |
| 191 | std::string input_tensor_name = argv[5]; |
| 192 | std::string output_tensor_name = argv[6]; |
| 193 | std::string image_wh = argv[7]; |
| 194 | std::string val_file_path = argv[8]; |
| 195 | |
| 196 | float means[3]; |
| 197 | float scales[3]; |
| 198 | string delima = ","; |
| 199 | |
| 200 | std::vector<string> res0; |
| 201 | std::vector<string> res1; |
| 202 | std::vector<string> wh; |
| 203 | |
| 204 | split(mean_val, delima, &res0); |
| 205 | split(scale_val, delima, &res1); |
| 206 | split(image_wh, delima, &wh); |
| 207 | |
| 208 | for(int i = 0; i < 3; i++) |
| 209 | { |
| 210 | means[i] = atof(res0[i].c_str()); |
| 211 | scales[i] = atof(res1[i].c_str()); |
| 212 | } |
| 213 | |
| 214 | int img_w = atoi(wh[0].c_str()); |
| 215 | int img_h = atoi(wh[1].c_str()); |
| 216 | int img_size = img_h * img_w * 3; |
| 217 | float* input_data = ( float* )malloc(sizeof(float) * img_size); |
| 218 | |
| 219 | init_tengine(); |
| 220 |
nothing calls this directly
no test coverage detected