# Tianchi-2021guangdong-industry-Algorithmic-competition--Defect-detection-of-ceramic-tile-Rank1 **Repository Path**: smilecare/Tianchi-2021guangdong-industry-Algorithmic-competition--Defect-detection-of-ceramic-tile-Rank1 ## Basic Information - **Project Name**: Tianchi-2021guangdong-industry-Algorithmic-competition--Defect-detection-of-ceramic-tile-Rank1 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2021-03-31 - **Last Updated**: 2025-03-12 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 天池2021广东工业智造智能算法赛 冠军解决方案 全套代码 [比赛地址链接](https://tianchi.aliyun.com/competition/entrance/531846/introduction?spm=5176.12281925.0.0.4ef57137zkC0ak) -- 队伍:安宁庞巴迪 # 关键方案介绍 ## * 传统特征提取 1. 使用surf算子将原缺陷图和模板如对齐 2. 将缺陷图的灰度图与对齐好的模板图的灰度图相减得到传统特征 ![image](https://github.com/majiawe/Tianchi-2021guangdong-industry-Algorithmic-competition--Defect-detection-of-ceramic-tile-Rank1/blob/master/feature.png) ## * 将传统特征与深度学习提取的特征进行融合(提出DSFNet) 1. 将传统特征与原RGB缺陷图组合成四通道输入网络 2. 另外将该传统特征融合到FPN的输出特征上 ![image](https://github.com/majiawe/Tianchi-2021guangdong-industry-Algorithmic-competition--Defect-detection-of-ceramic-tile-Rank1/blob/master/dsf.png) ## * 其余性能优化措施 1. 将anchor sacle 设置为4和8以检测大目标和小目标 2. 采用多尺度训练(1000~2000)以及多尺度测试 3. 训练测试均有数据旋转、随即翻转数据增广方式 4. 双阈值后处理 5. 采用单模型resNeSt50+FPN+cascade_rcnn # 主要代码环境依赖 * Ubuntu 19.04.3 * cuda 10.1 * mmcv-full 1.2.5 * python 3.7.4 * pytorch 1.6 * torchvision 0.7 * mmdetection * opencv 3.4.2.17 # 数据预处理以及相关说明 * 数据预处理代码在data_precess文件夹里,包括模板对齐,预训练权重通道数修改。若用GPU来执行对齐操作需要编译GPU版的opencv,下面介绍的镜像里已编译好。 * 预处理步骤可看online_train.py代码文件,这里默认官方数据挂载到容器/tcdata里。 * 需新建/work_dir/pre_trained_weight/目录用于手动存放下载的预训练, [下载地址](http://download.openmmlab.com/mmdetection/v2.0/resnest/cascade_rcnn_s50_fpn_syncbn-backbone%2Bhead_mstrain-range_1x_coco/cascade_rcnn_s50_fpn_syncbn-backbone%2Bhead_mstrain-range_1x_coco_20201122_213640-763cc7b5.pth)。 训练的时候,日志会自动保存在/work_dir/。 * 需新建dcn_r101文件夹,训练完成的权重会被保存在该文件夹下。 # docker hub镜像拉取 ``` docker pull jwma1996/tianchi_2021guangdong_defect_detection_of_tile:latest ``` 1. 该镜像对应榜单最优成绩 2. 包含端到端完整的数据处理、训练、测试过程 # 模型训练 ``` python online_train.py ``` # 模型测试 ``` python online_infer.py ``` # 训完自动测试 ``` sh run.sh ```