倒置残差网络结合注意力机制的掺假羊肉分类检测系统构建

    Construction of the detection system for mutton adulteration classification based on inverted residual network and convolutional block attention module

    • 摘要: 针对羊肉精和染色剂作用下的猪肉掺假羊肉分类检测问题,该研究提出并建立了一种检测速度较快、精度较高的注意力机制结合倒置残差网络模型,同时基于智能手机开发了对应的快速、准确检测应用软件。首先,对羊肉、不同部位猪肉、不同掺假比例下的猪肉掺假羊肉的原始手机图像,使用数据增强方式进行数据扩充;其次,用倒置残差结构替换残差网络框架中的原有残差结构,以减少网络参数量并加快模型收敛速度,同时,引入注意力机制(Convolutional Block Attention Module,CBAM),利用空间和通道特征对特征权重再分配,以强化掺假羊肉和羊肉之间的特征差异;然后,利用提出的注意力机制结合倒置残差网络(CBAM-Invert-ResNet)对样本进行训练并确定模型参数;最后,将训练好的网络模型移植到智能手机,以实现掺假羊肉的移动端检测。研究结果表明:与ResNet50和CBAM-ResNet50相比,Invert-ResNet50、CBAM-Invert-ResNet50模型的参数量分别减少了58.25%和61.64%,模型大小分别减小了58.43%和61.59%;针对背脊、前腿、后腿和混合部位数据集,CBAM-Invert-ResNet50模型验证集的分类准确率分别为95.19%、94.29%、95.81%、92.96%;把建立的网络模型部署到移动端后,每张图片的检测时间约为 0.3 s。该研究可实现对羊肉精和染色剂作用下的不同部位猪肉掺假羊肉的移动端快速、准确分类检测,可为维护市场秩序和保护食品安全提供技术支持。

       

      Abstract: Abstract: Accurate and real-time detection of meat adulteration has been an ever-increasing high demand in the food industry in recent years. However, the presence of mutton flavor essence and dye can make the detection more difficult than before. In this study, a residual network (ResNet) model was proposed to classify the mutton adulteration using Convolutional Block Attention Module (CBAM) combined with the inverted residual (Invert). Meanwhile, an application software was also developed to realize the rapid and accurate classification using smart phones. Firstly, the original images were collected from the mutton, three parts pork, and adulterated mutton using a mobile phone. Hough circle detection was then used to remove the background of the images. Data augmentation (such as rotation, offset, and mirroring) was used to expand the sample images. 6800 images were acquired, two-thirds of which were used as the training and testing dataset. Furthermore, the training dataset was three times larger than the testing one. The rest was then used as the independent validation dataset. Secondly, the original residual structure of the ResNet framework was replaced by the Invert structure, in order to reduce the number of network parameters for the high convergence speed. At the same time, the CBAM was introduced into the Invert structure. As such, the feature difference was strengthened to redistribute the feature weights in the spatial and channel. The convolution neural network (CBAM-Invert-ResNet) was then developed using the sample data. Furthermore, the MobileNet and resnet50 were also developed using the same data to compare the convergence speed and accuracy of the model. Finally, the CBAM-Invert-ResNet network model was transplanted to mobile phones by the TensorFlow Lite framework and Android Studio development environment. The mobile terminal classification was realized in real time. The results showed that the CBAM greatly enhanced the feature difference among categories, whereas, the Invert significantly reduced the parameters and size of the network, indicating the accelerated convergence speed. The parameters of Invert-ResNet50 model are 9.85×106, and the model size is 18.66 MB, which were reduced by 58.25% and 58.43% compared with the ResNet50 model. Specifically, the parameters of the CBAM-Invert-ResNet50 model were 1.002×107 with a model size of 19.11MB, which were reduced by 61.64% and 61.59% compared with the CBAM-ResNet50 model, respectively, compared with the ResNet50 model. The convergence speed of the CBAM-Invert-ResNet50 model was much faster than that of the ResNet50 one. There were also many more outstanding differences in color during feature visualization of the mutton, adulterated mutton, and pork using the CBAM-Invert-ResNet50 model. The classification accuracies of the CBAM-Invert-ResNet50 model for the pork adulteration with the loin, hind shank, fore shank and mix parts datasets were 95.19 %, 94.29 %, 95.81 %, and 92.96% in validation dataset, which were improved by 6.08、2.62、14.70 and 4.23 percentage points compared with the Invert-ResNet50 model, respectively, compared with the ResNet50 model. Furthermore, the classification accuracies of the CBAM-Invert-ResNet50 model were improved by 12.44, 9.6, 13.73, and 4.87 percentage points, respectively, compared with the MobileNet. Moreover, the application software with the CBAM-Invert-ResNet50 model was developed to quickly and accurately classified mutton, pork, and mutton adulteration with the different ratios of pork ingredients. The detection time of each image was about 0.3 s in the mobile terminal. The rapid and accurate classification was realized for the mutton adulteration with the pork under the effect of mutton flavor essence and dye. The finding can provide technical support to maintain the market order in food safety.

       

    /

    返回文章
    返回