社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
Py学习  »  Git

GitHub工业级开源:对锅炉水冷壁管进行视觉缺陷检测

GitHubFun网站 • 1 年前 • 351 次点击  

大家好,我是Fun-Fun君,每天分享GitHub上最有价值的资源

今天分享 

小数据集对锅炉水冷壁管进行视觉缺陷检测

版权归原作者,本文只是介绍、推广本代码

源代码:【数据集】

http://www.gitpp.com/cooldata/defect-detection-classifier



支持向量机(SVM)作为一种强大的分类和回归工具,在表面缺陷检测领域得到了广泛应用。以下是使用 SVM 进行表面缺陷检测的基本步骤:

1. 数据准备:首先,需要收集包含表面缺陷的各种样本,并对这些样本进行预处理,如图像增强、特征提取等。样本应涵盖不同类型的表面缺陷,以便训练出的模型具有较好的泛化能力。

2. 特征提取:从预处理后的图像中提取有助于区分缺陷和非缺陷的特征。常用的特征包括颜色、纹理、形状等。这些特征可用于训练 SVM 分类器。

3. 构建 SVM 分类器:利用提取的特征数据,构建 SVM 分类器。在构建过程中,需要选择合适的核函数(如线性核、多项式核、径向基函数等)并调整相关参数,以获得最佳的分类性能。

4. 模型训练:将表面缺陷样本输入 SVM 分类器进行训练。训练过程中,需要优化惩罚参数 C 以及核函数的相关参数,以提高模型的分类准确性。

5. 模型评估:使用验证集或测试集对训练好的 SVM 分类器进行评估。评估指标可以包括准确率、召回率、F1 值等。根据评估结果,可以进一步优化模型参数,以提高表面缺陷检测的性能。

6. 缺陷检测:将训练好的 SVM 分类器应用于实际生产过程中的产品表面图像检测。对于给定的图像,提取其特征后,输入 SVM 分类器进行分类。根据分类结果,可以判断产品表面是否存在缺陷。

7. 缺陷定位:在检测到缺陷后,可以利用 SVM 分类器对缺陷的位置进行定位。具体方法是,针对缺陷区域特征进行单独分类,从而获得缺陷的精确位置。

通过以上步骤,可以使用 SVM 进行表面缺陷检测。值得注意的是,为了获得较好的检测效果,需要充分优化模型参数,并结合其他机器学习算法或图像处理技术,提高检测的准确性和实时性。


小数据集对锅炉水冷壁管进行视觉缺陷检测

版权归原作者,本文只是介绍、推广本代码

小数据集说明:(翻译作者)水冷壁缺陷检测。

样本很难收集,所以我们只有很少的数据集

其中包括320张训练图像(160张正常图像+160张缺陷图像)和80张测试图像(40张正常图像+40张缺陷图像)。

图像尺寸为256*256。该数据集由金东收集。感谢于芳gcForest 的使用


数据集的样子


分类器

We use Support Vector Machine(SVM) with different feature extractors, deep forest and Convolutional Neural 
Network to train the classifier.

  • 高斯滤波器+LBP+SVM(rbf核)

    Use Gaussian filter and laplacian operator to denoise and extracts edges, then LBP(Local Binary Patt-
    ern) extract features of preprocessed images as the input of SVM.

  • CNN+SVM(rbf核)

    Use VGG16 to extract features as the input of SVM., the weight of VGG16 is trained on ImageNet.

  • 简单 CNN(3 Conv+1 FC)

    Build a simple neural network to train. The network consists of three convolutional layers and a fully
    connected layer.

  • 迁移学习(VGG16)

    Use VGG16 to extract features as input of a simple network that consists of a fully-connected layer.

  • 神经网络搜索

    Use NNS to search a best network.

  • GC森林

    Use deep forest(Only cascade forest structure/With multi-grained forests) to train the ensemble classifier.

结果


分类器准确性
高斯滤波器+LBP+SVM(rbf核)97.25%
CNN+SVM(rbf核)71.25%
简单 CNN(3 Conv+1 FC)72.50%
迁移学习(VGG16)81.25%
神经网络搜索82.28%
gcForest(无多粒森林)80.00%
gcForest(多粒森林,i=8)88.75%


安装依赖关系

    

pip install -r requirements.txt

运行


# read README.md in models folder and download weight file of pre-trained VGG on the ImageNet dataset.

# dataset

cp -rf normal_add/* ./normal

rm -rf normal_add/

cp -rf defect_add/* ./defect

rm -rf defect_add

# CNN+SVM(rbf kernel)

python cnnSVM.py

# simple CNN(3 Conv+1 FC)

python CNNclassifier.py

# transfer Learning(VGG16)

python transferLearning.py

# gcForest (without multi-grained forests) 

python ./data/train/write_label.py

python ./data/test/write_label.py

python ./gcForest/demo_Defect-Detection-Classifier.py --model ./gcForest/demo_Defect-Detection-Classifier-ca.json

# gcForest (with multi-grained forests, i=8) 

python ./gcForest/demo_Defect-Detection-Classifier.py --model ./gcForest/demo_Defect-Detection-Classifier-gc8.json

# Neural Network Search, copy autokeras dir to current path after it is installed from source.

python ./data/train/write_label2.py

python ./data/test/write_label2.py

python3 autoCNNclassifier.py

源代码:【数据集】


http://www.gitpp.com/cooldata/defect-detection-classifier

www.gitpp.com 收集了10000+源代码 ,点击 阅读原文


Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/169257
 
351 次点击