|
@ -292,13 +292,13 @@ public class KafkaProcessImpl implements KafkaProcess {
|
292
|
292
|
*/
|
293
|
293
|
private AiIdenLogDto aiHelmetDetect(AiIdenLogDto aiIdenLogDto, String aifilePath) {
|
294
|
294
|
try {
|
295
|
|
log.info("开始AI处理...");
|
|
295
|
log.info("开始AI帽子识别处理...");
|
296
|
296
|
// 安全帽识别
|
297
|
297
|
String aiResponseData = ebcAiService.helmetDetect(ImageBase64Converter.convertFileToBase64(aifilePath),
|
298
|
298
|
Strings.EMPTY, Strings.EMPTY);
|
299
|
299
|
// String aiResponseData = ebcAiService.helmetDetect(ImageBase64Converter.convertInputStreamToBase64(multipartFile.getInputStream()), Strings.EMPTY, Strings.EMPTY);
|
300
|
300
|
JSONObject jsonObject = JSONObject.parseObject(aiResponseData);// JSONUtil.formatJsonStr(aiResponseData);
|
301
|
|
System.out.println("AI 识别结果: " + jsonObject);
|
|
301
|
System.out.println("AI帽子识别结果: " + jsonObject);
|
302
|
302
|
IdenResultDto idenResultDto = null;
|
303
|
303
|
List<IdenResultDto> idenResultDtoList = null;
|
304
|
304
|
if (jsonObject.getString("Status").equals("Ok")) {
|
|
@ -343,7 +343,7 @@ public class KafkaProcessImpl implements KafkaProcess {
|
343
|
343
|
// AI模型
|
344
|
344
|
// aiIdenLogDto.setAiIdenModel(MonitorManageConsts.AI_MODEL_CLOTHING_CODE);
|
345
|
345
|
} catch (Exception e) {
|
346
|
|
log.error("AI处理异常");
|
|
346
|
log.error("AI处理异常,帽子识别");
|
347
|
347
|
}
|
348
|
348
|
return aiIdenLogDto;
|
349
|
349
|
}
|
|
@ -385,7 +385,7 @@ public class KafkaProcessImpl implements KafkaProcess {
|
385
|
385
|
log.info("AI人数识别结果:没有人");
|
386
|
386
|
}
|
387
|
387
|
} catch (Exception e) {
|
388
|
|
log.error("AI处理异常");
|
|
388
|
log.error("AI处理异常,人数识别");
|
389
|
389
|
}
|
390
|
390
|
return isHuman;
|
391
|
391
|
}
|
|
@ -424,7 +424,7 @@ public class KafkaProcessImpl implements KafkaProcess {
|
424
|
424
|
return aiIdenLogDto;
|
425
|
425
|
}
|
426
|
426
|
} catch (Exception e) {
|
427
|
|
log.error("AI处理异常");
|
|
427
|
log.error("AI处理异常,人脸识别");
|
428
|
428
|
}
|
429
|
429
|
return aiIdenLogDto;
|
430
|
430
|
}
|
|
@ -465,17 +465,17 @@ public class KafkaProcessImpl implements KafkaProcess {
|
465
|
465
|
aiIdenLogDto.setIdenResultType(MonitorManageConsts.AI_IDENTIFY_RESULT);
|
466
|
466
|
}
|
467
|
467
|
}
|
468
|
|
log.info("识别成功,推送KAFKA消息");
|
|
468
|
log.info("吸烟识别成功,推送KAFKA消息");
|
469
|
469
|
processKafka(aiIdenLogDto.getTopic(), JSONObject.toJSONString(aiIdenLogDto));
|
470
|
470
|
log.info("消息推送完成");
|
471
|
471
|
}else{
|
472
|
472
|
log.info("没有识别到吸烟者,不推送KAFKA消息");
|
473
|
473
|
}
|
474
|
474
|
}else{
|
475
|
|
log.error("识别异常返回");
|
|
475
|
log.error("吸烟识别识别异常");
|
476
|
476
|
}
|
477
|
477
|
}catch(Exception e){
|
478
|
|
log.error("AI处理异常");
|
|
478
|
log.error("AI处理异常,吸烟识别");
|
479
|
479
|
}
|
480
|
480
|
return aiIdenLogDto;
|
481
|
481
|
}
|
|
@ -489,7 +489,7 @@ private AiIdenLogDto workClothesDetect(AiIdenLogDto aiIdenLogDto, String aifileP
|
489
|
489
|
//工作服识别
|
490
|
490
|
String aiResponseData=ebcAiService.workClothesDetect(ImageBase64Converter.convertFileToBase64(aifilePath),true,true,0.9f);
|
491
|
491
|
JSONObject jsonObject = JSONObject.parseObject(aiResponseData);
|
492
|
|
System.out.print("AI识别结果:"+aiResponseData);
|
|
492
|
System.out.print("AI工作服识别结果:"+aiResponseData);
|
493
|
493
|
IdenResultDto idenResultDto = null;
|
494
|
494
|
List<IdenResultDto> idenResultDtoList = null;
|
495
|
495
|
if(jsonObject.getString("Status").equals("Ok")){
|
|
@ -521,18 +521,18 @@ private AiIdenLogDto workClothesDetect(AiIdenLogDto aiIdenLogDto, String aifileP
|
521
|
521
|
log.info("识别到工作服,工作服类型为:"+aiClassName);
|
522
|
522
|
}
|
523
|
523
|
}
|
524
|
|
log.info("识别成功,推送KAFKA消息");
|
|
524
|
log.info("工作服识别成功,推送KAFKA消息");
|
525
|
525
|
processKafka(aiIdenLogDto.getTopic(), JSONObject.toJSONString(aiIdenLogDto));
|
526
|
526
|
log.info("消息推送完成");
|
527
|
527
|
}else {
|
528
|
528
|
log.info("没有识别到人,不推送KAFKA消息");
|
529
|
529
|
}
|
530
|
530
|
}else if(jsonObject.getString("Status").equals("ERROR")){
|
531
|
|
log.error("异常信息为:"+jsonObject.getString("Des"));
|
|
531
|
log.error("工作服识别异常:"+jsonObject.getString("Des"));
|
532
|
532
|
}
|
533
|
533
|
|
534
|
534
|
}catch(Exception e){
|
535
|
|
log.error("AI处理异常");
|
|
535
|
log.error("AI处理异常,工作服识别");
|
536
|
536
|
}
|
537
|
537
|
return aiIdenLogDto;
|
538
|
538
|
}
|
|
@ -546,7 +546,7 @@ private AiIdenLogDto instrumentDetect(AiIdenLogDto aiIdenLogDto, String aifilePa
|
546
|
546
|
//仪表识别
|
547
|
547
|
String aiResponseData=ebcAiService.instrumentDetect(ImageBase64Converter.convertFileToBase64(aifilePath),Strings.EMPTY,Strings.EMPTY,Strings.EMPTY);
|
548
|
548
|
JSONObject jsonObject = JSONObject.parseObject(aiResponseData);
|
549
|
|
System.out.print("AI识别结果:"+aiResponseData);
|
|
549
|
System.out.print("AI仪表识别结果:"+aiResponseData);
|
550
|
550
|
JSONObject jsonObjectpredictions=jsonObject.getJSONObject("predictions");
|
551
|
551
|
if(jsonObjectpredictions.getString("Errors").isEmpty()){
|
552
|
552
|
if(jsonObjectpredictions.getInteger("Nums")>0){
|
|
@ -555,7 +555,7 @@ private AiIdenLogDto instrumentDetect(AiIdenLogDto aiIdenLogDto, String aifilePa
|
555
|
555
|
aiIdenLogDto.setRelateEmployeeRoleId(MonitorManageConsts.alarmEmployeeRoleId);
|
556
|
556
|
log.info("返回的仪表信息为:"+jsonObjectpredictions.getString("Items"));
|
557
|
557
|
aiIdenLogDto.setIdenResult(jsonObjectpredictions.getString("Items"));
|
558
|
|
log.info("识别成功,推送KAFKA消息");
|
|
558
|
log.info("仪表识别成功,推送KAFKA消息");
|
559
|
559
|
processKafka(aiIdenLogDto.getTopic(), JSONObject.toJSONString(aiIdenLogDto));
|
560
|
560
|
log.info("消息推送完成");
|
561
|
561
|
}else{
|
|
@ -565,7 +565,7 @@ private AiIdenLogDto instrumentDetect(AiIdenLogDto aiIdenLogDto, String aifilePa
|
565
|
565
|
log.info("异常返回,异常原因为:"+jsonObjectpredictions.getString("Errors"));
|
566
|
566
|
}
|
567
|
567
|
}catch(Exception e){
|
568
|
|
log.error("AI处理异常");
|
|
568
|
log.error("AI处理异常,仪表识别");
|
569
|
569
|
}
|
570
|
570
|
return aiIdenLogDto;
|
571
|
571
|
}
|