Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion demo/csrc/cpp/classifier.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion demo/csrc/cpp/detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion demo/csrc/cpp/pose_detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
7 changes: 6 additions & 1 deletion demo/csrc/cpp/restorer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion demo/csrc/cpp/rotated_detector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion demo/csrc/cpp/segmentor.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down