总流程

1、告警是实时告警

√1 车辆驶入检测 –车wei和车头两个摄像头判断,前后四个点位各一个摄像头 车头和车尾独立模型,车中按照点位相似度独立模型 √ 2车辆停放位置检测 —位置判断,ROI判断,ROI跟点位一一对应 √ 3车前挡车牌检测 — 车停止多长时间没放置挡车牌告警(时间可配) × 装卸前阀门检查动作检测 –(待确认-阀门检查动作最好附图,告警有没有条件) √ 4安全监护人员在岗检测 –时间段没有出现告警(时间可配) √ 5鹤管管连接状态检测 – 鹤管连接 √ 6安全带检测 –车顶人员和安全带做对比 √ 7车后侧装卸车过程人员安全巡视检测—时间段没有出现告警(时间可配) √ 8人孔盖关闭检测 – 人离开一个时间段未关闭,告警 √ 9鹤管排放动作检测 – 鹤管归为,检测到未排放动作 √ 10鹤管归位检测 – 在鹤管连接前提条件下检测,车走了,未归为,告警 √ 11悬梯归位检测 – 在鹤管连接前提条件下检测,车走了,未归为,告警 √ 12挡车牌归位检测 – 在车牌检测前提条件下检测告警,车走了,未放到指定位置,告警 √ 13车辆离开检测 – 车进入条件下检测

16、泄漏监测 —有泄露就告警

流程

1、车辆驶入检测 2、车辆停放位置检测 3、车前挡车牌检测 4、装卸前阀门检查动作检测 5、鹤管管连接检测 6、人孔盖关闭检测 7、鹤管排放动作检测 8、鹤管归位检测 9、悬梯归位检测 10、挡车牌归位检测 11、车辆离开检测

全程

1、安全监护人员在岗检测 –时间段没有出现告警(时间可配) 2、安全带检测 –车顶人员和安全带做对比 3、车后侧装卸车过程人员安全巡视检测—时间段没有出现告警(时间可配) 4、泄漏监测 —有泄露就告警

后续增加功能

1、总结 2、短视频

车辆停放位置检测 车前挡车牌检测 安全监护人员在岗检测 车后侧装卸车过程人员安全巡视检测 鹤管排放动作检测 鹤管管连接状态检测 鹤管归位检测 悬梯归位检测 安全带检测 人孔盖关闭检测 车辆驶入

46 truck_head 47 baffle 48 guardian_person_duty 49 rear_car_patrol_person 50 pipes_discharge_action 51 connecte_pipes_correct 52 pipes 53 ladder 54 safety_sling 56 manhole_cover_open 59 truck_head

车尾

安全监护人:guardian_person_duty 车后侧巡视人员:rear_car_patrol_person 鹤管排放动作:pipes_discharge_action 鹤管连接正确:connecte_pipes_correct 鹤管:pipes 悬梯:ladder 安全绳:safety_sling 人孔盖关闭:manhole_cover_close 人孔盖开启:manhole_cover_open 人孔盖开启(特殊):ts_manhole_cover_open 人:people 车头:truck_head 挡车牌:baffle

车头,挡车牌,安全监护人,车后侧巡视人员,鹤管排放动作,鹤管连接正确,鹤管,悬梯,安全绳,人孔盖关闭,人孔盖开启,人孔盖开启(特殊),人

truck_head,baffle,guardian_person_duty,rear_car_patrol_person,pipes_discharge_action,connecte_pipes_correct,pipes,ladder,safety_sling,manhole_cover_close,manhole_cover_open,ts_manhole_cover_open,people

return "/Users/jeffrey/Desktop/upload/ffmpeg/coordinate/1758FBE546B45E2F65394D24C96C33D0.jpeg";

baffleRuleCheck_   //挡车牌规则判断用
guardianPersonDutyRuleCheck_	//安全监护人检测动作用
bafflePlaceAlready_	//挡车牌已经放置标识
connectPipesCorrect_ //鹤管连接标识
rearCarPatrolPersonRuleCheck_ //车后巡视人员检测规则用
manholeCoverOpenRuleCheck_ //人孔盖开启标识
  
  
  
safetySlingResultRuleChecking_ //安全绳算法检测判断条件
alarmImagePath_ //安全绳检测告警图片
noAlarmImagePath_ //安全绳检测正常图片



boolean isSpecialHandle = true;
int specialHandleCount = 0;
int specialHandleSeconds = 0;
if (modelIdsList.size() != 2){
    isSpecialHandle = false;
}else {
    List<String> isSpecialHandleRules = Arrays.asList("people", "safety_hook");
    for (PcAiModel pcAiModel : pcAiModels) {
        boolean contains = isSpecialHandleRules.contains(pcAiModel.getLabel());
        if (!contains) {
            isSpecialHandle = false;
            break;
        }
    }
}

if (isSpecialHandle){
    PcAiModel pcAiModel = pcAiModels.stream().filter(o -> "safety_hook".equals(o.getLabel())).findFirst().get();
    Long id = pcAiModel.getId();
    PcMonitoringDeviceModel pcMonitoringDeviceModel = new PcMonitoringDeviceModel();
    pcMonitoringDeviceModel.setAiModelId(id);
    pcMonitoringDeviceModel.setMonitoringDeviceId(callback.getVideoId());
    List<PcMonitoringDeviceModel> pcMonitoringDeviceModels = pcMonitoringDeviceModelService.selectPcMonitoringDeviceModelList(pcMonitoringDeviceModel);
    if (pcMonitoringDeviceModels.isEmpty()){
        isSpecialHandle = false;
    }else {
        PcMonitoringDeviceModel pcMonitoringDeviceModel1 = pcMonitoringDeviceModels.get(0);
        if (pcMonitoringDeviceModel1.getMonitoringStatus()  == 0){
            //开启了过滤检测
            specialHandleCount = Integer.parseInt(pcMonitoringDeviceModel1.getTimeThresholdProportion());
            specialHandleSeconds = Integer.parseInt(pcMonitoringDeviceModel1.getTimeThreshold()) * 60;

        }
    }
}
safety_hook_special_handle
{"taskId": 15, "videoId": "6", "pointId": 0, "imageName": "6_498_2023-11-28-17-22-11", "node": "node_2", "imagePath": "/mnt/data/6/6_498_2023-11-28-17-22-11.jpg", "result": [{"label": "chair", "bbox": [515, 723, 717, 1018], "score": 0.83}, {"label": "chair", "bbox": [201, 839, 442, 1057], "score": 0.701}, {"label": "person", "bbox": [541, 105, 633, 334], "score": 0.697}], "ip": "192.168.1.11", "datetime": "2023-11-28 17:22:11"}

/Users/jeffrey/Desktop/upload/SopFile/2023-11-281729439066870657024.jpg

redisUtil.del("PcPointStepHandle_mark" , callbackResult.getPointId() + "_" + callbackResult.getVideoId());
{
            "category": "rear_car_patrol_person",
            "bbox": [
                400.0,
                400.0,
                1200.0,
                1200.0
            ],
            "score": 0.8769387006759644
        }

安全绳检测 按照时间进行配置 ✅

安全巡视人员 鹤管链接后15分总内出现一次即可 ✅

人孔盖开启之后 放到悬梯归位的时候判断 ✅

鹤管排放动作

String imagePath = callbackResult.getImagePath();
String s = scpDownFile(sftpConfig, imagePath);

基础算法

{
	"taskId": 15,
	"videoId": "6",
	"pointId": 0,
	"imageName": "6_498_2023-11-28-17-22-11",
	"node": "node_2",
	"imagePath": "/mnt/data/6/6_498_2023-11-28-17-22-11.jpg",
	"result": [
		{
			"label": "chair",
			"bbox": [
				515,
				723,
				717,
				1018
			],
			"score": 0.83
		},
		{
			"label": "chair",
			"bbox": [
				201,
				839,
				442,
				1057
			],
			"score": 0.701
		},
		{
			"label": "person",
			"bbox": [
				541,
				105,
				633,
				334
			],
			"score": 0.697
		}
	],
	"ip": "192.168.1.11",
	"datetime": "2023-11-28 17:22:11"
}

md5加密:e10adc3949ba59abbe56e057f20f883e MD5 + salt:b42619cf9e4a1f5dad2aaa8a7a70b31e MD5 + salt + hash:f57cf2d66c506567c49ad04bb58fa566

{
    "imageName": "12_20_12690_2023-11-20-11-25-41",
    "imagePath": "/usr/local/server/aicsp/uploadPath/ffmpeg/1.jpeg",
    "ip": "192.168.1.14",
    "node": "node_1",
    "params": {},
    "pointId": 1,
    "taskId": 14,
    "videoId": 1,
    "time": "@now('yyyy-MM-dd HH:mm:ss')",
    "result": [

       {
            "bbox": [
                1135.0,
                388.0,
                1287.0,
                553.0
            ],
            "label": "truck_head",
            "score": 0.9549359679222107
            // 车辆驶离/驶入
        }

        // {
        //     "bbox": [
        //         1390.0,
        //         476.0,
        //         1410.0,
        //         541.0
        //     ],
        //     "label": "baffle",
        //     "score": 0.3130616843700409
        // },
        //  {
        //     "bbox": [
        //         1500.0,
        //         722.0,
        //         2000.0,
        //         2100.0
        //     ],
        //     "label": "truck_head",
        //     "score": 0.8130616843700409
        //     // 车辆驶离
        // },
        
        // {
        //     "bbox": [
        //         1135.0,
        //         388.0,
        //         1287.0,
        //         553.0
        //     ],
        //     "label": "truck_head",
        //     "score": 0.9549359679222107
        //     // 车辆驶离/驶入
        // },
        
        // {
        //     "bbox": [
        //         689.0,
        //         500.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "pipes_discharge_action",
        //     "score": 0.9549359679222107
        // },
        // {
        //     "bbox": [
        //         689.0,
        //         500.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "guardian_person_duty",
        //     "score": 0.9549359679222107
        //     // 安全监护人在岗
        // },
        // {
        //     "bbox": [
        //         1000.0,
        //         388.0,
        //         1100.0,
        //         400.0
        //     ],
        //     "label": "baffle",
        //     "score": 0.9549359679222107
        // },
        
        // {
        //     "bbox": [
        //         540.0,
        //         318.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "safety_sling",
        //     "score": 0.9549359679222107
        // },
        
        // {
        //     "bbox": [
        //         540.0,
        //         318.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "people",
        //     "score": 0.9549359679222107
        // }
        // ,
        
        // {
        //     "bbox": [
        //         540.0,
        //         318.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "people",
        //     "score": 0.9549359679222107
        // },
        // {
        //     "bbox": [
        //         540.0,
        //         318.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "connecte_pipes_correct",
        //     "score": 0.9549359679222107
        //     // 鹤管链接
        // }
        // ,
        // {
        //     "bbox": [
        //         540.0,
        //         318.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "rear_car_patrol_person",
        //     "score": 0.9549359679222107
        //     // 车后巡视人员
        // }
        // ,
        // {
        //     "bbox": [
        //         700.0,
        //         320.0,
        //         1387.0,
        //         1387.0
        //     ],
        //     "label": "pipes",
        //     "score": 0.9549359679222107  
        //     // 鹤管归位
        // },
        
        // {
        //     "bbox": [
        //         1042.0,
        //         169.0,
        //         1787.0,
        //         1787.0
        //     ],
        //     "label": "ladder",
        //     "score": 0.9549359679222107  
        //     // 悬梯归位
        // },
        
        // {
        //     "bbox": [
        //         720.0,
        //         40.0,
        //         1787.0,
        //         1787.0
        //     ],
        //     "label": "manhole_cover_open",
        //     "score": 0.9549359679222107  
        //     // 悬梯归位
        // }
    ]
}
,
          {
            "bbox": [
                720.0,
                40.0,
                1787.0,
                1787.0
            ],
            "label": "manhole_cover_open",
            "score": 0.9549359679222107  
        }



,
        {
            "bbox": [
                540.0,
                318.0,
                1387.0,
                1387.0
            ],
            "label": "pipes",
            "score": 0.9549359679222107  
        }
[
    [
        {
            "oX":664,
            "oY":30
        },
        {
            "oX":672,
            "oY":1062
        },
        {
            "oX":1172,
            "oY":1062
        },
        {
            "oX":1116,
            "oY":40
        },
        {
            "oX":1116,
            "oY":40
        }
    ],
    [
        {
            "oX":1200,
            "oY":48
        },
        {
            "oX":1238,
            "oY":1060
        },
        {
            "oX":1708,
            "oY":1068
        },
        {
            "oX":1632,
            "oY":54
        },
        {
            "oX":1632,
            "oY":54
        }
    ]
]
[
    [
        {
            "oX":664,
            "oY":30
        },
        {
            "oX":672,
            "oY":1062
        },
        {
            "oX":1172,
            "oY":1062
        },
        {
            "oX":1116,
            "oY":40
        },
        {
            "oX":1116,
            "oY":40
        }
    ],
    [
        {
            "oX":1200,
            "oY":48
        },
        {
            "oX":1238,
            "oY":1060
        },
        {
            "oX":1708,
            "oY":1068
        },
        {
            "oX":1632,
            "oY":54
        },
        {
            "oX":1632,
            "oY":54
        }
    ],
    [
        {
            "oX":562,
            "oY":82
        },
        {
            "oX":576,
            "oY":1026
        },
        {
            "oX":1062,
            "oY":1018
        },
        {
            "oX":998,
            "oY":120
        },
        {
            "oX":998,
            "oY":120
        },
        {
            "oX":998,
            "oY":120
        }
    ],
    [
        {
            "oX":1364,
            "oY":132
        },
        {
            "oX":1398,
            "oY":1006
        },
        {
            "oX":1848,
            "oY":1016
        },
        {
            "oX":1816,
            "oY":104
        },
        {
            "oX":1816,
            "oY":104
        }
    ]
]

[[{“oX”:664,“oY”:30},{“oX”:672,“oY”:1062},{“oX”:1172,“oY”:1062},{“oX”:1116,“oY”:40},{“oX”:1116,“oY”:40}],[{“oX”:1200,“oY”:48},{“oX”:1238,“oY”:1060},{“oX”:1708,“oY”:1068},{“oX”:1632,“oY”:54},{“oX”:1632,“oY”:54}],[{“oX”:562,“oY”:82},{“oX”:576,“oY”:1026},{“oX”:1062,“oY”:1018},{“oX”:998,“oY”:120},{“oX”:998,“oY”:120},{“oX”:998,“oY”:120}],[{“oX”:1364,“oY”:132},{“oX”:1398,“oY”:1006},{“oX”:1848,“oY”:1016},{“oX”:1816,“oY”:104},{“oX”:1816,“oY”:104}]]

[[{“oX”:664,“oY”:30},{“oX”:672,“oY”:1062},{“oX”:1172,“oY”:1062},{“oX”:1116,“oY”:40},{“oX”:1116,“oY”:40}],[{“oX”:1200,“oY”:48},{“oX”:1238,“oY”:1060},{“oX”:1708,“oY”:1068},{“oX”:1632,“oY”:54},{“oX”:1632,“oY”:54}]]

server {
         listen 80;
			  server_name a.caaa.cn;

        include enable-php.conf;

        #charset koi8-r;

        location / {
             root /opt/homebrew/var/www;
            index  index.html index.htm index.php;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        #proxy the PHP scripts to Apache listening on 127.0.0.1:80
        
        location ~ \.php$ {
            proxy_pass   http://127.0.0.1;
        }

        #pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

        location ~ \.php$ {
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            include        fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }




server
{
    listen 80;
    server_name a.caaa.cn;
    index index.php index.html index.htm default.php default.htm default.html;
    root "/opt/homebrew/var/www";

    #PHP-INFO-START
    include enable-php-83.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /Users/jeffrey/Library/PhpWebStudy/server/vhost/rewrite/a.caaa.cn.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log off;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log off;
        access_log /dev/null;
    }
    access_log  /Users/jeffrey/Library/PhpWebStudy/server/vhost/logs/a.caaa.cn.log;
    error_log  /Users/jeffrey/Library/PhpWebStudy/server/vhost/logs/a.caaa.cn.error.log;
}

public void res(){
        String faceUrl = "http://127.0.0.1:10008/image_infer";
        Map<String, Object> params = new HashMap<>();
        params.put("imagePath", frameImgPath);
        params.put("faceDBId", 1);
        String response = HttpUtil.post(faceUrl, JSONObject.toJSONString(params));
        logger.info("**************************人脸识别结果===response:{}", response);
        FaceModelResult faceModelResult = JSON.parseObject(response, FaceModelResult.class);
        logger.info("**************************人脸识别结果===faceModelResult:{}", faceModelResult);
        int code = Math.toIntExact(faceModelResult.getCode());

        if (code == 200) {
            logger.info("**************************人脸识别结果回调成功");
            //人脸识别成功并保存结果
            List<ModelResult> result = new ArrayList<>();
            try {
                result = faceModelResult.getResult();
            }catch (Exception e){
                logger.error("人脸识别结果获取异常:{}",  JSONObject.toJSONString(faceModelResult.getResult()));
            }

            logger.info("**************************人脸识别结果===result:{}", result);
            String face_distinguish_score = configService.selectConfigByKey(URLConstant.FACE_DISTINGUISH_SCORE);//【人脸识别】人体识别过滤阈值
            if (!result.isEmpty()) {
                List<ModelResult> modelResults1 = new ArrayList<>();
                for (ModelResult modelResult : result) {
                    if (modelResult.getFaceId() == -1) {
                        continue;
                    }
                    ModelResult modelResult1 = new ModelResult();
                    modelResult1.setBbox(modelResult.getBbox());
                    modelResults1.add(modelResult1);
                    if (modelResult.getScore() > Double.parseDouble(face_distinguish_score)) {
                        PcFaceRecognitionLibrary faceRecognitionLibrary = pcFaceRecognitionLibraryService.selectPcFaceRecognitionLibraryById(modelResult.getFaceId());
                        remark.append(faceRecognitionLibrary.getUserName()).append(",");
                    }
                }
                ArrayList<Location> locations = aiTaskService.getLocations(modelResults1);
                logger.info("**************************人脸识别结果===locations:{}", JSONObject.toJSONString(locations));
                faceImgPath = aiTaskService.transformImg(locations, frameImgPath, pcMonitoringDevice.getImei(), monitoringDeviceModel, new ArrayList<>());
                logger.info("**************************人脸识别结果===faceImgPath:{}", faceImgPath);
            }
        }

        remarkRes = remark.toString();
        logger.info("**************************人脸识别结果===remarkRes:{}", remarkRes);
        if ("".equals(remarkRes)) {
            remarkRes = "XXXX-XXXXXX";
        }
//                if ("".equals(faceImgPath)) {
        monitoringDeviceResult.setImgUrl(Constants.RESOURCE_PREFIX + faceImgPath.replace(RuoYiConfig.getProfile(), ""));
//                }
        monitoringDeviceResult.setRemark(remarkRes);
    }







@Data
public class FaceModelResult {
    private Long code;
    private String msg;
    public List<ModelResult> result;
}





@Data
public class ModelResult {

    /**
     * 模型标识
     */
    private String category;

    /**
     * 坐标
     */
    private List<Double> bbox;

    /**
     * 得分
     */
    private Double score;

    /**
     * 人脸ID
     */
    private Long faceId;

    public String getCategory() {
        return category;
    }

    public void setCategory(String category) {
        this.category = category;
    }

    public List<Double> getBbox() {
        return bbox;
    }

    public void setBbox(List<Double> bbox) {
        this.bbox = bbox;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }

}
文档更新时间: 2023-12-18 03:25   作者:JeffreyCheung