#include "vehicle_recognition.h" #include #include "sy_errorinfo.h" #include "vehicle_features.h" using namespace std; int VehicleRecognition_Init(void *&handle, char*dbpath, int gpuid, char* auth_license) { vr_param params; params.gpuid = gpuid; params.mode = DEVICE_GPU; params.db_path = dbpath;//"../../db/mvpt.bin"; params.engine = ENGINE_TENSORRT; params.max_batch = 20; params.serialize_file = "./serialize_file/VR"; params.auth_license = auth_license; //#ifdef _MSC_VER // params.dbPath = "../../../../vehicleRecognition_MCaffeTmpBody/db/CarBodyFeature.db"; //#else // params.dbPath = "/home/mliu/project/Project_MultiVPT/Video-Platform/video_structure_20190131/VehicleRecognition_body/db/CarBodyFeature.db"; //#endif int ret = vr_init(&handle, params); if (ret != 0) { cout << "VR Init Failed!" << endl; system("pause"); return FAILED; } return SUCCESS; } int VehicleRecognition_Process(void * handle, sy_img * batch_img, int batchsize, vr_result *&vrresult) { //VR_Result *vr_result = new VR_Result[batchsize]; /*vrresult = new vr_result[batchsize]; for (int i = 0; i < batchsize; i++) { vrresult[i].vehicle_brand = new char[260]; vrresult[i].vehicle_subbrand = new char[260]; vrresult[i].vehicle_issue_year = new char[260]; vrresult[i].vehicle_type = new char[260]; vrresult[i].freight_ton = new char[260]; }*/ for (int i = 0; i < batchsize; i++) { if (batch_img[i].data_ == NULL) cout << i << " data null" << endl; } //cout << "begin vr_batch" << endl; vr_batch(handle, batch_img, batchsize, vrresult); //cout << "end vr_batch" << endl; /* for (int i = 0; i < batchsize; i++) { cout << i << ".ʶ������" << endl; cout << " ʶ�����Ŷ�: " << vr_result[i].name_score << endl; cout << " ����Ʒ�� - " << vr_result[i].vehicleBrand << endl; cout << " ������Ʒ�� - " << vr_result[i].vehicleSubBrand << endl; cout << " ������� - " << vr_result[i].vehicleIssueYear << endl; cout << " �������� - " << vr_result[i].vehicleType << endl; cout << " �����ּ� - " << vr_result[i].freightTon << endl; cout << endl; if (vr_result[i].vehicleBrand != NULL) { delete[] vr_result[i].vehicleBrand; vr_result[i].vehicleBrand = NULL; } if (vr_result[i].vehicleSubBrand != NULL) { delete[] vr_result[i].vehicleSubBrand; vr_result[i].vehicleSubBrand = NULL; } if (vr_result[i].vehicleIssueYear != NULL) { delete[] vr_result[i].vehicleIssueYear; vr_result[i].vehicleIssueYear = NULL; } if (vr_result[i].vehicleType != NULL) { delete[] vr_result[i].vehicleType; vr_result[i].vehicleType = NULL; } if (vr_result[i].freightTon != NULL) { delete[] vr_result[i].freightTon; vr_result[i].freightTon = NULL; } }*/ return SUCCESS; } int VehicleRecognition_Release(void *& handle) { if (handle) vr_release(&handle); return SUCCESS; }