pansen
2019-04-09 a69649804af1cdef936258aab4a5f719cdb32154
添加vpt封装
5个文件已添加
1个文件已修改
785 ■■■■■ 已修改文件
QiaoJiaSystem/CMakeLists.txt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VptServer/CMakeLists.txt 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VptServer/VptDetectWrapper.cpp 174 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VptServer/VptDetectWrapper.h 180 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VptServer/main.cpp 201 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/VptServer/mainAssist.h 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/CMakeLists.txt
@@ -36,4 +36,4 @@
add_subdirectory(VideoToImageMulth)
#add_subdirectory(GB28181DecoderModel)
#add_subdirectory(FaceSearchDbWithImg)
add_subdirectory(VptServer)
QiaoJiaSystem/VptServer/CMakeLists.txt
New file
@@ -0,0 +1,103 @@
cmake_minimum_required(VERSION 3.5)
STRING(REGEX REPLACE ".*/(.*)" "\\1" CURRENT_FOLDER ${CMAKE_CURRENT_SOURCE_DIR})
project(${CURRENT_FOLDER})
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE debug)
add_compile_options(-fPIC)
#add_definitions(-DGLOG)
#add_definitions(-DTestCode)
add_definitions(-DDEBUG_ERR -DDEBUG_INFO -fpermissive)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../build)
# packages
#find_package(CUDA)
#include_directories ("${PROJECT_SOURCE_DIR}")
# nvcc flags
#set(CUDA_NVCC_FLAGS -O3;-G;-g)
#set(CUDA_NVCC_FLAGS -gencode arch=compute_20,code=sm_20;-G;-g)
#set(CUDA_NVCC_FLAGS -gencode arch=compute_52,code=sm_52;-G;-g)
#file(GLOB_RECURSE CURRENT_HEADERS *.h *.hpp *.cuh)
#file(GLOB CURRENT_SOURCES *.cpp *.cu)
#source_group("Include" FILES ${CURRENT_HEADERS})
#source_group("Source" FILES ${CURRENT_SOURCES})
#cuda_add_executable(${PROJECT_NAME} ${CURRENT_HEADERS} ${CURRENT_SOURCES})
#cuda_add_library(${PROJECT_NAME} SHARED ${CURRENT_HEADERS} ${CURRENT_SOURCES})
#cuda_add_library(${PROJECT_NAME} STATIC ${CURRENT_HEADERS} ${CURRENT_SOURCES})
SET(SOURCES
    VptDetectWrapper.cpp
    #    GlobalSignalWaitLock.hpp
    )
SET(LIBS
    avformat
    avcodec
    swresample
    swscale
    avutil
    bz2 dl z
    opencv_world
    cuda
    cudnn
    human_car_parsing
    human_parsing
    utools
    vehicle_color
    vehicle_plate_dr
    vehicle_recognition
    vpt_det
    vpt_pic
    glog
    pthread
    )
include_directories(
    ../../../BasicPlatForm/libs/Vpts/include
    #glog
    ../../../BasicPlatForm/libs/glog/include
    ../../../BasicPlatForm/libs/opencv/include
    ../../../BasicPlatForm/libs/ffmpeg/include
    ../../../BasicPlatForm/basic/util/opencv/
    ../../../BasicPlatForm/basic/debug/
    ../../../BasicPlatForm/
    ../../../BasicPlatForm/basic/pipe_element/ffmpeg/
    /usr/include/x86_64-linux-gnu/qt5
)
link_directories(
    ../../../BasicPlatForm/libs/Vpts/lib
    #glog
    /usr/local/lib/
    /usr/local/cuda/lib64/
    #glog
    ../../../BasicPlatForm/libs/glog/lib
    ../../../BasicPlatForm/libs/opencv/lib
    ../../../BasicPlatForm/libs/ffmpeg/lib
)
add_executable(${PROJECT_NAME}
    #    testmain.cpp
    main.cpp
    ${SOURCES}
    )
target_link_libraries(${PROJECT_NAME}
    ${LIBS}
    )
