diff --git a/demo/csrc/cpp/classifier.cxx b/demo/csrc/cpp/classifier.cxx index a4a12eea16..79094c6d89 100644 --- a/demo/csrc/cpp/classifier.cxx +++ b/demo/csrc/cpp/classifier.cxx @@ -21,8 +21,15 @@ int main(int argc, char* argv[]) { return -1; } + mmdeploy::Profiler profiler("/tmp/profile.bin"); + mmdeploy::Context context; + context.Add(mmdeploy::Device(FLAGS_device)); + context.Add(profiler); + // construct a classifier instance - mmdeploy::Classifier classifier(mmdeploy::Model{ARGS_model}, mmdeploy::Device{FLAGS_device}); + mmdeploy::Classifier classifier(mmdeploy::Model{ARGS_model}, context); + + // apply the classifier; the result is an array-like class holding references to // `mmdeploy_classification_t`, will be released automatically on destruction diff --git a/demo/csrc/cpp/detector.cxx b/demo/csrc/cpp/detector.cxx index e5b9f58183..f6e77c9689 100644 --- a/demo/csrc/cpp/detector.cxx +++ b/demo/csrc/cpp/detector.cxx @@ -21,9 +21,13 @@ int main(int argc, char* argv[]) { fprintf(stderr, "failed to load image: %s\n", ARGS_image.c_str()); return -1; } + mmdeploy::Profiler profiler("/tmp/profile.bin"); + mmdeploy::Context context; + context.Add(mmdeploy::Device(FLAGS_device)); + context.Add(profiler); // construct a detector instance - mmdeploy::Detector detector(mmdeploy::Model{ARGS_model}, mmdeploy::Device{FLAGS_device}); + mmdeploy::Detector detector(mmdeploy::Model{ARGS_model}, context); // apply the detector, the result is an array-like class holding references to // `mmdeploy_detection_t`, will be released automatically on destruction diff --git a/demo/csrc/cpp/pose_detector.cxx b/demo/csrc/cpp/pose_detector.cxx index 6b0803d1b9..577c2b6383 100644 --- a/demo/csrc/cpp/pose_detector.cxx +++ b/demo/csrc/cpp/pose_detector.cxx @@ -21,7 +21,12 @@ int main(int argc, char *argv[]) { using namespace mmdeploy; - PoseDetector detector{Model(model_path), Device(device_name)}; + mmdeploy::Profiler profiler("/tmp/profile.bin"); + mmdeploy::Context context; + context.Add(mmdeploy::Device(device_name)); + context.Add(profiler); + + PoseDetector detector{Model(model_path), context}; auto res = detector.Apply(img); for (int i = 0; i < res[0].length; i++) { diff --git a/demo/csrc/cpp/restorer.cxx b/demo/csrc/cpp/restorer.cxx index 378294fed4..639b29fd44 100644 --- a/demo/csrc/cpp/restorer.cxx +++ b/demo/csrc/cpp/restorer.cxx @@ -22,8 +22,13 @@ int main(int argc, char* argv[]) { return -1; } + mmdeploy::Profiler profiler("/tmp/profile.bin"); + mmdeploy::Context context; + context.Add(mmdeploy::Device(FLAGS_device)); + context.Add(profiler); + // construct a restorer instance - mmdeploy::Restorer restorer{mmdeploy::Model{ARGS_model}, mmdeploy::Device{FLAGS_device}}; + mmdeploy::Restorer restorer{mmdeploy::Model{ARGS_model}, context}; // apply restorer to the image mmdeploy::Restorer::Result result = restorer.Apply(img); diff --git a/demo/csrc/cpp/rotated_detector.cxx b/demo/csrc/cpp/rotated_detector.cxx index 3ddb5d4c1c..24bf1f99af 100644 --- a/demo/csrc/cpp/rotated_detector.cxx +++ b/demo/csrc/cpp/rotated_detector.cxx @@ -22,8 +22,13 @@ int main(int argc, char* argv[]) { return -1; } + mmdeploy::Profiler profiler("/tmp/profile.bin"); + mmdeploy::Context context; + context.Add(mmdeploy::Device(FLAGS_device)); + context.Add(profiler); + // construct a detector instance - mmdeploy::RotatedDetector detector(mmdeploy::Model{ARGS_model}, mmdeploy::Device{FLAGS_device}); + mmdeploy::RotatedDetector detector(mmdeploy::Model{ARGS_model}, context); // apply the detector, the result is an array-like class holding references to // `mmdeploy_rotated_detection_t`, will be released automatically on destruction diff --git a/demo/csrc/cpp/segmentor.cxx b/demo/csrc/cpp/segmentor.cxx index 55ba41db67..a2aca27bca 100644 --- a/demo/csrc/cpp/segmentor.cxx +++ b/demo/csrc/cpp/segmentor.cxx @@ -27,7 +27,11 @@ int main(int argc, char* argv[]) { return -1; } - mmdeploy::Segmentor segmentor{mmdeploy::Model{ARGS_model}, mmdeploy::Device{FLAGS_device}}; + mmdeploy::Profiler profiler("/tmp/profile.bin"); + mmdeploy::Context context; + context.Add(mmdeploy::Device(FLAGS_device)); + context.Add(profiler); + mmdeploy::Segmentor segmentor{mmdeploy::Model{ARGS_model}, context}; // apply the detector, the result is an array-like class holding a reference to // `mmdeploy_segmentation_t`, will be released automatically on destruction