| 221 | } |
| 222 | |
| 223 | int main(int argc, char* argv[]) { |
| 224 | if (argc != 3) { |
| 225 | fprintf(stderr, "Usage: %s <image_file> <onnx_model_file>\n", argv[0]); |
| 226 | return -1; |
| 227 | } |
| 228 | |
| 229 | const char* img_path = argv[1]; |
| 230 | Mat src_img = imread(img_path); |
| 231 | if (src_img.empty()) { |
| 232 | fprintf(stderr, "read image file %s failed!\n", img_path); |
| 233 | return -1; |
| 234 | } |
| 235 | |
| 236 | const bool resize_input = false; // pplnn can adapt dynamic input size even if onnx model has static input size |
| 237 | if (resize_input) { |
| 238 | resize(src_img, src_img, Size(224, 224)); |
| 239 | } |
| 240 | |
| 241 | const char* onnx_model_path = argv[2]; |
| 242 | int32_t ret = RunClassificationModel(src_img, onnx_model_path); |
| 243 | if (ret != 0) { |
| 244 | fprintf(stderr, "run classification model failed!\n"); |
| 245 | return -1; |
| 246 | } |
| 247 | |
| 248 | return 0; |
| 249 | } |
nothing calls this directly
no test coverage detected