#include <opencv2/opencv.hpp> #include <onnxruntime/onnxruntime_cxx_api.h> #include <vector> #include <iostream> int main() { // load onnx model Ort::Env env(OrtLoggingLevel::ORT_LOGGING_LEVEL_WARNING, "test"); Ort::SessionOptions sessionOptions; sessionOptions.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED); const char* modelPath = "your_path/model.onnx"; Ort::Session session(env, modelPath, sessionOptions); auto start = std::chrono::high_resolution_clock::now(); // load image std::vector<int64_t> inputTensorShape = {1, 3, 224, 224}; std::vector<float> inputTensorValues(1*3*224*224); cv::Mat image = cv::imread("your_path/test/class2/2fb9979f7ff12889ca5a69e031b93541.jpg"); cv::cvtColor(image, image, cv::COLOR_BGR2RGB); cv::resize(image, image, […]