mirror of
https://github.com/open-mmlab/mmdeploy.git
synced 2025-01-14 08:09:43 +08:00
* fix pose demo and windows build (#307) * init * Update nms_rotated.cpp * add postprocessing_masks gpu version (#276) * add postprocessing_masks gpu version * default device cpu * pre-commit fix Co-authored-by: hadoop-basecv <hadoop-basecv@set-gh-basecv-serving-classify11.mt> * fixed a bug causes text-recognizer to fail when (non-NULL) empty bboxes list is passed (#310) * [Fix] include missing <type_traits> for formatter.h (#313) * fix formatter * relax GCC version requirement * fix * fix lint * fix lint * [Fix] MMEditing cannot save results when testing (#336) * fix show * lint * remove redundant codes * resolve comment * type hint * docs(build): fix typo (#352) * docs(build): add missing build option * docs(build): add onnx install * style(doc): trim whitespace * docs(build): revert install onnx * docs(build): add ncnn LD_LIBRARY_PATH * docs(build): fix path error * fix openvino export tmp model, add binary flag (#353) * init circleci (#348) * fix wrong input mat type (#362) * fix wrong input mat type * fix lint * fix(docs): remove redundant doc tree (#360) * fix missing ncnn_DIR & InferenceEngine_DIR (#364) * update doc Co-authored-by: Chen Xin <xinchen.tju@gmail.com> Co-authored-by: Shengxi Li <982783556@qq.com> Co-authored-by: hadoop-basecv <hadoop-basecv@set-gh-basecv-serving-classify11.mt> Co-authored-by: lzhangzz <lzhang329@gmail.com> Co-authored-by: Yifan Zhou <singlezombie@163.com> Co-authored-by: tpoisonooo <khj.application@aliyun.com> Co-authored-by: lvhan028 <lvhan_028@163.com>
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#include <fstream>
|
|
#include <iostream>
|
|
#include <opencv2/imgcodecs.hpp>
|
|
#include <opencv2/imgproc.hpp>
|
|
#include <string>
|
|
|
|
#include "pose_detector.h"
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc != 4) {
|
|
fprintf(stderr, "usage:\n pose_detection device_name model_path image_path\n");
|
|
return 1;
|
|
}
|
|
auto device_name = argv[1];
|
|
auto model_path = argv[2];
|
|
auto image_path = argv[3];
|
|
cv::Mat img = cv::imread(image_path);
|
|
if (!img.data) {
|
|
fprintf(stderr, "failed to load image: %s\n", image_path);
|
|
return 1;
|
|
}
|
|
|
|
mm_handle_t pose_estimator{};
|
|
int status{};
|
|
status = mmdeploy_pose_detector_create_by_path(model_path, device_name, 0, &pose_estimator);
|
|
if (status != MM_SUCCESS) {
|
|
fprintf(stderr, "failed to create pose_estimator, code: %d\n", (int)status);
|
|
return 1;
|
|
}
|
|
|
|
mm_mat_t mat{img.data, img.rows, img.cols, 3, MM_BGR, MM_INT8};
|
|
|
|
mm_pose_detect_t *res{};
|
|
status = mmdeploy_pose_detector_apply(pose_estimator, &mat, 1, &res);
|
|
if (status != MM_SUCCESS) {
|
|
fprintf(stderr, "failed to apply pose estimator, code: %d\n", (int)status);
|
|
return 1;
|
|
}
|
|
|
|
for (int i = 0; i < res->length; i++) {
|
|
cv::circle(img, {(int)res->point[i].x, (int)res->point[i].y}, 1, {0, 255, 0}, 2);
|
|
}
|
|
cv::imwrite("output_pose.png", img);
|
|
|
|
mmdeploy_pose_detector_release_result(res, 1);
|
|
mmdeploy_pose_detector_destroy(pose_estimator);
|
|
|
|
return 0;
|
|
}
|