VehicleRecognition.cpp
1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include "vehicle_recognition.h"
#include <iostream>
#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 = 0;
params.mode = DEVICE_GPU;
params.engine = ENGINE_TENSORRT;
params.max_batch = 20;
params.vehicle_brand_serialize_file = "./serialize_file/VEHICLE_BRAND";
params.vr5905cls_serialize_file = "./serialize_file/VR5905CLS";
params.vehicle_type_serialize_file = "./serialize_file/VEHICLE_TYPE";
params.auth_license = "sy_va_sub_sdk_2023";
int ret = vr_init(&handle, params);
if (ret != 0)
{
cout << "VR Init Failed!" << endl;
return FAILED;
}
return SUCCESS;
}
int VehicleRecognition_Process(void * handle, sy_img * batch_img, int batchsize, vehicle_recog_result *&vrresult)
{
for (int i = 0; i < batchsize; i++)
{
if (batch_img[i].data_ == NULL)
cout << i << " data null" << endl;
}
vr_batch(handle, batch_img, batchsize, vrresult);
return SUCCESS;
}
int VehicleRecognition_Release(void *& handle)
{
if (handle)
vr_release(&handle);
return SUCCESS;
}