Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss
With increasing consumer expectations for the quality and safety of agricultural products, intelligent quality detection and gradation have considerable significance in agricultural production. The surface defect is an important indicator of quality, but is classified mainly using inefficient manual...
Main Authors: | , , , |
---|---|
Format: | Article |
Language: | English |
Published: |
MDPI AG
2022-08-01
|
Series: | Agronomy |
Subjects: | |
Online Access: | https://www.mdpi.com/2073-4395/12/9/2076 |
_version_ | 1797492193846362112 |
---|---|
author | Haixia Sun Shujuan Zhang Rui Ren Liyang Su |
author_facet | Haixia Sun Shujuan Zhang Rui Ren Liyang Su |
author_sort | Haixia Sun |
collection | DOAJ |
description | With increasing consumer expectations for the quality and safety of agricultural products, intelligent quality detection and gradation have considerable significance in agricultural production. The surface defect is an important indicator of quality, but is classified mainly using inefficient manual identification for “Yuluxiang” pears. Because of the uncertainty and high difficulty of image acquisition in agriculture, the data imbalance between categories is a common problem. For the resolution of these problems, the class balance (CB) was used to re-weight the sigmoid cross-entropy loss (SGM-CE), softmax cross-entropy loss (SM-CE), focal loss (FL) functions in this study. CB-SGM-CE, CB-SM-CE, and CB-FL were used to construct a GoogLeNet network as a convolutional neural network (CNN) generalized feature extractor, and transfer learning was combined to build detection models, respectively. The results showed that CB-SGM-CE, CB-SM-CE, and CB-FL were better than SGM-CE, SM-CE, and FL, respectively. CB-FL achieved the best detection results (F1 score of 0.993–1.000) in 3 CB loss functions. Then, CB-FL was used to construct VGG 16, AlexNet, SqueezeNet, and MobileNet V2 networks based on transfer learning, respectively. Machine learning (ML) and CNN were used to build classification models in this study. Compared with ML models and the other 4 CNN models, the CB-FL-GoogLeNet model achieved the best detection results (accuracy of 99.78%). A system for surface defect detection was developed. The results showed that the testing accuracy of the CB-FL-GoogLeNet model was 95.28% based on this system. This study realizes the surface defect detection of the “Yuluxiang” pear with an unbalanced dataset, and provides a method for intelligent detection in agriculture. |
first_indexed | 2024-03-10T01:00:06Z |
format | Article |
id | doaj.art-d9f616ad89504b79babd673ae5a91187 |
institution | Directory Open Access Journal |
issn | 2073-4395 |
language | English |
last_indexed | 2024-03-10T01:00:06Z |
publishDate | 2022-08-01 |
publisher | MDPI AG |
record_format | Article |
series | Agronomy |
spelling | doaj.art-d9f616ad89504b79babd673ae5a911872023-11-23T14:36:57ZengMDPI AGAgronomy2073-43952022-08-01129207610.3390/agronomy12092076Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance LossHaixia Sun0Shujuan Zhang1Rui Ren2Liyang Su3College of Agricultural Engineering, Shanxi Agricultural University, Jinzhong 030801, ChinaCollege of Agricultural Engineering, Shanxi Agricultural University, Jinzhong 030801, ChinaCollege of Agricultural Engineering, Shanxi Agricultural University, Jinzhong 030801, ChinaCollege of Agricultural Engineering, Shanxi Agricultural University, Jinzhong 030801, ChinaWith increasing consumer expectations for the quality and safety of agricultural products, intelligent quality detection and gradation have considerable significance in agricultural production. The surface defect is an important indicator of quality, but is classified mainly using inefficient manual identification for “Yuluxiang” pears. Because of the uncertainty and high difficulty of image acquisition in agriculture, the data imbalance between categories is a common problem. For the resolution of these problems, the class balance (CB) was used to re-weight the sigmoid cross-entropy loss (SGM-CE), softmax cross-entropy loss (SM-CE), focal loss (FL) functions in this study. CB-SGM-CE, CB-SM-CE, and CB-FL were used to construct a GoogLeNet network as a convolutional neural network (CNN) generalized feature extractor, and transfer learning was combined to build detection models, respectively. The results showed that CB-SGM-CE, CB-SM-CE, and CB-FL were better than SGM-CE, SM-CE, and FL, respectively. CB-FL achieved the best detection results (F1 score of 0.993–1.000) in 3 CB loss functions. Then, CB-FL was used to construct VGG 16, AlexNet, SqueezeNet, and MobileNet V2 networks based on transfer learning, respectively. Machine learning (ML) and CNN were used to build classification models in this study. Compared with ML models and the other 4 CNN models, the CB-FL-GoogLeNet model achieved the best detection results (accuracy of 99.78%). A system for surface defect detection was developed. The results showed that the testing accuracy of the CB-FL-GoogLeNet model was 95.28% based on this system. This study realizes the surface defect detection of the “Yuluxiang” pear with an unbalanced dataset, and provides a method for intelligent detection in agriculture.https://www.mdpi.com/2073-4395/12/9/2076class balanced lossconvolutional neural networkdefect“Yuluxiang” peardefection |
spellingShingle | Haixia Sun Shujuan Zhang Rui Ren Liyang Su Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss Agronomy class balanced loss convolutional neural network defect “Yuluxiang” pear defection |
title | Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss |
title_full | Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss |
title_fullStr | Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss |
title_full_unstemmed | Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss |
title_short | Surface Defect Detection of “Yuluxiang” Pear Using Convolutional Neural Network with Class-Balance Loss |
title_sort | surface defect detection of yuluxiang pear using convolutional neural network with class balance loss |
topic | class balanced loss convolutional neural network defect “Yuluxiang” pear defection |
url | https://www.mdpi.com/2073-4395/12/9/2076 |
work_keys_str_mv | AT haixiasun surfacedefectdetectionofyuluxiangpearusingconvolutionalneuralnetworkwithclassbalanceloss AT shujuanzhang surfacedefectdetectionofyuluxiangpearusingconvolutionalneuralnetworkwithclassbalanceloss AT ruiren surfacedefectdetectionofyuluxiangpearusingconvolutionalneuralnetworkwithclassbalanceloss AT liyangsu surfacedefectdetectionofyuluxiangpearusingconvolutionalneuralnetworkwithclassbalanceloss |