Commit 35632caf by 郭峰

Merge branch 'feature-1007464' into 'release'

人形检测关闭算法

See merge request !23
parents e34d4445 e2bbbbe3
...@@ -599,118 +599,122 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){ ...@@ -599,118 +599,122 @@ void CameraHandle::updateImage(const cv::Mat & frame,qint64 currentTime){
int uniforms=0x00; int uniforms=0x00;
std::map<int,int>resMap; std::map<int,int>resMap;
//穿工服算法 if ((algorithmPermissions & 0x01<<3) != 0) {
if ((algorithmPermissions & 0x01<<2) != 0) { //穿工服算法
uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x02,currentPlates,resMap,sSn,heightReference); if ((algorithmPermissions & 0x01<<2) != 0) {
if(resMap.size()>0x00){ uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x02,currentPlates,resMap,sSn,heightReference);
faSize=resMap.at(0x00); if(resMap.size()>0x00){
uniforms=resMap.at(0x02); faSize=resMap.at(0x00);
uniforms=resMap.at(0x02);
}
}else{
//人形
uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x00,currentPlates,resMap,sSn,heightReference);
if(resMap.size()>0x00){
faSize=resMap.at(0x00);
uniforms=faSize;
}
} }
}else{ if(uniforms==-2 || faSize==-2){
//人形 qInfo() << "没有可用的HumanDetection对象可以调度";
uniforms=algorithmTaskManage.executeFindHuManCar(frame,0x00,currentPlates,resMap,sSn,heightReference); return ;
if(resMap.size()>0x00){
faSize=resMap.at(0x00);
uniforms=faSize;
} }
} QPoint point_info(faSize,uniforms);
if(uniforms==-2 || faSize==-2){ if(isChanged(point_info,faceMapWorker)){
qInfo() << "没有可用的HumanDetection对象可以调度"; if(faceCount.load(std::memory_order_relaxed)%face_frequency==0){
return ; int worker=0x00;
} if ((algorithmPermissions & 0x01<<2) != 0) {
QPoint point_info(faSize,uniforms); worker = (faSize - uniforms > 0) ? (faSize - uniforms) : 0;
if(isChanged(point_info,faceMapWorker)){
if(faceCount.load(std::memory_order_relaxed)%face_frequency==0){
int worker=0x00;
if ((algorithmPermissions & 0x01<<2) != 0) {
worker = (faSize - uniforms > 0) ? (faSize - uniforms) : 0;
}
qInfo()<<"工作人数==>"<<worker;
vides_data::response* resp=httpService.httpPostFacePopulation(imgs,faSize,worker,sSn,currentTime);
if (resp->code!= 0) {
if(resp->msg=="TimeoutError") {
QByteArray num_imgs;
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpPostFacePopulation(num_imgs,faSize,worker,sSn,currentTime);
if (img_resp->code != 0) {
qInfo()<<"不加图片人数变化推送信息推送失败";
}
instace.deleteObj(img_resp);
} }
} qInfo()<<"工作人数==>"<<worker;
vides_data::response* resp=httpService.httpPostFacePopulation(imgs,faSize,worker,sSn,currentTime);
instace.deleteObj(resp);
faceMapWorker.setX(faSize);
faceMapWorker.setY(uniforms);
}
}
if(faSize>0 && (algorithmPermissions & 0x01<<1) != 0){
std::list<vides_data::faceRecognitionResult>faces;
algorithmTaskManage.executeFindDoesItExistEmployee(frame,faces,sSn);
if (faces.size()>0) {
for(auto face:faces){
vides_data::requestFaceReconition faceReconition;
faceReconition.id = face.id;
faceReconition.img = imgs;
faceReconition.sn = sSn;
faceReconition.time = currentTime;
faceReconition.area.top_left_corner_x=face.x;
faceReconition.area.top_left_corner_y=face.y;
faceReconition.area.bottom_right_corner_x= face.x + face.width;
faceReconition.area.bottom_right_corner_y= face.y + face.height;
faceReconition.area.bottom_left_corner_x = face.x;
faceReconition.area.bottom_left_corner_y = face.y + face.height;
faceReconition.area.top_right_corner_x = face.x + face.width;
faceReconition.area.top_right_corner_y = face.y;
httpService.setHttpUrl(httpUrl);
vides_data::response* resp = httpService.httpPostFaceReconition(faceReconition);
mapFaces.insert(std::make_pair( face.id, faceReconition));
if (resp->code!= 0) { if (resp->code!= 0) {
if(resp->msg=="TimeoutError") { if(resp->msg=="TimeoutError") {
faceReconition.img.clear(); QByteArray num_imgs;
httpService.setHttpUrl(httpUrl); httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpPostFaceReconition(faceReconition); vides_data::response* img_resp = httpService.httpPostFacePopulation(num_imgs,faSize,worker,sSn,currentTime);
if (img_resp->code != 0) { if (img_resp->code != 0) {
qInfo()<<"不加图片人脸信息推送失败"; qInfo()<<"不加图片人数变化推送信息推送失败";
qInfo()<<"不加图片识别人code"<<resp->code;
qInfo()<<"不加图片识别人msg"<<resp->msg;
qInfo()<<"不加图片识别人脸信息推送失败"<<face.id;
} }
instace.deleteObj(img_resp); instace.deleteObj(img_resp);
} }
} }
instace.deleteObj(resp); instace.deleteObj(resp);
faceMapWorker.setX(faSize);
faceMapWorker.setY(uniforms);
} }
} }
}
if(faSize>0 && (algorithmPermissions & 0x01<<1) != 0){
if ((algorithmPermissions & 0x01<<2) != 0) { std::list<vides_data::faceRecognitionResult>faces;
if(uniforms>0 ){ algorithmTaskManage.executeFindDoesItExistEmployee(frame,faces,sSn);
//未穿工服的人数 if (faces.size()>0) {
std::list<QString> outUniforms; for(auto face:faces){
faceUniformOverlap(mapFaces,currentPlates,outUniforms); vides_data::requestFaceReconition faceReconition;
for(auto strUniform:outUniforms){ faceReconition.id = face.id;
httpService.setHttpUrl(httpUrl); faceReconition.img = imgs;
vides_data::response* resp=httpService.httpPostUniforms(imgs,strUniform, sSn,currentTime); faceReconition.sn = sSn;
if (resp->code!= 0) { faceReconition.time = currentTime;
if(resp->msg=="TimeoutError") { faceReconition.area.top_left_corner_x=face.x;
QByteArray num_imgs; faceReconition.area.top_left_corner_y=face.y;
httpService.setHttpUrl(httpUrl); faceReconition.area.bottom_right_corner_x= face.x + face.width;
vides_data::response* img_resp=httpService.httpPostUniforms(num_imgs,strUniform, sSn,currentTime); faceReconition.area.bottom_right_corner_y= face.y + face.height;
if (img_resp->code != 0) { faceReconition.area.bottom_left_corner_x = face.x;
qInfo()<<"不加图片推送未穿工服人数失败"; faceReconition.area.bottom_left_corner_y = face.y + face.height;
faceReconition.area.top_right_corner_x = face.x + face.width;
faceReconition.area.top_right_corner_y = face.y;
httpService.setHttpUrl(httpUrl);
vides_data::response* resp = httpService.httpPostFaceReconition(faceReconition);
mapFaces.insert(std::make_pair( face.id, faceReconition));
if (resp->code!= 0) {
if(resp->msg=="TimeoutError") {
faceReconition.img.clear();
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp = httpService.httpPostFaceReconition(faceReconition);
if (img_resp->code != 0) {
qInfo()<<"不加图片人脸信息推送失败";
qInfo()<<"不加图片识别人code"<<resp->code;
qInfo()<<"不加图片识别人msg"<<resp->msg;
qInfo()<<"不加图片识别人脸信息推送失败"<<face.id;
}
instace.deleteObj(img_resp);
} }
instace.deleteObj(img_resp);
} }
instace.deleteObj(resp);
} }
instace.deleteObj(resp);
} }
} }
if ((algorithmPermissions & 0x01<<2) != 0) {
if(uniforms>0 ){
//未穿工服的人数
std::list<QString> outUniforms;
faceUniformOverlap(mapFaces,currentPlates,outUniforms);
for(auto strUniform:outUniforms){
httpService.setHttpUrl(httpUrl);
vides_data::response* resp=httpService.httpPostUniforms(imgs,strUniform, sSn,currentTime);
if (resp->code!= 0) {
if(resp->msg=="TimeoutError") {
QByteArray num_imgs;
httpService.setHttpUrl(httpUrl);
vides_data::response* img_resp=httpService.httpPostUniforms(num_imgs,strUniform, sSn,currentTime);
if (img_resp->code != 0) {
qInfo()<<"不加图片推送未穿工服人数失败";
}
instace.deleteObj(img_resp);
}
}
instace.deleteObj(resp);
}
}
}
}else{
qInfo()<<"人形识别算法关闭,只有车牌算法了";
} }
//关闭车牌识别 //关闭车牌识别
if ((algorithmPermissions & 0x01) == 0) { if ((algorithmPermissions & 0x01) == 0) {
......
...@@ -538,7 +538,10 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber, ...@@ -538,7 +538,10 @@ vides_data::response *HttpService::httpDeviceConfig(const QString &serialNumber,
config.uniformConfig.humanDetectionLen = uniformConfigObj["humanDetectionLen"].toInt(); config.uniformConfig.humanDetectionLen = uniformConfigObj["humanDetectionLen"].toInt();
config.uniformConfig.updateAt = uniformConfigObj["updateAt"].toVariant().toULongLong(); config.uniformConfig.updateAt = uniformConfigObj["updateAt"].toVariant().toULongLong();
config.uniformConfig.carShapeConfidence = uniformConfigObj["carShapeConfidence"].toVariant().toFloat(); config.uniformConfig.carShapeConfidence = uniformConfigObj["carShapeConfidence"].toVariant().toFloat();
//解析 humanConfig
QJsonObject humanConfigObj = dataObj["humanConfig"].toObject();
config.humanConfig.isOn=humanConfigObj["isOn"].toBool();
config.humanConfig.updateAt = humanConfigObj["updateAt"].toVariant().toULongLong();
// 解析 devicesConfig // 解析 devicesConfig
QJsonObject devicesConfigObj = dataObj["camera"].toObject(); QJsonObject devicesConfigObj = dataObj["camera"].toObject();
......
...@@ -279,6 +279,12 @@ struct UniformConfig { ...@@ -279,6 +279,12 @@ struct UniformConfig {
quint64 updateAt; quint64 updateAt;
}; };
struct HumanConfig{
bool isOn;
int humanDetectionLen;
quint64 updateAt;
};
struct MqttConfig { struct MqttConfig {
QString address; QString address;
QString clientId; QString clientId;
...@@ -299,6 +305,8 @@ struct responseConfig { ...@@ -299,6 +305,8 @@ struct responseConfig {
UniformConfig uniformConfig; UniformConfig uniformConfig;
Camera camera; Camera camera;
MqttConfig mqttConfig; MqttConfig mqttConfig;
HumanConfig humanConfig;
}; };
struct responseMqttData{ struct responseMqttData{
......
...@@ -170,7 +170,7 @@ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig,QStr ...@@ -170,7 +170,7 @@ void MainWindow::divParameterUpdate(vides_data::responseConfig &cloudConfig,QStr
cloudConfig.mqttConfig.topic=config.mqttConfig.topic; cloudConfig.mqttConfig.topic=config.mqttConfig.topic;
runOrRebootMqtt(cloudConfig.mqttConfig,httpUrl,serialNumber); runOrRebootMqtt(cloudConfig.mqttConfig,httpUrl,serialNumber);
} }
__uint8_t alg= this->intToUint8t(faceAlgorithm,licensePlateAlgorithm,uniformAlgorithm) ; __uint8_t alg= this->intToUint8t(faceAlgorithm,licensePlateAlgorithm,uniformAlgorithm,false) ;
vides_data::DetectionParams params; vides_data::DetectionParams params;
...@@ -556,7 +556,7 @@ void MainWindow::startCamera(const QString &httpurl){ ...@@ -556,7 +556,7 @@ void MainWindow::startCamera(const QString &httpurl){
reStatus.camera_info_list.push_front(camera_info); reStatus.camera_info_list.push_front(camera_info);
__uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn); __uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn,devConfig.humanConfig.isOn);
offlineCameraHandle->cameraParameterUpdate(devConfig); offlineCameraHandle->cameraParameterUpdate(devConfig);
offlineCameraHandle->initAlgorithmPermissions(new_algorithm); offlineCameraHandle->initAlgorithmPermissions(new_algorithm);
...@@ -961,9 +961,10 @@ void MainWindow::initRecordingToString(QString &recorJson){ ...@@ -961,9 +961,10 @@ void MainWindow::initRecordingToString(QString &recorJson){
recorJson = QString::fromUtf8(jsonDocument.toJson()); recorJson = QString::fromUtf8(jsonDocument.toJson());
} }
__uint8_t MainWindow::intToUint8t(bool faceAlgorithm, bool licensePlateAlgorithm, bool uniformAlgorithm) { __uint8_t MainWindow::intToUint8t(bool faceAlgorithm, bool licensePlateAlgorithm, bool uniformAlgorithm,bool humanAlgorithm) {
__uint8_t result = 0; __uint8_t result = 0;
//人形识别对应最高高位(第3位)
result |=(humanAlgorithm?1:0)<<3;
// 工服识别对应最高位(第2位) // 工服识别对应最高位(第2位)
result |= (uniformAlgorithm ? 1 : 0) << 2; result |= (uniformAlgorithm ? 1 : 0) << 2;
...@@ -1013,7 +1014,7 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data: ...@@ -1013,7 +1014,7 @@ void MainWindow::initCameras(vides_data::cameraParameters &parameter,vides_data:
cameraHandle->findFirmwareVersion(camera_info.firmware_version); cameraHandle->findFirmwareVersion(camera_info.firmware_version);
camera_info_list.push_front(camera_info); camera_info_list.push_front(camera_info);
__uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn); __uint8_t new_algorithm= intToUint8t(devConfig.faceConfig.isOn,devConfig.licensePlateConfig.isOn,devConfig.uniformConfig.isOn,devConfig.humanConfig.isOn);
cameraHandle->initAlgorithmPermissions(new_algorithm); cameraHandle->initAlgorithmPermissions(new_algorithm);
cameraHandle->initParkingSpaceInfo(areas); cameraHandle->initParkingSpaceInfo(areas);
......
...@@ -44,7 +44,7 @@ public: ...@@ -44,7 +44,7 @@ public:
void initCameras(vides_data::cameraParameters &parameter, vides_data::responseConfig &devConfig, const std::list<vides_data::responseArea>&areas,std::list<vides_data::requestCameraInfo>&camera_info_list); void initCameras(vides_data::cameraParameters &parameter, vides_data::responseConfig &devConfig, const std::list<vides_data::responseArea>&areas,std::list<vides_data::requestCameraInfo>&camera_info_list);
__uint8_t intToUint8t(bool faceAlgorithm,bool licensePlateAlgorithm,bool uniformAlgorithm); __uint8_t intToUint8t(bool faceAlgorithm,bool licensePlateAlgorithm,bool uniformAlgorithm,bool humanAlgorithm);
//盒子参数更新 //盒子参数更新
void divParameterUpdate(vides_data::responseConfig &cloudConfig,QString &httpUrl,QString &serialNumber ); void divParameterUpdate(vides_data::responseConfig &cloudConfig,QString &httpUrl,QString &serialNumber );
......
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment