CN114580511B - Sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism - Google Patents
Sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism Download PDFInfo
- Publication number
- CN114580511B CN114580511B CN202210176964.6A CN202210176964A CN114580511B CN 114580511 B CN114580511 B CN 114580511B CN 202210176964 A CN202210176964 A CN 202210176964A CN 114580511 B CN114580511 B CN 114580511B
- Authority
- CN
- China
- Prior art keywords
- sulfur
- dried ginger
- image
- information
- voting mechanism
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 235000006886 Zingiber officinale Nutrition 0.000 title claims abstract description 85
- 235000008397 ginger Nutrition 0.000 title claims abstract description 85
- 241000234314 Zingiber Species 0.000 title claims abstract description 84
- 238000000034 method Methods 0.000 title claims abstract description 24
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 21
- 238000000605 extraction Methods 0.000 claims abstract description 7
- 238000012706 support-vector machine Methods 0.000 claims abstract description 5
- 238000013528 artificial neural network Methods 0.000 claims abstract description 3
- 238000007637 random forest analysis Methods 0.000 claims abstract description 3
- 229910052717 sulfur Inorganic materials 0.000 claims description 56
- 239000011593 sulfur Substances 0.000 claims description 56
- NINIDFKCEFEMDL-UHFFFAOYSA-N Sulfur Chemical compound [S] NINIDFKCEFEMDL-UHFFFAOYSA-N 0.000 claims description 36
- RAHZWNYVWXNFOC-UHFFFAOYSA-N Sulphur dioxide Chemical compound O=S=O RAHZWNYVWXNFOC-UHFFFAOYSA-N 0.000 claims description 30
- 239000013598 vector Substances 0.000 claims description 21
- 238000003958 fumigation Methods 0.000 claims description 15
- 238000012549 training Methods 0.000 claims description 13
- 238000001514 detection method Methods 0.000 claims description 7
- 238000012360 testing method Methods 0.000 claims description 5
- 239000003153 chemical reaction reagent Substances 0.000 claims description 4
- 238000010801 machine learning Methods 0.000 claims description 2
- 230000000877 morphologic effect Effects 0.000 claims description 2
- 238000005987 sulfurization reaction Methods 0.000 claims 1
- 238000012795 verification Methods 0.000 claims 1
- 230000001066 destructive effect Effects 0.000 abstract description 4
- 238000002360 preparation method Methods 0.000 abstract 1
- 239000000463 material Substances 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000010792 warming Methods 0.000 description 2
- 238000004477 FT-NIR spectroscopy Methods 0.000 description 1
- 101000827703 Homo sapiens Polyphosphoinositide phosphatase Proteins 0.000 description 1
- 206010062717 Increased upper airway secretion Diseases 0.000 description 1
- 238000004497 NIR spectroscopy Methods 0.000 description 1
- 102100023591 Polyphosphoinositide phosphatase Human genes 0.000 description 1
- UCKMPCXJQFINFW-UHFFFAOYSA-N Sulphide Chemical compound [S-2] UCKMPCXJQFINFW-UHFFFAOYSA-N 0.000 description 1
- 244000273928 Zingiber officinale Species 0.000 description 1
- 241000234299 Zingiberaceae Species 0.000 description 1
- 229910052785 arsenic Inorganic materials 0.000 description 1
- RQNWIZPPADIBDY-UHFFFAOYSA-N arsenic atom Chemical compound [As] RQNWIZPPADIBDY-UHFFFAOYSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 229940126678 chinese medicines Drugs 0.000 description 1
- 238000007796 conventional method Methods 0.000 description 1
- 238000005260 corrosion Methods 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000001035 drying Methods 0.000 description 1
- 238000002474 experimental method Methods 0.000 description 1
- 229910001385 heavy metal Inorganic materials 0.000 description 1
- 238000004128 high performance liquid chromatography Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 210000004072 lung Anatomy 0.000 description 1
- QSHDDOUJBYECFT-UHFFFAOYSA-N mercury Chemical compound [Hg] QSHDDOUJBYECFT-UHFFFAOYSA-N 0.000 description 1
- 229910052753 mercury Inorganic materials 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 208000026435 phlegm Diseases 0.000 description 1
- 238000012545 processing Methods 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 239000000126 substance Substances 0.000 description 1
- 238000001195 ultra high performance liquid chromatography Methods 0.000 description 1
- 238000010200 validation analysis Methods 0.000 description 1
- 239000001841 zingiber officinale Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/24—Classification techniques
- G06F18/241—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
- G06F18/2411—Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on the proximity to a decision surface, e.g. support vector machines
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Artificial Intelligence (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computational Linguistics (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Biophysics (AREA)
- Evolutionary Biology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Computing Systems (AREA)
- Mathematical Physics (AREA)
- Software Systems (AREA)
- Investigating Or Analysing Materials By Optical Means (AREA)
Abstract
本发明公开了一种基于图像亮度信息和投票机制的硫熏干姜鉴定方法,它包括以下步骤:(1)样品制备和图像数据采集;(2)提取图像特征;(3)分别使用采用支持向量机(SVM)、BP神经网络(BPNN)与随机森林算法(RF)建立硫熏干姜鉴别模型;(4)根据三种模型的结果,建立一套基于投票机制的识别模型。本发明首次采用基于图像亮度信息与投票机制的硫熏干姜鉴别方法,能够准确预测干姜硫熏程度,具有快速无损、识别准确率高以及稳定性强的优势。
The present invention discloses a sulfur-smoked dried ginger identification method based on image brightness information and a voting mechanism, which comprises the following steps: (1) sample preparation and image data acquisition; (2) image feature extraction; (3) using support vector machine (SVM), BP neural network (BPNN) and random forest algorithm (RF) to establish sulfur-smoked dried ginger identification models; (4) according to the results of the three models, establishing a set of recognition models based on a voting mechanism. The present invention adopts a sulfur-smoked dried ginger identification method based on image brightness information and a voting mechanism for the first time, which can accurately predict the sulfur-smoking degree of dried ginger, and has the advantages of rapid and non-destructive, high recognition accuracy and strong stability.
Description
技术领域Technical Field
本发明属于药材检测技术领域;具体涉及一种基于图像亮度信息和投票机制的硫熏干姜鉴别方法。The invention belongs to the technical field of medicinal material detection, and specifically relates to a sulfur-smoked dried ginger identification method based on image brightness information and a voting mechanism.
背景技术Background technique
干姜(Zingiber officinale Roscoe),是姜科姜属的多年生草本植物姜的干燥根茎,具有温中散寒、回阳通脉、温肺化饮的功效。干姜的市场需求量巨大,全世界尤其是亚洲、非洲和欧洲的庞大人群日常有使用干姜(包括生姜鲜食)的习惯。采用硫磺熏蒸生姜能够起到防腐、防霉、防虫蛀的效果,并有利于干燥和增色等。虽然硫磺熏蒸对中药材的加工贮藏起到了一定的积极作用,但现代研究证明硫磺熏蒸后中药材的化学性质多有改变乃至影响药材的性味和功效,还会残留硫化物、砷、汞等重金属,长期大量服用此类中药会对人体造成损害。Dried ginger (Zingiber officinale Roscoe) is the dried rhizome of the perennial herb ginger of the ginger family. It has the effects of warming the middle and dispelling cold, restoring yang and unblocking meridians, and warming the lungs and eliminating phlegm. The market demand for dried ginger is huge. A large number of people around the world, especially in Asia, Africa and Europe, have the habit of using dried ginger (including fresh ginger) on a daily basis. Sulfur fumigation of ginger can play a role in anti-corrosion, anti-mildew, and anti-insect effects, and is conducive to drying and color enhancement. Although sulfur fumigation has played a certain positive role in the processing and storage of Chinese medicinal materials, modern research has shown that the chemical properties of Chinese medicinal materials have changed after sulfur fumigation, and even affected the nature, taste and efficacy of the medicinal materials. Heavy metals such as sulfide, arsenic and mercury will also remain. Long-term and large-scale use of such Chinese medicines will cause damage to the human body.
目前存在的硫磺熏蒸药材的检测技术有超高效液相色谱法,近红外光谱检测法等。但是现有的方法需要昂贵的设备来收集信息。因此,利用现有的方法对无硫干姜和含硫干姜进行识别并不便捷。随着机器学习算法的发展,图像识别技术日趋成熟。基于图像的硫熏干姜鉴别方法具有快速、无污染、无损材料等优点。因此,如何通过图像信息快速对硫熏干姜进行识别,是当前需要解决的关键问题。The existing detection technologies for sulfur fumigated medicinal materials include ultra-high performance liquid chromatography, near-infrared spectroscopy, etc. However, the existing methods require expensive equipment to collect information. Therefore, it is not convenient to use the existing methods to identify sulfur-free dried ginger and sulfur-containing dried ginger. With the development of machine learning algorithms, image recognition technology is becoming more and more mature. The image-based sulfur-fumigated dried ginger identification method has the advantages of being fast, pollution-free, and non-destructive to materials. Therefore, how to quickly identify sulfur-fumigated dried ginger through image information is a key problem that needs to be solved at present.
发明内容Summary of the invention
发明目的:为解决以上技术问题,本发明提供了一种基于图像亮度信息和投票机制的硫熏干姜鉴别方法。与传统鉴别方法相比,该方法能对干姜的硫熏程度进行准确预测,具有成本小、快速无损、识别准确率高以及稳定性强的优势。Purpose of the invention: To solve the above technical problems, the present invention provides a sulfur-fumigated dried ginger identification method based on image brightness information and voting mechanism. Compared with the traditional identification method, this method can accurately predict the sulfur fumigation degree of dried ginger, and has the advantages of low cost, rapid and non-destructive, high recognition accuracy and strong stability.
技术方案:为实现以上目的,本发明提供的技术方案如下:一种基于图像亮度信息和投票机制的硫熏干姜鉴定方法,包括以下步骤:Technical solution: To achieve the above purpose, the technical solution provided by the present invention is as follows: a sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism, comprising the following steps:
(1)样本采集:选用不同硫含量的干姜;(1) Sample collection: Select dried ginger with different sulfur contents;
(2)样本分类:使用二氧化硫检测试剂对样品的硫熏程度进行标记;(2) Sample classification: Use sulfur dioxide detection reagent to mark the sulfur fumigation degree of the sample;
(3)图像数据的采集:分别使用图像采集设备采集干姜的图像信息,并对每张图像的硫熏程度(高硫、低硫、无硫)进行标记;(3) Image data collection: Use image acquisition equipment to collect image information of dried ginger, and mark the sulfur fumigation degree (high sulfur, low sulfur, no sulfur) of each image;
(4)LBP特征提取:设图像第i行第j列个像素点(i,j)的RGB值为(Rij,Gij,Bij),将图像的RGB颜色信息转换成Lab颜色空间三通道信息。设转换后Lab像素点(i,j)的Lab值为(Lij,aij,bij),那么像素点(i,j)的亮度值为Lij。令该像素点周围临近的8个像素点的亮度值分别为L0,L1,...,L7。设Lp为邻近的第p个像素点的亮度值,利用公式(1)和公式(2)可以得到像素点的亮度关系值Lrij。亮度关系值Lij是一个[1,10]的整数。先计算整个L通道每个像素的Lrij,再统计每个整数出现的次数与亮度关系值总数的比值,进而形成一个十维向量。这个向量记作fL1。再以同样的方式计算a通道和b通道的特征向量值记作fa1和fb1。拼接fL1,fa1和fb1形成向量f1。对原始图像进行下采样,对下采样后的图像重复步骤(4)的特征提取过程,得到向量f2。再重复一下下采样,得到向量f3。拼接向量f1,f2与f3,得到图像最终特征f。(4) LBP feature extraction: Let the RGB value of the pixel (i,j) in the i-th row and j-th column of the image be (R ij ,G ij ,B ij ), and convert the RGB color information of the image into three-channel information in the Lab color space. Let the Lab value of the converted Lab pixel (i,j) be (L ij ,a ij ,b ij ), then the brightness value of the pixel (i,j) is L ij . Let the brightness values of the eight pixels around the pixel be L 0 ,L 1 ,...,L 7 , respectively. Let L p be the brightness value of the adjacent p-th pixel, and the brightness relationship value Lr ij of the pixel can be obtained using formula (1) and formula (2). The brightness relationship value L ij is an integer between [1,10]. First calculate Lr ij of each pixel in the entire L channel, and then count the ratio of the number of occurrences of each integer to the total number of brightness relationship values, and then form a ten-dimensional vector. This vector is denoted as f L1 . Calculate the feature vector values of channel a and channel b in the same way and record them as f a1 and f b1 . Concatenate f L1 , f a1 and f b1 to form vector f 1 . Downsample the original image and repeat the feature extraction process of step (4) for the downsampled image to obtain vector f 2 . Repeat the downsampling again to obtain vector f 3 . Concatenate vectors f 1 , f 2 and f 3 to obtain the final feature f of the image.
(5)建立模型:将干姜图像样本划分为训练集与验证集,使用支持向量机、BP神经网络、随机森林算法学习不同硫熏程度干姜训练集样本的特征。采用LibSVM软件包和RF软件包和BPNN软件包进行模型训练,构建3种不同的干姜硫熏程度预测模型;(5) Model building: The dried ginger image samples were divided into a training set and a validation set. The features of the dried ginger training set samples with different sulfur fumigation degrees were learned using support vector machines, BP neural networks, and random forest algorithms. The LibSVM software package, RF software package, and BPNN software package were used for model training to build three different prediction models for the sulfur fumigation degree of dried ginger.
(6)建立投票机制:设SVM算法所占的权重为wSVM_M,BPNN算法所占的权重为wBPNN_M,RF算法所占的权重为wRF_M。根据公式(3)、(4)、(5)、(6)计算vi。计算v1,v2,v3的最大值,如果v1最大,那么此样品就是无硫干姜;如果v2最大,那么此样品就是低硫干姜;如果v3最大,那么此样品就是高硫干姜。对于新测试样本,其特征值被提取后,预测模型即可判定预测结果类型。(6) Establish a voting mechanism: Assume that the weight of the SVM algorithm is w SVM_M , the weight of the BPNN algorithm is w BPNN_M , and the weight of the RF algorithm is w RF_M . Calculate v i according to formulas (3), (4), (5), and (6). Calculate the maximum value of v 1 , v 2 , and v 3. If v 1 is the largest, then this sample is sulfur-free dried ginger; if v 2 is the largest, then this sample is low-sulfur dried ginger; if v 3 is the largest, then this sample is high-sulfur dried ginger. For new test samples, after their feature values are extracted, the prediction model can determine the type of prediction results.
vi=ci_SVM×wSVM_M+ci_BPNN×wBPNN_M+ci_RF×wRF_M (3) vi = ci_SVM ×w SVM_M + ci_BPNN ×w BPNN_M + ci_RF ×w RF_M (3)
与现有技术比,本发明的有益效果在于:Compared with the prior art, the beneficial effects of the present invention are:
1、相较于传统经验鉴别,如高效液相色谱以及傅里叶变换近红外光谱方法等,本发明具有快速、无损、便捷以及成本低廉的优势。1. Compared with traditional empirical identification, such as high performance liquid chromatography and Fourier transform near infrared spectroscopy, the present invention has the advantages of being fast, non-destructive, convenient and low-cost.
2、本发明为干姜的硫熏程度提供了新的识别方法,对市场上的干姜的硫熏程度评估提供科学依据,具有广阔的应用前景。2. The present invention provides a new identification method for the sulfur fumigation degree of dried ginger, provides a scientific basis for evaluating the sulfur fumigation degree of dried ginger on the market, and has broad application prospects.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1:本发明实施例1所使用的北京智云达科技股份有限公司的二氧化硫检测试剂盒;Figure 1: The sulfur dioxide detection kit of Beijing Zhiyunda Technology Co., Ltd. used in Example 1 of the present invention;
图2:本发明实施例1华为P30 ELEAL00手机采集的无硫、低硫、高硫干姜照片;Figure 2: Photos of sulfur-free, low-sulfur and high-sulfur dried ginger collected by a Huawei P30 ELEAL00 mobile phone in Example 1 of the present invention;
图3:本发明实施例1苹果XRA2108手机采集的无硫、低硫、高硫干姜照片;Figure 3: Photos of sulfur-free, low-sulfur and high-sulfur dried ginger collected by an Apple XRA2108 mobile phone in Example 1 of the present invention;
图4:本发明实施例1的Lab三通道图像:(a)L通道(b)a通道(c)b通道;FIG4 : Lab three-channel image of Example 1 of the present invention: (a) L channel (b) a channel (c) b channel;
图5:本发明实施例1的Lab各通道关系图:(a)L通道亮度关系图(b)a通道值关系图(c)b通道值关系图;FIG5 : Relationship diagrams of Lab channels in Example 1 of the present invention: (a) L channel brightness relationship diagram (b) a channel value relationship diagram (c) b channel value relationship diagram;
图6:本发明实施例1的Lab三通道直方图:(a)L通道直方图(b)a通道值直方图(c)b通道值直方图;FIG6 : Lab three-channel histogram of Example 1 of the present invention: (a) L channel histogram (b) a channel value histogram (c) b channel value histogram;
图7:本发明实施例1的鉴别方法在不同手机上不同训练集占比下的预测准确率;FIG. 7 shows the prediction accuracy of the identification method of Example 1 of the present invention under different proportions of training sets on different mobile phones;
图8为本发明提供的一种基于图像亮度信息和投票机制的硫熏干姜鉴别方法的流程图。FIG8 is a flow chart of a method for identifying sulfur-smoked dried ginger based on image brightness information and a voting mechanism provided by the present invention.
具体实施方式Detailed ways
下面通过具体实施例对本发明进行说明,以使本发明技术方案更易于理解、掌握,但本发明并不局限于此。下述实施例中所述实验方法,如无特殊说明,均为常规方法;所述试剂和材料,如无特殊说明,均可从商业途径获得。The present invention is described below by specific examples to make the technical solution of the present invention easier to understand and grasp, but the present invention is not limited thereto. The experimental methods described in the following examples are conventional methods unless otherwise specified; the reagents and materials described are all commercially available unless otherwise specified.
本发明所使用仪器:华为P30 ELEAL00与苹果XRA2108,北京智云达科技股份有限公司的二氧化硫检测试剂盒。Instruments used in the present invention: Huawei P30 ELEAL00 and Apple XRA2108, sulfur dioxide detection kit of Beijing Zhiyunda Technology Co., Ltd.
实施例1Example 1
一种基于图像亮度信息和投票机制的硫熏干姜鉴别方法,其它包括以下步骤:A sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism, comprising the following steps:
1、药材样品收集:从市场上购入123批次不同含硫量的干姜,使用二氧化硫快速检测试剂盒分别测取不同批次干姜。根据不同批次干姜硫熏程度的不同可将其划分为3类,分别为低硫干姜、高硫干姜、无硫干姜。其中低硫干姜共27批,高硫干姜共66批,无硫干姜共30批。三种类别划分的标准是低硫干姜的二氧化硫含量为50-150mg/kg、高硫干姜的二氧化硫含量大于150mg/kg、无硫干姜的二氧化硫含量为0mg/kg。图1展示不同二氧化含量的干姜得到的比色卡结果。最终分类见表1,其中NS表示无硫、LS表示低硫、HS表示高硫。1. Collection of medicinal material samples: 123 batches of dried ginger with different sulfur contents were purchased from the market, and different batches of dried ginger were measured using a sulfur dioxide rapid test kit. According to the different degrees of sulfur fumigation of different batches of dried ginger, they can be divided into three categories, namely low-sulfur dried ginger, high-sulfur dried ginger, and sulfur-free dried ginger. Among them, there were 27 batches of low-sulfur dried ginger, 66 batches of high-sulfur dried ginger, and 30 batches of sulfur-free dried ginger. The standard for dividing the three categories is that the sulfur dioxide content of low-sulfur dried ginger is 50-150 mg/kg, the sulfur dioxide content of high-sulfur dried ginger is greater than 150 mg/kg, and the sulfur dioxide content of sulfur-free dried ginger is 0 mg/kg. Figure 1 shows the colorimetric card results obtained for dried ginger with different sulfur dioxide contents. The final classification is shown in Table 1, where NS means no sulfur, LS means low sulfur, and HS means high sulfur.
表1Table 1
2、采集样品的图像数据:通过图像采集设备采集不同产地的干姜高清图像,并对每张图像的硫熏程度信息进行标记。为确保干姜形态细节信息的完整性,图像的数据采集分别采用华为P30 ELEAL00手机与苹果XRA2108手机在同一条件下拍摄。每块干姜采集正反两幅图像。低硫干姜,高硫干姜与无硫干姜的图像数目分别为54,132与60。图2(a)、(b)与(c)为华为P30 ELEAL00手机所拍摄的无硫、低硫、高硫干姜图像数据。图3(a)、(b)与(c)为苹果XRA2108手机所拍摄的无硫、低硫、高硫干姜图像数据。2. Collect image data of samples: High-definition images of dried ginger from different origins were collected by image acquisition equipment, and the sulfur fumigation degree information of each image was marked. To ensure the integrity of the morphological details of dried ginger, the image data was collected using Huawei P30 ELEAL00 mobile phone and Apple XRA2108 mobile phone under the same conditions. Two images of the front and back were collected for each piece of dried ginger. The number of images of low-sulfur dried ginger, high-sulfur dried ginger and sulfur-free dried ginger were 54, 132 and 60 respectively. Figures 2(a), (b) and (c) are the image data of sulfur-free, low-sulfur and high-sulfur dried ginger taken by Huawei P30 ELEAL00 mobile phone. Figures 3(a), (b) and (c) are the image data of sulfur-free, low-sulfur and high-sulfur dried ginger taken by Apple XRA2108 mobile phone.
3、LBP特征提取:设图像第i行第j列个像素点(i,j)的RGB值为(Rij,Gij,Bij),将图像的RGB颜色信息转换成Lab颜色空间三通道信息。设转换后Lab像素点(i,j)的Lab值为(Lij,aij,bij),那么像素点(i,j)的亮度值为Lij。令该像素点周围临近的8个像素点的亮度值分别为L0,L1,...,L7。设Lp为邻近的第p个像素点的亮度值,利用公式(1)和公式(2)可以得到像素点的亮度关系值Lrij。亮度关系值Lij是一个[1,10]的整数。先计算整个L通道每个像素的Lrij,再统计每个整数出现的次数与亮度关系值总数的比值,进而形成一个十维向量。这个向量记作fL1。再以同样的方式计算a通道和b通道的特征向量值记作fa1和fb1。拼接fL1,fa1和fb1形成向量f1。对原始图像进行下采样,对下采样后的图像重复步骤(4)的特征提取过程,得到向量f2。再重复一下下采样,得到向量f3。拼接向量f1,f2与f3,得到图像最终特征f。图4(a)、图4(b)与图4(c)分别给出Lab空间L通道、a通道与b通道图像。图5(a)、图5(b)与图5(c)分别展示L通道亮度关系图、a通道值关系图与b通道值关系图。图6(a)、图6(b)与图6(c)分别给出L通道直方图、a通道直方图与b通道直方图。3. LBP feature extraction: Let the RGB value of the pixel (i,j) in the i-th row and j-th column of the image be (R ij ,G ij ,B ij ), and convert the RGB color information of the image into three-channel information in the Lab color space. Let the Lab value of the converted Lab pixel (i,j) be (L ij ,a ij ,b ij ), then the brightness value of the pixel (i,j) is L ij . Let the brightness values of the 8 pixels around the pixel be L 0 ,L 1 ,...,L 7 . Let L p be the brightness value of the adjacent p-th pixel, and the brightness relationship value Lr ij of the pixel can be obtained by using formula (1) and formula (2). The brightness relationship value L ij is an integer in [1,10]. First calculate Lr ij of each pixel in the entire L channel, and then count the ratio of the number of occurrences of each integer to the total number of brightness relationship values, and then form a ten-dimensional vector. This vector is denoted as f L1 . Then calculate the feature vector values of the a channel and the b channel in the same way and record them as f a1 and f b1 . Concatenate f L1 , f a1 and f b1 to form vector f 1. Downsample the original image, repeat the feature extraction process of step (4) for the downsampled image, and obtain vector f 2. Repeat the downsampling again to obtain vector f 3. Concatenate vectors f 1 , f 2 and f 3 to obtain the final image feature f. Figures 4(a), 4(b) and 4(c) respectively show the Lab space L channel, a channel and b channel images. Figures 5(a), 5(b) and 5(c) respectively show the L channel brightness relationship diagram, the a channel value relationship diagram and the b channel value relationship diagram. Figures 6(a), 6(b) and 6(c) respectively show the L channel histogram, the a channel histogram and the b channel histogram.
4、建立投票机制:设SVM算法所占的权重为wSVM_M,BPNN算法所占的权重为wBPNN_M,RF算法所占的权重为wRF_M。根据公式(3)、(4)、(5)、(6)计算vi。计算v1,v2,v3的最大值,如果v1最大,那么此样品就是无硫干姜;如果v2最大,那么此样品就是低硫干姜;如果v3最大,那么此样品就是高硫干姜。对于新测试样本,其特征值被提取后,预测模型即可判定预测结果类型。4. Establish a voting mechanism: Assume that the weight of the SVM algorithm is w SVM_M , the weight of the BPNN algorithm is w BPNN_M , and the weight of the RF algorithm is w RF_M . Calculate vi according to formulas (3), (4), (5), and (6). Calculate the maximum value of v 1 , v 2 , and v 3. If v 1 is the largest, then this sample is sulfur-free dried ginger; if v 2 is the largest, then this sample is low-sulfur dried ginger; if v 3 is the largest, then this sample is high-sulfur dried ginger. For new test samples, after their feature values are extracted, the prediction model can determine the type of prediction results.
vi=ci_SVM×wSVM_M+ci_BPNN×wBPNN_M+ci_RF×wRF_M (3) vi = ci_SVM ×w SVM_M + ci_BPNN ×w BPNN_M + ci_RF ×w RF_M (3)
5、建立硫含量鉴别模型:为避免因随机抽样导致的实验误差,每次预测的train-test过程重复200次。每次以代表特征值为特征向量,使用支持向量机学习样本类型,采用LibSVM软件包、BPNN软件包、RF软件包进行模型训练。根据每种算法的正确率设置投票机制中每种算法的权值由步骤(5)所示不同方法得到的准确率,据表2可得SVM算法的准确率大于BPNN算法大于RF算法。因此我们将三种权值分别设置为wSVM_M=0.4,wBPNN_M=0.35,wRF_M=0.25,最后构建预测模型实现对干姜硫含量的预测。5. Establish a sulfur content identification model: To avoid experimental errors caused by random sampling, the train-test process of each prediction is repeated 200 times. Each time, the representative eigenvalue is used as the eigenvector, and the sample type is learned using the support vector machine. The model training is performed using the LibSVM software package, BPNN software package, and RF software package. The weight of each algorithm in the voting mechanism is set according to the accuracy of each algorithm. The accuracy obtained by the different methods shown in step (5) is greater than that of the BPNN algorithm and greater than that of the RF algorithm. Therefore, we set the three weights to w SVM_M = 0.4, w BPNN_M = 0.35, and w RF_M = 0.25, respectively, and finally build a prediction model to predict the sulfur content of dried ginger.
表2华为P30ELEAL00手机与苹果XRA2108手机拍摄图像的平均预测准确率Table 2 Average prediction accuracy of images taken by Huawei P30ELEAL00 and Apple XRA2108
6、模型训练准确性与稳定性:训练集的规模会影响最终预测的准确性,训练集占比从[0.1-0.9]之间递增获取,每次增加0.1。用train-test程序重复训练200次。实验结果如表3与表4所示,在9种不同训练集占比的预测准确率中,基于投票机制的准确率最高,苹果XR拍摄图像的准确率到达93.44%。华为P30拍摄图像的准确率82.98%。综上所述,本专利提出的思想具有高准确性和高实用性。6. Model training accuracy and stability: The size of the training set will affect the accuracy of the final prediction. The proportion of the training set is obtained incrementally from [0.1-0.9], increasing by 0.1 each time. Repeat the training 200 times using the train-test program. The experimental results are shown in Tables 3 and 4. Among the prediction accuracies of 9 different training set proportions, the accuracy based on the voting mechanism is the highest, and the accuracy of the images taken by Apple XR reaches 93.44%. The accuracy of the images taken by Huawei P30 is 82.98%. In summary, the ideas proposed in this patent have high accuracy and high practicality.
表3苹果XRA2108手机拍摄图像的准确率Table 3 Accuracy of images taken by Apple XRA2108 mobile phone
表4华为P30 ELE AL00手机拍摄图像的准确率Table 4 Accuracy of images taken by Huawei P30 ELE AL00 mobile phone
上述详细说明是针对本发明其中之一可行实施例的具体说明,该实施例并非用以限制本发明的专利范围,凡未脱离本发明所为的等效实施或变更,均应包含于本发明技术方案的范围内。The above detailed description is a specific description of one feasible embodiment of the present invention. The embodiment is not intended to limit the patent scope of the present invention. Any equivalent implementation or modification that does not deviate from the present invention should be included in the scope of the technical solution of the present invention.
Claims (6)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210176964.6A CN114580511B (en) | 2022-02-25 | 2022-02-25 | Sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210176964.6A CN114580511B (en) | 2022-02-25 | 2022-02-25 | Sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114580511A CN114580511A (en) | 2022-06-03 |
CN114580511B true CN114580511B (en) | 2024-05-24 |
Family
ID=81774114
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210176964.6A Active CN114580511B (en) | 2022-02-25 | 2022-02-25 | Sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114580511B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105550660A (en) * | 2015-12-26 | 2016-05-04 | 河北工业大学 | Woven fabric weave structure type identification method |
CN109738391A (en) * | 2019-02-20 | 2019-05-10 | 南京中医药大学 | A method for evaluating the quality of dried ginger medicinal materials based on near-infrared spectroscopy |
WO2020233156A1 (en) * | 2019-05-22 | 2020-11-26 | 青岛理工大学 | Scaly bud recognition and adjustment method for precise directional ginger planting |
WO2021022970A1 (en) * | 2019-08-05 | 2021-02-11 | 青岛理工大学 | Multi-layer random forest-based part recognition method and system |
CN113011467A (en) * | 2021-02-25 | 2021-06-22 | 南京中医药大学 | Angelica sinensis medicinal material producing area identification method based on image structure texture information |
-
2022
- 2022-02-25 CN CN202210176964.6A patent/CN114580511B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105550660A (en) * | 2015-12-26 | 2016-05-04 | 河北工业大学 | Woven fabric weave structure type identification method |
CN109738391A (en) * | 2019-02-20 | 2019-05-10 | 南京中医药大学 | A method for evaluating the quality of dried ginger medicinal materials based on near-infrared spectroscopy |
WO2020233156A1 (en) * | 2019-05-22 | 2020-11-26 | 青岛理工大学 | Scaly bud recognition and adjustment method for precise directional ginger planting |
WO2021022970A1 (en) * | 2019-08-05 | 2021-02-11 | 青岛理工大学 | Multi-layer random forest-based part recognition method and system |
CN113011467A (en) * | 2021-02-25 | 2021-06-22 | 南京中医药大学 | Angelica sinensis medicinal material producing area identification method based on image structure texture information |
Non-Patent Citations (2)
Title |
---|
Sulfur-fumigated ginger identifaction via brightness information and voting mechanism;王天舒;Food Quality and Safety;20221130;第1-21页 * |
基于局部自适应色差阈值的彩色图像边缘检测;杨娴;电子与信息学报;20120930;第34卷(第9期);参见第2058-2063页 * |
Also Published As
Publication number | Publication date |
---|---|
CN114580511A (en) | 2022-06-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111523462B (en) | Video sequence expression recognition system and method based on self-attention enhanced CNN | |
CN111639558B (en) | Finger vein authentication method based on ArcFace Loss and improved residual error network | |
CN102567993B (en) | Fingerprint image quality evaluation method based on main component analysis | |
CN101593272B (en) | A Face Feature Location Method Based on ASM Algorithm | |
CN108875602A (en) | Monitor the face identification method based on deep learning under environment | |
CN110110650A (en) | Face identification method in pedestrian | |
CN106372581A (en) | Method for constructing and training human face identification feature extraction network | |
CN109711422A (en) | Image data processing, model establishment method, device, computer equipment and storage medium | |
CN115099297B (en) | Soybean plant phenotype data statistical method based on improved YOLO v5 model | |
CN109829924B (en) | Image quality evaluation method based on principal feature analysis | |
CN108830243A (en) | Hyperspectral image classification method based on capsule network | |
CN110032925A (en) | A kind of images of gestures segmentation and recognition methods based on improvement capsule network and algorithm | |
CN107808358A (en) | Image watermark automatic testing method | |
CN105069774B (en) | The Target Segmentation method of optimization is cut based on multi-instance learning and figure | |
CN114266740A (en) | Quality inspection method, device, equipment and storage medium for traditional Chinese medicine decoction pieces | |
CN109977887A (en) | A kind of face identification method of anti-age interference | |
CN113378609A (en) | Method and device for identifying agent signature | |
CN101398846A (en) | Image, semantic and concept detection method based on partial color space characteristic | |
Li et al. | Improve the two-phase test samples representation method for palmprint recognition | |
CN115862003A (en) | Lightweight YOLOv 5-based in-vivo apple target detection and classification method | |
CN117197804A (en) | A method for identifying tea geographical indication products | |
CN110287981B (en) | Significance detection method and system based on biological heuristic characterization learning | |
CN114580511B (en) | Sulfur-smoked dried ginger identification method based on image brightness information and voting mechanism | |
CN112001785A (en) | Network credit fraud identification method and system based on image identification | |
CN113011467B (en) | Method for identifying origin of angelica medicinal material based on image structure texture information |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |