# PlateDefectDetectionSystem **Repository Path**: lut108/plate-defect-detection-system ## Basic Information - **Project Name**: PlateDefectDetectionSystem - **Description**: 表面缺陷检测系统 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-09-27 - **Last Updated**: 2025-12-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 表面缺陷检测系统 该项目整体分为如下几个部分: - DetectionAlgortithm:表面缺陷检测算法 - DetectionApplication:表面缺陷检测系统上位机界面 - DetectionSystem:表面缺陷检测系统 - AlgorithmTest:算法测试 - SystemSetup:系统安装 - ThirtParty:第三方库 系统整体执行的时序图如下: ```mermaid sequenceDiagram autonumber participant Application participant System participant HikVisionCamera participant YoloX participant Algorithm Note over Application,Algorithm: Initialize Application->>System: initializeHunter System->>HikVisionCamera: load HikVisionCamera->>HikVisionCamera: connect & start System->>YoloX: load YoloX->>YoloX: load models System->>Algorithm: load Algorithm->>YoloX: get model instances Note over Application,Algorithm: Detect Application->>System: executeAlgorihtm System->>HikVisionCamera: capture HikVisionCamera->>Algorithm: execute Algorithm->>YoloX: infer YoloX->>Algorithm: classification YoloX->>Algorithm: segment YoloX->>Algorithm: detect Algorithm->>Algorithm: handle Algorithm->>System: return result System->>Application: return result ``` ## 表面缺陷检测算法 该部分位于 DetectionAlgortithm 子项目中。通过 hunter 插件的方式集成到缺陷检测系统中。 ### 插件配置 可配置项如下: | 配置项 | 类型 | 默认值 | 是否必要 | 说明 | | --------------------- | ---------------- | ------ | -------- | -------------------- | | classes | Integer | | Y | 缺陷类别数量 | | resnet_qualified_idxs | Array\ | | Y | ResNet合格的目标索引 | | category | Object | | Y | 缺陷分类 | | standards | Array\ | | Y | 评估标准 | 其中,category 字段的示例配置如下,表示共分为 4 个缺陷分类,分类 a 包含 0、2、4,分类 b 包含 1、5、6,分类 c 包含 3、7,分类 d 包含 9: ```json { "category": { "a": [0,2,4], "b": [1,5,6], "c": [3,7], "d": [9] } } ``` 对于 standards 字段,其可配置如下: | 配置项 | 类型 | 默认值 | 是否必要 | 说明 | | ------------------- | --------------- | ------ | -------- | ---------------------- | | exist_edge_nodule | Boolean | | Y | 是否存在边部结瘤 | | is_resnet_qualified | Boolean | | Y | ResNet输出结果是否合格 | | thresholds | Array\ | | Y | 缺陷分类阈值数组 | 示例配置如下,其表示共分为两个等级标准。其中,第一个等级需要同时满足如下条件: 1. 存在边部结瘤; 2. resnet结果合格; 3. a 类缺陷面积占比位于 4 到 50 之间,b 类缺陷面积占比位于 4 到 50 之间,b 和 c 类缺陷面积之和位于 4 到 50 之间; ```json { "standards": [ { "exist_edge_nodule": true, "is_resnet_qualified": true, "thresholds": [ { "category": ["a"], "enable": true, "min_ratio": 4, "max_ratio": 50 }, { "category": ["b"], "enable": true, "min_ratio": 4, "max_ratio": 50 }, { "category": ["b","c"], "enable": true, "min_ratio": 4, "max_ratio": 50 } ] }, { "exist_edge_nodule": true, "is_resnet_qualified": true, "thresholds": [ { "category": ["a"], "enable": true, "min_ratio": 4, "max_ratio": 50 }, { "category": ["b"], "enable": true, "min_ratio": 4, "max_ratio": 50 }, { "category": ["b","c"], "enable": true, "min_ratio": 4, "max_ratio": 50 } ] } ] } ``` ### 支持的方法 该插件支持的方法如下: ```c++ /** 获取评估标准 */ std::vector getEvaluationStandard(); /** 设置评估标准 */ void setEvaluationStandard(const std::vector& standards); /** 获取质量评估等级 */ int getQualityLevel(); ``` ### 支持的事件 暂无支持事件。 ## 缺陷检测系统 缺陷检测系统的部分位于 DetectionSystem 子项目中,其依赖于 hunter 底层库,并依赖于如下三个插件: - hunter_hikvision_camera: 海康相机SDK插件 - hunter_yolox: Yolo神经网络推理插件 - hunter_detection_algorithm: 表面缺陷检测算法插件,即 DetectionAlgortithm 子项目 支持的接口见 `Interface.h` 头文件。 ## 缺陷检测系统上位机界面 该部分位于 DetectionApplication 子项目中,主要负责 UI 界面的显示和数据库的交互。 ## 缺陷检测算法测试 该部分位于 AlgorithmTest 子项目中,主要负责测试算法功能是否正常。 ## 系统安装 该部分位于 SystemSetup 子项目中,主要负责系统程序的安装。