#pragma once #include #include #include #include #include "../util/vpc_util.h" #include "../ai_platform/task_param_manager.h" #include "../ai_platform/macro_definition.h" #include "ai_engine_header.h" #include "hs_det_truck.h" #include "vehicle_pose.h" #include "acl/acl.h" #include "acl/ops/acl_dvpp.h" #define MAX_BATCH 16 #define IMAGE_CROP_EXPAND_RATIO 0 #define MAX_OBJ_BOX_COUNT 100 namespace ai_engine_module { namespace truck_manned_process { // typedef long id_t; using id_t = obj_key_t; using task_id_t = std::string; using algor_param_type = algor_config_param_manned_incident*; #define IMG_RES 224 typedef struct input_data_wrap_t { id_t id; long objId; int person_motocycle_cnt; std::string taskId; box_t box; // 记录检测框 box_t vpose_box; // 记录预处理后的检测框 int x_center; // 外扩前的中心点及长边信息 int y_center; float llength; } input_data_wrap_t; typedef struct mn_frame_t { uint m_frame; uint n_frame; // explicit mn_frame_t(uint m = 0, uint n = 0) : m_frame(m) , n_frame(n) {} void reset() { m_frame = 0; n_frame = 0; } } mn_frame_t; typedef struct results_data_t { box_t box; acldvppPicDesc* origin_img_desc{nullptr}; acldvppPicDesc* roi_img_desc{nullptr}; id_t id; long objId; std::string taskId; } results_data_t; class TruckMannedProcess { /** * @brief * 1. move able */ public: TruckMannedProcess(); ~TruckMannedProcess(); bool check_initied(); bool init(int gpu_id, string models_dir); // bool update_mstreams(const std::vector& taskIds, vector vec_det_input_images, const std::vector &det_results); bool update_mstreams(const std::vector& taskIds, vector vec_det_input_images, map &m_total_obj_info, const std::vector &det_results); std::shared_ptr get_result_by_objectid(const id_t& id, bool do_erase = true); void force_release_result(const task_id_t& task_id); TruckMannedProcess(const TruckMannedProcess&) = delete; TruckMannedProcess& operator=(const TruckMannedProcess&) = delete; private: static algorithm_type_t algor_type_; int m_devId; aclrtContext m_algorthim_ctx; bool init_; void* hs_tools_; void* vpose_tools_; task_param_manager* task_param_manager_; std::map id_to_mn_; std::map id_to_result_; }; } // namespace truck_manned_process } // namespace ai_engine_module