QiaoJiaSystem/VptServer/VptDetectWrapper.cpp
New file
@@ -0,0 +1,174 @@
//
// Created by ps on 19-4-9.
//
#include <basic/debug/Debug.h>
#include "VptDetectWrapper.h"
VptDetectWrapper::VptDetectWrapper() {
    init();
}
VptDetectWrapper::VptDetectWrapper(int _gpuIdx, string _dbFilePath) : m_gpuIdx(_gpuIdx),
                                                                      m_dbFilePath(_dbFilePath) {
    init();
}
VptDetectWrapper::~VptDetectWrapper() {
    vpt_pic_release(&m_handle);
}
void VptDetectWrapper::init() {
    m_param.mode = DEVICE_GPU;
    m_param.gpuid = m_gpuIdx;
    m_param.hp_recg_config = SY_CONFIG_OPEN;
    m_param.hcp_recg_config = SY_CONFIG_OPEN;
    m_param.vehicle_color_config = SY_CONFIG_OPEN;
    m_param.vehicle_recg_config = SY_CONFIG_OPEN;
    m_param.vehicle_pendant_det_recg_config = SY_CONFIG_OPEN;
    m_param.dbPath = const_cast<char *>(m_dbFilePath.data());
    m_param.log = SY_CONFIG_OPEN;
    vpt_pic_init(&m_handle, m_param);
}
void VptDetectWrapper::process_image(cv::Mat &_img) {
    m_results.clear();
    sy_img img;
    img.set_data(_img.cols, _img.rows, _img.channels(), _img.data);
    vptpic_result result;
    result.info = new vptobj_info[MAX_DET_COUNT];
    int ret = vpt_pic_process(m_handle, img, &result);
    int size = result.count;
    for (int i = 0; i < size; i++) {
        char str_i[100];
        int colorIndex = result.info[i].obj_index;
        if (colorIndex < 0 || colorIndex >= 9)continue;
//        sprintf(str_i, "%s:%.2f", type[colorIndex].c_str(), result.info[i].obj_score);
//        rectangle(process_image,
//                  cvPoint(result.info[i].obj_rect.left_ - 5, result.info[i].obj_rect.top_ - 15),
//                  cvPoint(result.info[i].obj_rect.left_ + result.info[i].obj_rect.width_ + 5,
//                          result.info[i].obj_rect.top_ + result.info[i].obj_rect.height_ + 10),
//                  cv::Scalar(color[colorIndex][0], color[colorIndex][1], color[colorIndex][2]), 3, 1);
//
//        cv::putText(process_image, str_i,
//                    cv::Point(result.info[i].obj_rect.left_, result.info[i].obj_rect.top_),
//                    fontFace, fontScale,
//                    cv::Scalar(color[colorIndex][0], color[colorIndex][1], color[colorIndex][2]), thickness, 8);
        //输出二次属性分析结果
        if (result.info[i].analysis_res != NULL) {
            m_results.emplace_back(std::move(changeAnalysisRes(colorIndex, result.info[i].analysis_res)));
            m_results.back().bskRect.setRect(result.info[i].obj_rect.left_, result.info[i].obj_rect.top_,
                                             result.info[i].obj_rect.width_, result.info[i].obj_rect.height_);
        } else {}
    }
    DBG(m_results.size());
}
VptDetectResults VptDetectWrapper::changeAnalysisRes(int index, void *result) {
    VptDetectResults vptDetectResults;
    vptDetectResults.sdkDetectType = static_cast<SDKDetectType>(index);
//    vptDetectResults.vptDetectRes.carDetectRes;
    switch (vptDetectResults.sdkDetectType) {
        case SDKDetectType::person : {
            hp_res *cur_res = (hp_res *) result;
            memcpy(vptDetectResults.vptDetectRes.personDetectRes.res_objs, cur_res->res_objs,
                   sizeof(classfy_boj_res) * HP_FIR_INDEX_SIZE);
            //test code
            for (int i = 0; i < HP_FIR_INDEX_SIZE; i++) {
                int resIndex = vptDetectResults.vptDetectRes.personDetectRes.res_objs[i].res_index;
                cout << vptDetectResults.vptDetectRes.personDetectRes.res_objs[i].res_prob << "  ";
                cout << HpResStr[i][resIndex] << " " << endl;
            }
            //test code end
        };
            break;
        case SDKDetectType::bike:
        case SDKDetectType::motor : {
            hcp_res *cur_res = (hcp_res *) result;
            memcpy(vptDetectResults.vptDetectRes.perRideCarDetectRes.res_objs, cur_res->res_objs,
                   sizeof(classfy_boj_res) * HCP_FIR_INDEX_SIZE);
            for (int i = 0; i < HCP_FIR_INDEX_SIZE; i++) {
                int resIndex = vptDetectResults.vptDetectRes.perRideCarDetectRes.res_objs[i].res_index;
                cout << vptDetectResults.vptDetectRes.perRideCarDetectRes.res_objs[i].res_prob << "  ";
                cout << HpResStr[i][resIndex] << " " << endl;
            }
            cout << endl << endl;
        };
            break;
        case SDKDetectType::car :
        case SDKDetectType::bigbus :
        case SDKDetectType::lorry :
        case SDKDetectType::midibus : {
            vehicle_res *cur_res = (vehicle_res *) result;
            auto &carRes = vptDetectResults.vptDetectRes.carDetectRes;
            // 车颜色
            carRes.colorLabel = static_cast<ColorLabel>(cur_res->vc_res.res_index);
            carRes.colorLabelProb = cur_res->vc_res.res_prob;
            // 车型识别
            if (cur_res->vr_res.vehicle_brand != NULL) {
//                cout << "  车辆品牌 - " << cur_res->vr_res.vehicle_brand << endl;
                carRes.vehicle_brand = std::move(string(cur_res->vr_res.vehicle_brand));
                delete[] cur_res->vr_res.vehicle_brand;
                cur_res->vr_res.vehicle_brand = NULL;
            }
            if (cur_res->vr_res.vehicle_subbrand != NULL) {
//                cout << "  车辆子品牌 - " << cur_res->vr_res.vehicle_subbrand << endl;
                carRes.vehicle_subbrand = std::move(string(cur_res->vr_res.vehicle_subbrand));
                delete[] cur_res->vr_res.vehicle_subbrand;
                cur_res->vr_res.vehicle_subbrand = NULL;
            }
            if (cur_res->vr_res.vehicle_issue_year != NULL) {
//                cout << "  车辆年款 - " << cur_res->vr_res.vehicle_issue_year << endl;
                carRes.vehicle_issue_year = std::move(string(cur_res->vr_res.vehicle_issue_year));
                delete[] cur_res->vr_res.vehicle_issue_year;
                cur_res->vr_res.vehicle_issue_year = NULL;
            }
            if (cur_res->vr_res.vehicle_type != NULL) {
//                cout << "  车辆类型 - " << cur_res->vr_res.vehicle_type << endl;
                carRes.vehicle_type = std::move(string(cur_res->vr_res.vehicle_type));
                delete[] cur_res->vr_res.vehicle_type;
                cur_res->vr_res.vehicle_type = NULL;
            }
            if (cur_res->vr_res.freight_ton != NULL) {
//                cout << "  货车吨级 - " << cur_res->vr_res.freight_ton << endl;
                carRes.freight_ton = std::move(string(cur_res->vr_res.freight_ton));
                delete[] cur_res->vr_res.freight_ton;
                cur_res->vr_res.freight_ton = NULL;
            }
//            cout << " " << cur_res->vr_res.name_score << endl;
            carRes.vehicle_score = cur_res->vr_res.name_score;
            // 车牌
            if (cur_res->vp_res.rect.height_ != 0 && cur_res->vp_res.rect.width_ != 0) {
//                cout << "车牌位置: " << cur_res->vp_res.rect.left_ << " " << cur_res->vp_res.rect.top_ << " "
//                     << cur_res->vp_res.rect.width_ << " " << cur_res->vp_res.rect.height_ << endl;
                carRes.carPlateRect.setRect(cur_res->vp_res.rect.left_, cur_res->vp_res.rect.top_,
                                            cur_res->vp_res.rect.width_, cur_res->vp_res.rect.height_);
                carRes.carPlateRectScore = cur_res->vp_res.detectScore;
                for (int m = 0; m < 7; m++) {
//                    printf("%s", cur_res->vp_res.recg[m].character);
                    carRes.carPlate.append(cur_res->vp_res.recg[m].character);
                }
                carRes.carPlateRectScore = cur_res->vp_res.numScore;
                carRes.carPlatetype = cur_res->vp_res.type;
//                printf(" numScore = %.2f, detectScore = %.2f\n", cur_res->vp_res.numScore, cur_res->vp_res.detectScore);
            }
        };
            break;
    }
    return vptDetectResults;
}
QiaoJiaSystem/VptServer/VptDetectWrapper.h
New file
@@ -0,0 +1,180 @@
//
// Created by ps on 19-4-9.
//
#ifndef QIAOJIASYSTEM_VPTDETECTWRAPPER_H
#define QIAOJIASYSTEM_VPTDETECTWRAPPER_H
#include <libs/Vpts/include/vpt_pic_header.h>
#include <libs/Vpts/include/vpt_pic.h>
#include <opencv2/opencv.hpp>
#include <CvMath.hpp>
#include "mainAssist.h"
//分类结果结构体
//struct ClassfyObjRes {
//    int res_index;      //分类结果
//    float res_prob;     //分类结构体
//};
struct PersonDetectRes {
//    std::string head;
//    std::string head_color;
//    std::string eye;
//    std::string mouth;
//    std::string up;
//    std::string up_color;
//    std::string clothing_text;
//    std::string down;
//    std::string down_color;
//    std::string bao;
//    std::string sex;
//    std::string age;
//    std::string viewpoint;
//    std::string dasan;
//    std::string child;
//    std::string personstate;
    classfy_boj_res res_objs[HP_FIR_INDEX_SIZE];          //分类结果
};
struct PerRideCarDetectRes {
//    std::string hcp_up;
//    std::string hcp_up_color;
//    std::string hcp_down;
//    std::string hcp_down_color;
//    std::string bao;
//    std::string hcp_bag_color;
//    std::string hcp_head;
//    std::string hcp_clothing_text;
//    std::string hcp_sex;
//    std::string hcp_figure;
//    std::string hcp_nationality;
//    std::string hcp_age;
//    std::string hcp_eye;
//    std::string hcp_mouth;
//    std::string hcp_weibo;
//    std::string hcp_carColor;
//    std::string hcp_orient;
//    std::string hcp_drivenum;
//    std::string hcp_dasan;
//    std::string hcp_take;
    classfy_boj_res res_objs[HCP_FIR_INDEX_SIZE];          //分类结果
};
struct CarDetectRes {
    //车型识别结果
    std::string vehicle_brand;              //车辆品牌
    std::string vehicle_subbrand;           //车辆子品牌
    std::string vehicle_issue_year;         //车辆年款
    std::string vehicle_type;               //车辆类型
    std::string freight_ton;                //货车吨级
    float vehicle_score;                    //车型识别置信度
    //车颜色识别结果
    ColorLabel colorLabel;                  //车颜色
    float colorLabelProb;                   //车颜色置信度
    //车牌检测结果
    BskRect carPlateRect;                   //车牌区域
    float carPlateRectScore;                //车牌区域置信度
    std::string carPlate;                   //车牌
    float carPlateScore;                    //车牌置信度
    int carPlatetype;
};
union VPTDetectRes {
    struct TestVPTDetectRes {
        int i;
    };
    VPTDetectRes() : testVPTDetectRes(TestVPTDetectRes()) {
    }
    ~VPTDetectRes() {
    }
    TestVPTDetectRes testVPTDetectRes;
    PersonDetectRes personDetectRes;
    PerRideCarDetectRes perRideCarDetectRes;
    CarDetectRes carDetectRes;
};
enum class SDKDetectType {
    test = -1,
    person = 0,     // PersonDetectRes
    bike,           // PerRideCarDetectRes
    motor,          // PerRideCarDetectRes
    tricycle,       //
    car,            // CarDetectRes
    bigbus,         // CarDetectRes
    lorry,          // CarDetectRes
    tractor,        //
    midibus         // CarDetectRes
};
struct VptDetectResults {
public:
    VptDetectResults() {}
    virtual ~VptDetectResults() {}
    VptDetectResults(const VptDetectResults &src) {
        this->sdkDetectType = src.sdkDetectType;
        this->bskRect = src.bskRect;
        switch (src.sdkDetectType) {
            case SDKDetectType::person :
                this->vptDetectRes.personDetectRes = src.vptDetectRes.personDetectRes;
                break;
            case SDKDetectType::bike:
            case SDKDetectType::motor :
                this->vptDetectRes.perRideCarDetectRes = src.vptDetectRes.perRideCarDetectRes;
                break;
            case SDKDetectType::car :
            case SDKDetectType::bigbus :
            case SDKDetectType::lorry :
            case SDKDetectType::midibus :
                this->vptDetectRes.carDetectRes = src.vptDetectRes.carDetectRes;
                break;
        }
    }
    SDKDetectType sdkDetectType;
    VPTDetectRes vptDetectRes;
    BskRect bskRect;
};
class VptDetectWrapper {
public:
    VptDetectWrapper();
    VptDetectWrapper(int _gpuIdx, string _dbFilePath);
    virtual ~VptDetectWrapper();
    void process_image(cv::Mat &_img);
private:
    void init();
    VptDetectResults changeAnalysisRes(int index, void *result);
private:
    list<VptDetectResults> m_results;
    void *m_handle;
    vptpic_param m_param;
    int m_gpuIdx{0};
    std::string m_dbFilePath{"CarBodyFeature.db"};
};
#endif //QIAOJIASYSTEM_VPTDETECTWRAPPER_H
QiaoJiaSystem/VptServer/main.cpp
New file
@@ -0,0 +1,201 @@
#include "vpt_pic.h"
//#include <highgui.h>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include "sy_common.h"
#include "mainAssist.h"
#ifdef _WIN32
#include<windows.h>
#else
#include <sys/time.h>
#include <basic/util/app/AppUtil.h>
#endif
using namespace std;
void printfAnalysisRes(int index, void *result);
int main(int argc, char **argv) {
    string imgpath;
    if (argc < 2) {
        printf("Parameter number not right.\n");
        return 0;
    } else {
        imgpath = argv[1];
    }
    printf("SDK Version: %s\n", vpt_pic_get_version());
    CvFont font;
    cvInitFont(&font, CV_FONT_HERSHEY_COMPLEX, 1.0, 1.0, 0, 1, 3);
    int fontFace = CV_FONT_HERSHEY_COMPLEX;
    double fontScale = 1;
    int thickness = 2;
    void *handle;
    vptpic_param param;
    param.mode = DEVICE_GPU;
    param.gpuid = 0;
    param.hp_recg_config = SY_CONFIG_OPEN;
    param.hcp_recg_config = SY_CONFIG_OPEN;
    param.vehicle_color_config = SY_CONFIG_OPEN;
    param.vehicle_recg_config = SY_CONFIG_OPEN;
    param.vehicle_pendant_det_recg_config = SY_CONFIG_OPEN;
    param.dbPath = "CarBodyFeature.db";
    param.log = SY_CONFIG_OPEN;
    vpt_pic_init(&handle, param);
    cv::VideoCapture capture;
    capture.open(imgpath);
    cv::Mat process_image;
    capture >> process_image;//读出每一帧的图像
    cv::Mat image;
    while (!process_image.empty()) {
        process_image.copyTo(image);
        sy_img img;
        img.set_data(image.cols, image.rows, image.channels(), image.data);
        vptpic_result result;
        result.info = new vptobj_info[MAX_DET_COUNT];
        int ret = vpt_pic_process(handle, img, &result);
        for (int i = 0; i < result.count; i++) {
            char str_i[100];
            int colorIndex = result.info[i].obj_index;
            if (colorIndex < 0 || colorIndex >= 9)continue;
            sprintf(str_i, "%s:%.2f", type[colorIndex].c_str(), result.info[i].obj_score);
            rectangle(process_image,
                      cvPoint(result.info[i].obj_rect.left_ - 5, result.info[i].obj_rect.top_ - 15),
                      cvPoint(result.info[i].obj_rect.left_ + result.info[i].obj_rect.width_ + 5,
                              result.info[i].obj_rect.top_ + result.info[i].obj_rect.height_ + 10),
                      cv::Scalar(color[colorIndex][0], color[colorIndex][1], color[colorIndex][2]), 3, 1);
            cv::putText(process_image, str_i,
                        cv::Point(result.info[i].obj_rect.left_, result.info[i].obj_rect.top_),
                        fontFace, fontScale,
                        cv::Scalar(color[colorIndex][0], color[colorIndex][1], color[colorIndex][2]), thickness, 8);
            //输出二次属性分析结果
            printfAnalysisRes(colorIndex, result.info[i].analysis_res);
        }
#ifdef _MSC_VER
        cv::imshow("res", image);
        cv::waitKey(0);
#else
        char svpath[1024];
        memset(svpath, 0, sizeof(svpath));
        std::string strNewTime2 = AppUtil::getTimeUSecString();
        strNewTime2.append(".jpg");
        sprintf(svpath, "vpt_res/%s", strNewTime2.c_str());
        imwrite(svpath, process_image);
#endif
        //release source
        if (result.info != NULL) {
            for (int i = 0; i < MAX_DET_COUNT; i++) {
                if (result.info[i].analysis_res != NULL) {
                    delete result.info[i].analysis_res;
                    result.info[i].analysis_res = NULL;
                }
            }
            delete[] result.info;
            result.info = NULL;
        }
        capture >> process_image;//读出每一帧的图像
    }
    vpt_pic_release(&handle);
    return 0;
}
void printfAnalysisRes(int index, void *result) {
    if (index == 0 && result != NULL)    //行人二次属性分析结果
    {
        hp_res *cur_res = (hp_res *) result;
        for (int i = 0; i < HP_FIR_INDEX_SIZE; i++) {
            int resIndex = cur_res->res_objs[i].res_index;
            cur_res->res_objs[i].res_prob;
            cout << HpResStr[i][resIndex] << " " << endl;
        }
        cout << endl << endl;
    } else if ((index == 1 || index == 2) && result != NULL)    //行人二次属性分析结果
    {
        hcp_res *cur_res = (hcp_res *) result;
        for (int i = 0; i < HCP_FIR_INDEX_SIZE; i++) {
            int resIndex = cur_res->res_objs[i].res_index;
            cur_res->res_objs[i].res_prob;
//            cout << HcpResStr[i][resIndex] << " " << endl;
        }
        cout << endl << endl;
    } else if (index > 3 && index != 7 && result != NULL)    //车辆二次属性分析结果输出
    {
        vehicle_res *cur_res = (vehicle_res *) result;
        cout << "车颜色: " << colorLabel[cur_res->vc_res.res_index] << " " << cur_res->vc_res.res_prob << endl;
        cout << "车型识别: " << endl;
        if (cur_res->vr_res.vehicle_brand != NULL) {
            cout << "  车辆品牌 - " << cur_res->vr_res.vehicle_brand << endl;
            delete[] cur_res->vr_res.vehicle_brand;
            cur_res->vr_res.vehicle_brand = NULL;
        }
        if (cur_res->vr_res.vehicle_subbrand != NULL) {
            cout << "  车辆子品牌 - " << cur_res->vr_res.vehicle_subbrand << endl;
            delete[] cur_res->vr_res.vehicle_subbrand;
            cur_res->vr_res.vehicle_subbrand = NULL;
        }
        if (cur_res->vr_res.vehicle_issue_year != NULL) {
            cout << "  车辆年款 - " << cur_res->vr_res.vehicle_issue_year << endl;
            delete[] cur_res->vr_res.vehicle_issue_year;
            cur_res->vr_res.vehicle_issue_year = NULL;
        }
        if (cur_res->vr_res.vehicle_type != NULL) {
            cout << "  车辆类型 - " << cur_res->vr_res.vehicle_type << endl;
            delete[] cur_res->vr_res.vehicle_type;
            cur_res->vr_res.vehicle_type = NULL;
        }
        if (cur_res->vr_res.freight_ton != NULL) {
            cout << "  货车吨级 - " << cur_res->vr_res.freight_ton << endl;
            delete[] cur_res->vr_res.freight_ton;
            cur_res->vr_res.freight_ton = NULL;
        }
        cout << " " << cur_res->vr_res.name_score << endl;
        if (cur_res->vp_res.rect.height_ != 0 && cur_res->vp_res.rect.width_ != 0) {
            cout << "车牌位置: " << cur_res->vp_res.rect.left_ << " " << cur_res->vp_res.rect.top_ << " "
                 << cur_res->vp_res.rect.width_ << " " << cur_res->vp_res.rect.height_ << endl;
            for (int m = 0; m < 7; m++) {
                printf("%s", cur_res->vp_res.recg[m].character);
            }
            printf(" numScore = %.2f, detectScore = %.2f\n", cur_res->vp_res.numScore, cur_res->vp_res.detectScore);
        }
        cout << endl;
    }
}
QiaoJiaSystem/VptServer/mainAssist.h
New file
@@ -0,0 +1,125 @@
#include <string>
#ifndef QIAOJIASYSTEM_MAINASSIST_H
#define QIAOJIASYSTEM_MAINASSIST_H
using namespace std;
//行人二次属性分析结果
static string head[5] = {"长发", "短发", "光头", "帽子", "其他"};
static string head_color[9] = {"黑", "白", "灰", "红", "蓝", "黄", "绿", "多色", "其他"};
static string eye[2] = {"未戴眼镜", "戴眼镜"};
static string mouth[2] = {"未戴口罩", "戴口罩"};
static string up[9] = {"T恤", "衬衫", "毛衣", "羽绒服", "大衣", "外套", "连衣裙", "无上衣", "其他"};
static string up_color[9] = {"黑", "白", "灰", "红", "蓝", "黄", "绿", "多色", "其他"};
static string clothing_text[5] = {"纯色", "碎花", "条纹", "格子", "其他"};
static string down[6] = {"长裤", "短裤", "长裙", "短裙", "连衣裙", "其他"};
static string down_color[9] = {"黑", "白", "灰", "红", "蓝", "黄", "绿", "多色", "其他"};
static string bao[5] = {"无包", "单肩包", "背包/双肩包", "手提包/手提物", "拉杆箱/小推车"};
static string sex[3] = {"男", "女", "其他"};
static string age[5] = {"小孩", "青年", "中年", "老年", "其他"};
static string viewpoint[3] = {"正面", "背面", "侧面"};
static string dasan[2] = {"未打伞", "打伞"};
static string child[2] = {"未抱小孩", "抱小孩"};
static string personstate[5] = {"行走", "奔跑", "蹲坐", "推车", "其他"};
static string HpResStr[16][9] = {
    {"长发",   "短发",  "光头",     "帽子",      "其他"},
    {"黑",    "白",   "灰",      "红",       "蓝",   "黄",  "绿",   "多色",  "其他"},
    {"未戴眼镜", "戴眼镜"},
    {"未戴口罩", "戴口罩"},
    {"T恤",   "衬衫",  "毛衣",     "羽绒服",     "大衣",  "外套", "连衣裙", "无上衣", "其他"},
    {"黑",    "白",   "灰",      "红",       "蓝",   "黄",  "绿",   "多色",  "其他"},
    {"纯色",   "碎花",  "条纹",     "格子",      "其他"},
    {"长裤",   "短裤",  "长裙",     "短裙",      "连衣裙", "其他"},
    {"黑",    "白",   "灰",      "红",       "蓝",   "黄",  "绿",   "多色",  "其他"},
    {"无包",   "单肩包", "背包/双肩包", "手提包/手提物", "拉杆箱/小推车"},
    {"男",    "女",   "其他"},
    {"小孩",   "青年",  "中年",     "老年",      "其他"},
    {"正面",   "背面",  "侧面"},
    {"未打伞",  "打伞"},
    {"未抱小孩", "抱小孩"},
    {"行走",   "奔跑",  "蹲坐",     "推车",      "其他"}
};
//人骑车二次属性分析结果
static string hcp_up[12] = {"T恤", "马甲/吊带/背心", "衬衫", "西服", "毛衣", "皮衣/夹克", "羽绒服", "大衣/风衣", "外套", "连衣裙", "无上衣", "其他"};
static string hcp_up_color[12] = {"黑", "白", "红", "黄", "蓝", "绿", "紫", "棕", "灰", "橙", "多色", "其他"};
static string hcp_down[6] = {"长裤", "短裤", "长裙", "短裙", "连衣裙", "其他"};
static string hcp_down_color[12] = {"黑", "白", "红", "黄", "蓝", "绿", "紫", "棕", "灰", "橙", "多色", "其他"};
static string hcp_bao[5] = {"无包", "单肩包", "双肩包", "其他", "钱包"};
static string hcp_bag_color[12] = {"黑", "白", "红", "黄", "蓝", "绿", "紫", "棕", "灰", "橙", "多色", "其他"};
static string hcp_head[6] = {"长发", "短发", "光头", "帽子", "头盔", "其他"};
static string hcp_clothing_text[5] = {"纯色", "碎花", "条纹", "格子", "其他"};
static string hcp_sex[3] = {"男", "女", "不明"};
static string hcp_figure[3] = {"胖", "瘦", "中"};
static string hcp_nationality[5] = {"汉族", "维族", "黑人", "白人", "其他"};
static string hcp_age[6] = {"幼儿", "儿童", "青年", "中年", "老年", "不明"};
static string hcp_eye[4] = {"正常眼睛", "眼镜", "墨镜", "其他"};
static string hcp_mouth[3] = {"正常嘴", "戴口罩", "其他"};
static string hcp_weibo[3] = {"无围巾", "普通围巾", "包头围巾"};
static string hcp_carColor[13] = {"黑", "白", "红", "黄", "蓝", "绿", "紫", "棕", "灰", "橙", "多色", "其他", "银"};
static string hcp_orient[3] = {"正面", "背面", "侧面"};
static string hcp_drivenum[4] = {"0人", "1人", "2人", "更多人"};
static string hcp_dasan[2] = {"无", "有"};
static string hcp_take[2] = {"无", "物品"};
static string HcpResStr[20][13] = {
    {"T恤",   "马甲/吊带/背心", "衬衫",  "西服", "毛衣",  "皮衣/夹克", "羽绒服", "大衣/风衣", "外套", "连衣裙", "无上衣", "其他"},
    {"黑",    "白",        "红",   "黄",  "蓝",   "绿",     "紫",   "棕",     "灰",  "橙",   "多色",  "其他"},
    {"长裤",   "短裤",       "长裙",  "短裙", "连衣裙", "其他"},
    {"黑",    "白",        "红",   "黄",  "蓝",   "绿",     "紫",   "棕",     "灰",  "橙",   "多色",  "其他"},
    {"无包",   "单肩包",      "双肩包", "其他", "钱包"},
    {"黑",    "白",        "红",   "黄",  "蓝",   "绿",     "紫",   "棕",     "灰",  "橙",   "多色",  "其他"},
    {"长发",   "短发",       "光头",  "帽子", "头盔",  "其他"},
    {"纯色",   "碎花",       "条纹",  "格子", "其他"},
    {"男",    "女",        "不明"},
    {"胖",    "瘦",        "中"},
    {"汉族",   "维族",       "黑人",  "白人", "其他"},
    {"幼儿",   "儿童",       "青年",  "中年", "老年",  "不明"},
    {"正常眼睛", "眼镜",       "墨镜",  "其他"},
    {"正常嘴",  "戴口罩",      "其他"},
    {"无围巾",  "普通围巾",     "包头围巾"},
    {"黑",    "白",        "红",   "黄",  "蓝",   "绿",     "紫",   "棕",     "灰",  "橙",   "多色",  "其他", "银"},
    {"正面",   "背面",       "侧面"},
    {"0人",   "1人",       "2人",  "更多人"},
    {"无",    "有"},
    {"无",    "物品"},
};
//车辆二次属性分析结果
static char colorLabel[14][8] = {"棕", "橙", "灰", "白", "粉", "紫", "红", "绿", "蓝", "金", "银", "青", "黄", "黑"};
enum class ColorLabel {
    Brown = 0,
    Orange,
    Gray,
    White,
    Powder,
    Purple,
    Red,
    Green,
    Blue,
    Gold,
    Silver,
    BlueGreen,
    Yellow,
    black
};
static const int detectType = 9;
static std::string type[detectType] = {"person", "bike", "motor", "tricycle", "car", "bigbus", "lorry", "tractor",
                                       "midibus"};
static int color[detectType][3] = {{41,  244, 222},
                                   {255, 128, 0},
                                   {100, 13,  244},
                                   {255, 215, 0},
                                   {18,  220, 87},
                                   {0,   128, 0},
                                   {0,   128, 255},
                                   {255, 0,   0},
                                   {91,  46,  0}};
#endif //QIAOJIASYSTEM_MAINASSIST_H