An Angelica sinensis tablet detection device and method
The diffuse reflection spectral intensity is collected through the laser emitter and the optical fiber probe, combined with the data processing of the spectrometer and controller, and the SVM model is used to determine the authenticity. The Angelica film detection device realizes fast, lossless and accurate Angelica film authenticity detection, solving the problem of complex detection and low accuracy in the prior art.
Patent Information
- Application Number
- CN202310446979.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-20
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2043-04-20
AI Technical Summary
In the prior art, the authenticity detection process of angelica films is complicated, time-consuming and laborious, and the detection accuracy is not high, making it difficult to quickly, losslessly and accurately distinguish between authenticity and false angelica films.
An Angelica chip detection device is adopted, using a laser emitter to emit laser light with a wavelength of 650nm, and the diffuse reflection spectral intensity is collected through the optical fiber probe, combined with a spectrometer and controller for data processing, and the SVM model is used to determine the authenticity and falsehood. The Angelica chip discrimination model uses Manhattan distance and kernel function value to predict the detection results.
It realizes fast, lossless and accurate detection of the authenticity of Angelica films, simple operation, low detection cost, short detection time and high accuracy, reaching 95%.
Smart Images

Figure CN116465862B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of authenticity detection of medicinal materials, and particularly to a detection device and method for angelica slices. Background Art
[0002] Angelica plays a very important role in Chinese medicinal materials. It is one of the most commonly used traditional Chinese medicinal materials and has medical effects such as enriching blood and promoting blood circulation, regulating menstruation and relieving pain, and moistening the intestines and relieving constipation. In recent years, in order to seek benefits, some unscrupulous merchants use fake angelica slices that are easily confused in appearance, and even through some processing means, they sell fake angelica slices as genuine ones, which damages the rights and interests of consumers.
[0003] The traditional authenticity detection of angelica slices mainly relies on manual visual inspection, conventional machine classification technology, and chemical tests. The detection process is complex, time-consuming and laborious, and the detection accuracy is not high. Therefore, it is extremely urgent to explore a method for detecting genuine and fake angelica slices that is non-destructive, highly accurate, low-cost, fast, and easy to operate. Summary of the Invention
[0004] In order to solve the above technical problems, the present invention provides a detection device and method for angelica slices, which can quickly, non-destructively, and accurately detect the authenticity of angelica slices.
[0005] In order to solve the above problems, the present invention adopts the following technical solutions to achieve:
[0006] A detection device for angelica slices of the present invention includes a control module, a detection module, and a light-shielding cover. The detection module is arranged inside the light-shielding cover. The detection module includes a base, on which a detection platform and a bracket are provided. On the bracket, a photosensitive fiber probe and a lifting mechanism for driving the photosensitive fiber probe to lift and lower are provided. On the bracket, a horizontally arranged guide rail is further provided. On the guide rail, a slider and a driving mechanism for driving the slider to move along the guide rail are provided. On the slider, a laser emitter and an adjustment module for adjusting the emission angle of the laser emitter are provided. The control module includes a controller, a laser driver, and a spectrometer. The laser emitter is electrically connected to the laser driver, the photosensitive fiber probe is electrically connected to the spectrometer, and the controller is electrically connected to the lifting mechanism, the driving mechanism, the adjustment module, the laser driver, and the spectrometer respectively.
[0007] In this solution, the to-be-detected angelica slice is placed on the detection platform, so that the to-be-detected angelica slice is directly below the photosensitive fiber probe. The lifting mechanism drives the photosensitive fiber probe to move to a position 2 mm above the to-be-detected angelica slice. The point on the to-be-detected angelica slice directly below the photosensitive fiber probe is the sampling point. The position of the slider and the emission angle of the laser emitter are adjusted so that the distance between the laser incident point on the to-be-detected angelica slice and the sampling point is less than 0.6 cm. The detection module is covered with the light-shielding cover to prevent the interference of ambient light.
[0008] The laser emitter emits laser with a wavelength of 650 nm and an initial spectral intensity of 8000 counts onto the surface of the Angelica sinensis slice to be measured. The diffuse reflection light with a wavelength of 650 nm generated after the laser with the initial spectral intensity irradiates the Angelica sinensis slice to be measured is collected by the photosensitive fiber probe of the spectrometer. Then, the laser emitted by the laser emitter increases in steps of 1000 counts in intensity. Each time the laser emitted by the laser emitter increases by 1000 counts, the photosensitive fiber probe of the spectrometer collects the current diffuse reflection light once. The laser increases in intensity n times starting from the initial spectral intensity. Therefore, the photosensitive fiber probe sequentially collects the spectral intensities of n + 1 diffuse reflection lights, and these n + 1 spectral intensities of the diffuse reflection lights are sent to the controller as one detection data set. Repeat the above steps to obtain m detection data sets, and the controller processes these m detection data sets and outputs the result of whether the Angelica sinensis slice to be measured is genuine or fake.
[0009] Preferably, the guide rail is located above the photosensitive fiber probe.
[0010] Preferably, an inductor for detecting whether there is an Angelica sinensis slice is provided on the detection platform. The inductor can be a proximity switch.
[0011] A method for detecting Angelica sinensis slices of the present invention, which is used for the above-mentioned device for detecting Angelica sinensis slices, includes the following steps:
[0012] S1: Place the Angelica sinensis slice to be measured on the detection platform so that the Angelica sinensis slice to be measured is directly below the photosensitive fiber probe. The lifting mechanism drives the photosensitive fiber probe to move 2 mm above the Angelica sinensis slice to be measured. The point on the Angelica sinensis slice to be measured directly below the photosensitive fiber probe is the sampling point. Adjust the position of the slider and the emission angle of the laser emitter so that the distance between the laser incidence point on the Angelica sinensis slice to be measured and the sampling point is less than 0.6 cm, and the light-shielding cover covers the detection module;
[0013] S2: The laser emitter emits laser with a wavelength of 650 mm onto the Angelica sinensis slice to be measured, and the diffuse reflection light with a wavelength of 650 nm generated after the laser irradiates the Angelica sinensis slice to be measured is collected by the photosensitive fiber probe of the spectrometer inside the light-shielding cover;
[0014] S3: The laser emitter emits laser with a wavelength of 650 nm and increases in intensity n times starting from the initial spectral intensity. Each time the increased intensity is 1000 counts. The diffuse reflection light with a wavelength of 650 nm generated after the laser with the initial spectral intensity and the laser after each intensity increase irradiates the Angelica sinensis slice to be measured is collected by the photosensitive fiber probe of the spectrometer. The photosensitive fiber probe sequentially collects the spectral intensities of n + 1 diffuse reflection lights, and these n + 1 spectral intensities of the diffuse reflection lights are sent to the controller as one detection data set;
[0015] S4: Repeat step S2 m times, and the controller obtains m detection data sets;
[0016] S5: The controller inputs the m detection data groups into the angelica slice discrimination model. The angelica slice discrimination model processes the input m detection data groups and outputs a detection result of whether the angelica slice to be tested is a genuine angelica slice.
[0017] Preferably, in step S5, the method for the angelica slice discrimination model to process the input m test data groups and output a test result of whether the angelica slice to be tested is a genuine angelica slice is as follows:
[0018] The angelica slice discrimination model processes each input test data group and determines the test result corresponding to each test data group. If the number of test data groups with true test results is greater than the number of test data groups with false test results, the angelica slice discrimination model outputs the test result that the angelica slice to be tested is a true angelica slice; if the number of test data groups with true test results is less than or equal to the number of test data groups with false test results, the angelica slice discrimination model outputs the test result that the angelica slice to be tested is a false angelica slice.
[0019] Preferably, the Angelicae Sinensis slice discrimination model processes each test data group and determines the test result corresponding to each test data group in the following manner:
[0020] M1: Number the m detection data groups as 1, 2, ..., m, and the detection data group numbered i is X i ={x i1 、x i2 、x i3 …x i(n+1)}, 1≤i≤m, n≥3, optimize each detection data group to obtain the corresponding optimized data group, the detection data group numbered i is X i The corresponding optimized data set is Y i ={y i1 、y i2 …y i(n-1)},
[0021]
[0022] Among them, 1≤j≤n-1, x ij is the detection data set X numbered i i The jth data in y ij To optimize the data set Y i The jth data in ;
[0023] M2: Determine the test results corresponding to each test data group;
[0024] Determine the detection data group X numbered i iThe method for the corresponding detection results is as follows:
[0025] Calculate the detection data group X numbered i i The corresponding optimized data group Y i The Manhattan distance between each reference data group in the reference set stored in the Angelica tablet discrimination model, sort the reference data groups in ascending order of distance, and take the first k reference data groups as the support data groups. The k support data groups are denoted as Z1, Z2...Z k , calculate the detection data group X numbered i i The corresponding predicted value f(X i ), if f(X i ) = 1, then the detection result corresponding to the detection data group X numbered i i is true. If f(X i ) = -1, then the detection result corresponding to the detection data group X numbered i i is false;
[0026] The formula for the predicted value f(X i ) is as follows:
[0027]
[0028] K(Y i , Z r ) = exp(-gamma × M(Y i , Z r ), 2 ),
[0029] where 1 ≤ r ≤ k, α r is the Lagrange multiplier of the support data group Z r , K(Y i , Z r ) represents the kernel function value between the optimized data group Y i and the support data group Z r , gamma is the kernel function coefficient, M(Y i , Z r ) is the Manhattan distance between the optimized data group Y i and the support data group Z r , b is the bias value, β r is the class label value corresponding to the support data group Z r . If the Angelica tablet category corresponding to the support data group Z r is true, then β r = 1; if the Angelica tablet category corresponding to the support data group Z r is false, then β r = -1.
[0030] Preferably, the angelica slice discrimination model is obtained by the following method:
[0031] N1: Select d angelica slice samples, where the d angelica slice samples include d / 2 true angelica slice samples and d / 2 false angelica slice samples. Detect each angelica slice sample respectively to obtain m detection data groups corresponding to each angelica slice sample;
[0032] Perform optimization processing on each detection data group to obtain an optimized data group corresponding to each detection data group, and a total of d*m optimized data groups are obtained. Use the d*m optimized data groups as a reference set of the angelica slice discrimination model composed of d*m reference data groups;
[0033] N2: Establish and initialize the SVM model;
[0034] N3: Establish the following optimization equation:
[0035]
[0036] K(E P , E q ) = exp(-gamma × M(E P , E q )) 2 ),
[0037] 1 ≤ p ≤ d*m,
[0038] 1 ≤ q ≤ d*m,
[0039] The optimization equation satisfies the following constraint conditions:
[0040]
[0041] 0 ≤ α p ≤ D,
[0042] where, E p represents the p-th reference data group, E q represents the q-th reference data group, K(E P , E q ) represents the kernel function value between the reference data group E p and the reference data group E q , M(E P , E q ) represents the Manhattan distance between the reference data group E p and the reference data group E q , gamma is the kernel function coefficient, D is the coefficient, α p is the Lagrange multiplier of the reference data group E p , α q is the Lagrange multiplier of the reference data group E qThe Lagrange multiplier, β p is the reference data set E p The corresponding class label value, β q is the reference data set β q The corresponding class label value;
[0043] If the reference data set E p The corresponding angelica tablet class is true, then β p = 1; If the reference data set E p The corresponding angelica tablet class is false, then β p = -1;
[0044] If the reference data set E q The corresponding angelica tablet class is true, then β q = 1; If the reference data set E q The corresponding angelica tablet class is false, then β q = -1;
[0045] N4: Solve the optimization equation to obtain the optimal solutions of α1, α2…α d*m ;
[0046] N5: Calculate the bias value b of the SVM model;
[0047] N6: Calculate the predicted value G corresponding to each reference data set, and calculate the discrimination accuracy H of the angelica tablet discrimination model according to the predicted value G corresponding to each reference data set;
[0048] N7: Continuously adjust the value of the kernel function coefficient gamma. Each time the value of the kernel function coefficient gamma is adjusted, execute steps N2 to N6 once to obtain the discrimination accuracy H corresponding to each value of the kernel function coefficient gamma. Take the value of the kernel function coefficient gamma with the maximum discrimination accuracy H as the value of the kernel function coefficient gamma in the SVM model;
[0049] In the step N6, the method for calculating the predicted value G corresponding to the p-th reference data set E p is as follows: p Calculate the distance between the p-th reference data set E
[0050] and other reference data sets. Sort the other reference data sets in ascending order of distance, and take the first k reference data sets as the support data sets. The k support data sets are denoted as Z1, Z2…Z p , calculate the predicted value G k corresponding to the p-th reference data set E p , if G p = 1, then the predicted result corresponding to the p-th reference data set E p is true, if G p = -1, then the predicted result corresponding to the p-th reference data set Ep = -1, then the p-th reference data group E p The corresponding prediction result is false;
[0051]
[0052] K(E p , Z r ) = exp(-gamma × M(E p , Z r )) 2 ),
[0053] where 1 ≤ r ≤ k, α r is the Lagrange multiplier of the support data group Z r , K(E p , Z r ) represents the kernel function value between the reference data group E p and the support data group Z r , gamma is the kernel function coefficient, M(E p , Z r ) is the Manhattan distance between the reference data group E p and the support data group Z r , β r is the class label value corresponding to the support data group Z r . If the angelica slice class corresponding to the support data group Z r is true, then β r = 1; if the angelica slice class corresponding to the support data group Z r is false, then β r = -1.
[0054] Preferably, the formula for calculating the bias value b of the SVM model in step N5 is as follows:
[0055]
[0056] Preferably, the method for calculating the discrimination accuracy H of the angelica slice discrimination model according to the prediction value G corresponding to each reference data group in step N6 is as follows:
[0057] If the prediction value G corresponding to a certain reference data group = 1, it means that the predicted angelica slice class corresponding to this reference data group is true; if the prediction value G corresponding to a certain reference data group = -1, it means that the predicted angelica slice class corresponding to this reference data group is false;
[0058] Count the number F of reference data groups where the predicted angelica slice class is consistent with the actual angelica slice class, and calculate the discrimination accuracy H, H = F / d * m.
[0059] Preferably, the coefficient D in step N3 is obtained by the following method:
[0060] Calculate the kernel function values between each reference data group and every other reference data group, and take the maximum kernel function value as the value of the coefficient D.
[0061] Preferably, the method for optimizing the p-th detection data group in step N1 to obtain the optimized data group corresponding to the p-th detection data group is as follows: Denote the p-th detection data as X p ={x p1 , x p2 , x p3 …x p(n+1)}, optimize the p-th detection data group X p to obtain the corresponding optimized data group Y p ={y p1 , y p2 …y p(n-1)},
[0062]
[0063] where 1≤j≤n - 1, x pj is the j-th data in the p-th detection data group X p , and y pj is the j-th data in the optimized data group Y p .
[0064] The beneficial effects of the present invention are: It can quickly, non-destructively and accurately detect the authenticity of angelica tablets, with simple operation and low detection cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 is a schematic structural diagram of an embodiment.
[0066] In the figure: 1, light-shielding cover; 2, base; 3, detection platform; 4, bracket; 5, photosensitive fiber probe; 6, lifting mechanism; 7, guide rail; 8, slider; 9, driving mechanism; 10, laser emitter; 11, adjustment module. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0067] The technical solution of the present invention will be further specifically described below through embodiments and in combination with the drawings.
[0068] Embodiment: An angelica tablet detection device in this embodiment is as Figure 1As shown in the figure, it includes a control module, a detection module, and a light-shielding cover 1. The detection module is arranged inside the light-shielding cover 1. The detection module includes a base 2. On the base 2, there is a detection platform 3 and a bracket 4. On the bracket 4, there is a photosensitive fiber probe 5 and a lifting mechanism 6 for driving the photosensitive fiber probe 5 to lift and lower. On the bracket 4, there is also a horizontally arranged guide rail 7. The guide rail 7 is located above the photosensitive fiber probe 5. On the guide rail 7, there is a slider 8 and a driving mechanism for driving the slider 8 to move along the guide rail 7. On the slider 8, there is a laser emitter 10 and an adjustment module 11 for adjusting the emission angle of the laser emitter 10. The control module includes a controller, a laser driver, and a spectrometer. The laser emitter 10 is electrically connected to the laser driver. The photosensitive fiber probe 5 is electrically connected to the spectrometer. The controller is electrically connected to the lifting mechanism 6, the driving mechanism 9, the adjustment module 11, the laser driver, and the spectrometer respectively.
[0069] In this solution, the to-be-detected angelica slices are placed on the detection platform, so that the to-be-detected angelica slices are directly below the photosensitive fiber probe. The lifting mechanism drives the photosensitive fiber probe to move to a position 2 mm above the to-be-detected angelica slices. The point on the to-be-detected angelica slices directly below the photosensitive fiber probe is the sampling point. The position of the slider and the emission angle of the laser emitter are adjusted so that the distance between the laser incident point on the to-be-detected angelica slices and the sampling point is less than 0.6 cm. The detection module is covered with a light-shielding cover to prevent the interference of ambient light.
[0070] The laser emitter emits a laser with a wavelength of 650 nm and an initial spectral intensity of 8000 counts to the surface of the to-be-detected angelica slices. The diffuse reflection light with a wavelength of 650 nm generated after the laser with the initial spectral intensity irradiates the to-be-detected angelica slices is collected by the photosensitive fiber probe of the spectrometer. Then, the laser emitted by the laser emitter increases in steps of 1000 counts in intensity. Each time the laser emitted by the laser emitter increases by 1000 counts, the photosensitive fiber probe of the spectrometer collects the current diffuse reflection light once. The laser increases by n times starting from the initial spectral intensity. Therefore, the photosensitive fiber probe sequentially collects the spectral intensities of n + 1 diffuse reflection lights. These n + 1 spectral intensities of the diffuse reflection lights are sent to the controller as one detection data set. Repeat the above steps to obtain m detection data sets. The controller processes these m detection data sets and outputs the result of whether the to-be-detected angelica slices are genuine or fake.
[0071] There is a sensor on the detection platform for detecting whether there are angelica slices. The sensor can be a proximity switch.
[0072] A method for detecting angelica slices in this embodiment, which is used for the above-mentioned device for detecting angelica slices, includes the following steps:
[0073] S1: Place the Angelica sinensis slices to be tested on the detection platform, making the Angelica sinensis slices to be tested directly below the photosensitive fiber probe. The lifting mechanism drives the photosensitive fiber probe to move 2 mm above the Angelica sinensis slices to be tested. The point on the Angelica sinensis slices to be tested directly below the photosensitive fiber probe is the sampling point. Adjust the position of the slider and the emission angle of the laser emitter so that the distance between the laser incident point on the Angelica sinensis slices to be tested and the sampling point is less than 0.6 cm. The light-shielding cover covers the detection module;
[0074] S2: The laser emitter emits a laser with a wavelength of 650 mm to the Angelica sinensis slices to be tested. The diffuse reflection light with a wavelength of 650 nm generated after the laser irradiates the Angelica sinensis slices to be tested is collected by the photosensitive fiber probe of the spectrometer inside the light-shielding cover;
[0075] S3: The laser emitter emits a laser with a wavelength of 650 nm and increases it n times starting from the initial spectral intensity. The intensity increased each time is 1000 counts. The diffuse reflection light with a wavelength of 650 nm generated after the initial spectral intensity laser and the laser after each intensity increase irradiate the Angelica sinensis slices to be tested is collected by the photosensitive fiber probe of the spectrometer. The photosensitive fiber probe sequentially collects the spectral intensities of n + 1 diffuse reflection lights, and takes these n + 1 spectral intensities of the diffuse reflection lights as 1 detection data group and sends it to the controller;
[0076] S4: Repeat step S2 m times, and the controller obtains m detection data groups;
[0077] S5: The controller inputs the m detection data groups into the Angelica sinensis slices discrimination model. The Angelica sinensis slices discrimination model processes the input m detection data groups and outputs the detection result of whether the Angelica sinensis slices to be tested are genuine Angelica sinensis slices.
[0078] The method for the Angelica sinensis slices discrimination model to process the input m detection data groups and output the detection result of whether the Angelica sinensis slices to be tested are genuine Angelica sinensis slices in step S5 is as follows:
[0079] The Angelica sinensis slices discrimination model processes each input detection data group and judges the detection result corresponding to each detection data group. If the number of detection data groups with a true detection result is greater than the number of detection data groups with a false detection result, the Angelica sinensis slices discrimination model outputs the detection result that the Angelica sinensis slices to be tested are genuine Angelica sinensis slices; if the number of detection data groups with a true detection result is less than or equal to the number of detection data groups with a false detection result, the Angelica sinensis slices discrimination model outputs the detection result that the Angelica sinensis slices to be tested are fake Angelica sinensis slices.
[0080] The method for the Angelica sinensis slices discrimination model to process each detection data group and judge the detection result corresponding to each detection data group is as follows:
[0081] M1: Number the m detection data groups sequentially as 1, 2... m. The detection data group numbered i is Xi = {x i1 , x i2 , x i3 … x i(n+1)}, 1 ≤ i ≤ m, n ≥ 3. For each detection data group, perform optimization processing to obtain the corresponding optimized data group. The detection data group numbered i is X i The corresponding optimized data group is Y i = {y i1 , y i2 … y i(n-1)},
[0082]
[0083] where 1 ≤ j ≤ n - 1, x ij is the j-th data in the detection data group X i numbered i, and y ij is the j-th data in the optimized data group Y i ;
[0084] M2: Judge the detection result corresponding to each detection data group;
[0085] The method for judging the detection result of the detection data group X i numbered i is as follows:
[0086] Calculate the Manhattan distance between the corresponding optimized data group Y i of the detection data group X i numbered i and each reference data group in the reference set stored in the Angelica tablet discrimination model. Sort the reference data groups in ascending order of distance, and take the first k reference data groups as the support data groups. The k support data groups are denoted as Z1, Z2… Z k , calculate the predicted value f(X i ) of the detection data group X i numbered i. If f(X i ) = 1, then the detection result corresponding to the detection data group X i numbered i is true. If f(X i ) = -1, then the detection result corresponding to the detection data group X i numbered i is false;
[0087] The formula for the predicted value f(X i ) is as follows:
[0088]
[0089] K(Y i , Z r ) = exp(-gamma × M(Y i , Zr ) 2 ),
[0090] where \(1\leq r\leq k\), \(\alpha\) r is the Lagrange multiplier for the support data set \(Z\) r , \(K(Y\) i , \(Z\) r ) represents the kernel function value between the optimized data set \(Y\) i and the support data set \(Z\) r , \(\gamma\) is the kernel function coefficient, \(M(Y\) i , \(Z\) r ) is the Manhattan distance between the optimized data set \(Y\) i and the support data set \(Z\) r , \(b\) is the bias value, \(\beta\) r is the class label value corresponding to the support data set \(Z\) r . If the angelica slice class corresponding to the support data set \(Z\) r is true, then \(\beta\) r = 1; if the angelica slice class corresponding to the support data set \(Z\) r is false, then \(\beta\) r = -1.
[0091] The angelica slice discrimination model is obtained by the following method:
[0092] N1: Select \(d\) angelica slice samples, where the \(d\) angelica slice samples include \(d / 2\) true angelica slice samples and \(d / 2\) false angelica slice samples. Detect each angelica slice sample to obtain \(m\) detection data sets corresponding to each angelica slice sample;
[0093] Perform optimization processing on each detection data set to obtain an optimized data set corresponding to each detection data set, obtaining a total of \(d\times m\) optimized data sets. Use the \(d\times m\) optimized data sets as a reference set of \(d\times m\) reference data sets to form the reference set of the angelica slice discrimination model;
[0094] N2: Establish and initialize the SVM model;
[0095] N3: Establish the following optimization equation:
[0096]
[0097] K(E P , E q ) = exp(-gamma × M(E P , E q ) 2 ),
[0098] where \(1\leq p\leq d\times m\),
[0099] where \(1\leq q\leq d\times m\),
[0100] The optimized equation satisfies the following constraints:
[0101]
[0102] 0 ≤ α p ≤ D,
[0103] where E p represents the p-th reference data group, E q represents the q-th reference data group, K(E P , E q ) represents the kernel function value between the reference data group E p and the reference data group E q , M(E P , E q ) represents the Manhattan distance between the reference data group E p and the reference data group E q , gamma is the kernel function coefficient, D is the coefficient, α p is the Lagrange multiplier of the reference data group E p , α q is the Lagrange multiplier of the reference data group E q , β p is the class label value corresponding to the reference data group E p , β q is the class label value corresponding to the reference data group E q ;
[0104] If the angelica slice class corresponding to the reference data group E p is true, then β p = 1; if the angelica slice class corresponding to the reference data group E p is false, then β p = -1;
[0105] If the angelica slice class corresponding to the reference data group E q is true, then β q = 1; if the angelica slice class corresponding to the reference data group E q is false, then β q = -1;
[0106] N4: Solve the optimized equation to obtain the optimal solutions of α1, α2... α d*m ;
[0107] N5: Calculate the bias value b of the SVM model;
[0108] N6: Calculate the predicted value G corresponding to each reference data group, and calculate the discrimination accuracy H of the angelica slice discrimination model based on the predicted value G corresponding to each reference data group;
[0109] N7: Continuously adjust the value of the kernel function coefficient gamma. Each time the value of the kernel function coefficient gamma is adjusted, execute steps N2 to N6 once to obtain the discrimination accuracy rate H corresponding to each value of the kernel function coefficient gamma. Take the value of the kernel function coefficient gamma corresponding to the maximum discrimination accuracy rate H as the value of the kernel function coefficient gamma in the SVM model.
[0110] The formula for calculating the bias value b of the SVM model in step N5 is as follows:
[0111]
[0112] In step N6, the method for calculating the predicted value G p corresponding to the p-th reference data group E p is as follows:
[0113] Calculate the distance between the p-th reference data group E p and other reference data groups. Sort the other reference data groups in ascending order of distance, and take the first k reference data groups as the support data groups. The k support data groups are denoted as Z1, Z2... Z k , and calculate the predicted value G p corresponding to the p-th reference data group E p . If G p = 1, then the prediction result corresponding to the p-th reference data group E p is true. If G p = -1, then the prediction result corresponding to the p-th reference data group E p is false;
[0114]
[0115] K(E p , Z r ) = exp(-gamma × M(E p , Z r )) 2 ),
[0116] where 1 ≤ r ≤ k, α r is the Lagrange multiplier of the support data group Z r . K(E p , Z r ) represents the kernel function value between the reference data group E p and the support data group Z r . gamma is the kernel function coefficient, and M(E p , Z r ) is the Manhattan distance between the reference data group E p and the support data group Z r . βr To support data group Z r The corresponding category label value. If data group Z is supported r The corresponding angelica tablet category is true, then β r = 1; If data group Z is supported r The corresponding angelica tablet category is false, then β r = -1.
[0117] The method for calculating the discrimination accuracy H of the angelica tablet discrimination model according to the predicted value G corresponding to each reference data group in step N6 is as follows:
[0118] If the predicted value G corresponding to a certain reference data group = 1, it means that the predicted angelica tablet category corresponding to this reference data group is true; if the predicted value G corresponding to a certain reference data group = -1, it means that the predicted angelica tablet category corresponding to this reference data group is false;
[0119] Count the number F of reference data groups where the predicted angelica tablet category is consistent with the actual angelica tablet category, and calculate the discrimination accuracy H, H = F / d*m.
[0120] The coefficient D in step N3 is obtained by the following method:
[0121] Calculate the kernel function values between each reference data group and every other reference data group, and take the largest kernel function value as the value of the coefficient D.
[0122] In step N1, the method for optimizing the p-th detection data group to obtain the corresponding optimized data group of the p-th detection data group is as follows: Denote the p-th detection data as X p = {x p1 , x p2 , x p3 …x p(n+1 )}, optimize the p-th detection data group X p to obtain the corresponding optimized data group Y p = {y p1 , y p2 …y p(n-1 )},
[0123]
[0124] where 1 ≤ j ≤ n - 1, x pj is the j-th data in the p-th detection data group X p , and y pj is the j-th data in the optimized data group Y p .
[0125] Preferably, the method for detecting the angelica tablet sample in step N1 to obtain m detection data groups corresponding to the angelica tablet sample is as follows:
[0126] F1: Place the angelica tablet sample on the detection platform so that the angelica tablet sample is directly below the photosensitive fiber probe. The lifting mechanism drives the photosensitive fiber probe to move 2 mm above the angelica tablet sample. The point on the angelica tablet sample directly below the photosensitive fiber probe is the sampling point. Adjust the position of the slider and the emission angle of the laser emitter so that the distance between the laser incident point on the angelica tablet sample and the sampling point is less than 0.6 cm. The light-shielding cover covers the detection module;
[0127] F2: The laser emitter emits a laser with a wavelength of 650 mm to the angelica tablet sample. The diffuse reflection light with a wavelength of 650 nm generated after the laser irradiates the angelica tablet sample is collected by the photosensitive fiber probe of the spectrometer in the light-shielding cover;
[0128] F3: The laser emitter emits a laser with a wavelength of 650 nm and increases the intensity n times starting from the initial spectral intensity. The intensity increased each time is 1000 counts. The diffuse reflection light with a wavelength of 650 nm generated after the initial spectral intensity laser and the laser with increased intensity each time irradiate the angelica tablet sample are both collected by the photosensitive fiber probe of the spectrometer. The photosensitive fiber probe sequentially collects the spectral intensities of n + 1 diffuse reflection lights and sends these n + 1 spectral intensities of the diffuse reflection lights as 1 detection data group to the controller;
[0129] F4: Repeat step S2 m times, and the controller obtains m detection data groups.
[0130] In this solution, the light-shielding cover creates a dark environment to prevent external light sources from interfering with the experimental environment. This method uses a single-wavelength laser as the light source, controls the light intensity, excites the relaxation characteristics of the internal chemical functional groups of the angelica tablet, collects the diffuse reflection light of the angelica tablet sample, and establishes an angelica tablet discrimination model based on a spectral detection device and relaxation spectroscopy, greatly reducing the physical size and detection cost of the detection device and greatly improving the detection efficiency and accuracy.
[0131] Optimizing the detection data group can eliminate the data errors caused by external factors such as experimental operations. The detection time of this method can reach 1.006 s, and the accuracy can reach 95%.
Claims
1. A method for detecting angelica slices, for use in an angelica slice detection device, the angelica slice detection device comprising a control module, a detection module and a light shield (1), the detection module being arranged in the light shield (1), the detection module comprising a base (2), the base (2) being provided with a detection platform (3) and a bracket (4), the bracket (4) being provided with a photosensitive fiber probe (5) and a lifting mechanism (6) for driving the photosensitive fiber probe (5) to rise and fall, the bracket (4) being further provided with a horizontally arranged guide rail (7), the guide rail (7) being provided with a slider ( 8) and a driving mechanism for driving a slider (8) to move along a guide rail (7), wherein the slider (8) is provided with a laser emitter (10) and an adjustment module (11) for adjusting the emission angle of the laser emitter (10), the control module comprises a controller, a laser driver and a spectrometer, the laser emitter (10) is electrically connected to the laser driver, the photosensitive fiber probe (5) is electrically connected to the spectrometer, and the controller is electrically connected to the lifting mechanism (6), the driving mechanism (9), the adjustment module (11), the laser driver and the spectrometer respectively, characterized in that: The following steps are involved: S1: Place the angelica slice to be tested on the testing platform so that it is directly below the photosensitive fiber probe. The lifting mechanism drives the photosensitive fiber probe to move 2 mm above the angelica slice to be tested. The point on the angelica slice directly below the photosensitive fiber probe is the sampling point. Adjust the position of the slider and the emission angle of the laser transmitter so that the distance between the laser incident point and the sampling point is less than 0.6 cm. The light shield covers the detection module. S2: The laser transmitter emits a laser with a wavelength of 650nm to the angelica slices to be tested. The diffuse reflected light with a wavelength of 650nm generated by the laser irradiating the angelica slices to be tested is collected by the photosensitive fiber probe of the spectrometer in the light shield; S3: The laser emitter emits a laser with a wavelength of 650nm, which increases n times from the initial spectral intensity, with each increment of intensity being 1000 counts. The diffuse reflection light with a wavelength of 650nm generated by the laser with the initial spectral intensity and the laser after each intensity increment irradiates the angelica slice to be tested is collected by the photosensitive fiber probe of the spectrometer. The photosensitive fiber probe collects the spectral intensities of n+1 diffuse reflection lights in sequence and sends these spectral intensities of n+1 diffuse reflection lights as a detection data set to the controller; S4: Repeat step S2 m times, and the controller obtains m detection data sets; S5: The controller inputs the m test data groups into the Danggui slice discrimination model. The Danggui slice discrimination model processes the m input test data groups and outputs a test result of whether the Danggui slice to be tested is a genuine Danggui slice. In step S5, the method for the angelica slice discrimination model to process the input m test data groups and output a test result of whether the angelica slice to be tested is a genuine angelica slice is as follows: The angelica slice discrimination model processes each input test data group and determines the test result corresponding to each test data group. If the number of test data groups with true test results is greater than the number of test data groups with false test results, the angelica slice discrimination model outputs a test result that the angelica slice to be tested is a true angelica slice; if the number of test data groups with true test results is less than or equal to the number of test data groups with false test results, the angelica slice discrimination model outputs a test result that the angelica slice to be tested is a false angelica slice. The method for the Angelicae Sinensis slice discrimination model to process each test data group and determine the test result corresponding to each test data group is as follows: M1: Number the m detection data groups as 1, 2, ..., m, and the detection data group numbered i is X i ={x i1 、x i2 、x i3 …x i(n+1) }, 1≤i≤m, n≥3, optimize each detection data group to obtain the corresponding optimized data group, the detection data group numbered i is X i The corresponding optimized data set is Y i ={y i1 、y i2 …y i(n-1) }, Among them, 1≤j≤n-1, x ij is the detection data set X numbered i i The jth data in y ij To optimize the data set Y i The jth data in ; M2: Determine the test results corresponding to each test data group; Determine the detection data group X numbered i i The corresponding detection results are as follows: Calculate the detection data set X numbered i i The corresponding optimized data set Y i The Manhattan distance between each reference data set stored in the Danggui slices discrimination model is used to sort the reference data sets in ascending order of distance, and the first k reference data sets are taken as support data sets. The k support data sets are sequentially recorded as Z1, Z2, ...Z k , calculate the detection data group X numbered i i The corresponding predicted value f(X i ), if f(X i )=1, then the detection data group X numbered i i The corresponding test result is true if f(X i )=-1, then the detection data group X numbered i i The corresponding test result is false; Prediction value f(X i ) is as follows: K(Y i ,Z r )=exp(-gamma×M(Y i ,Z r ) 2 ), Among them, 1≤r≤k, α r To support data set Z r The Lagrange multiplier, K(Y i , Z r ) represents the optimized data set Y i With support data set Z r The kernel function value between, gamma is the kernel function coefficient, M(Y i , Z r ) is the optimized data set Y i With support data set Z r Manhattan distance, b is the bias value, β r To support data set Z r The corresponding category label value, if the data group Z is supported r The corresponding Danggui tablet category is true, then β r =1; if data group Z is supported r The corresponding Danggui tablet category is false, then β r =-1.
2. The method for detecting angelica slices according to claim 1, wherein: The guide rail (7) is located above the photosensitive fiber probe (5).
3. The method for detecting angelica slices according to claim 1, wherein: The detection platform (3) is provided with a sensor for detecting whether there are angelica slices.
4. The method for detecting angelica slices according to claim 1, wherein: The angelica slice discrimination model is obtained by the following method: N1: Select d angelica slice samples, including d / 2 genuine angelica slice samples and d / 2 fake angelica slice samples, and test each angelica slice sample to obtain m test data sets corresponding to each angelica slice sample; Optimize each test data group to obtain an optimized data group corresponding to each test data group, and obtain d*m optimized data groups in total. Use the d*m optimized data groups as d*m reference data groups to form a reference set of the Danggui tablets discrimination model; N2: Build and initialize the SVM model; N3: Establish the following optimization equation: K(E P ,E q )=exp(-gamma×M(E P ,E q ) 2 ), 1≤p≤d*m, 1≤q≤d*m, The optimization equation satisfies the following constraints: 0≤α p ≤D, Among them, E p represents the pth reference data set, E q represents the qth reference data set, K(E P , E q ) represents the reference data set E p With reference data set E q The kernel function value between M(E P , E q ) represents the reference data set E p With reference data set E q The Manhattan distance between them, gamma is the kernel function coefficient, D is the coefficient, α p Reference data set E p The Lagrange multiplier of α q Reference data set E q The Lagrange multiplier, β p Reference data set E p The corresponding category label value, β q Reference data set E q The corresponding category label value; If the reference data set E p The corresponding Danggui tablet category is true, then β p =1; if reference data set E p The corresponding Danggui tablet category is false, then β p =-1; If the reference data set E q The corresponding Danggui tablet category is true, then β q =1; if reference data set E q The corresponding Danggui tablet category is false, then β q =-1; N4: Solve the optimization equation to obtain α1, α2…α d*m The optimal solution of N5: Calculate the bias value b of the SVM model; N6: Calculate the prediction value G corresponding to each reference data group, and calculate the discrimination accuracy H of the Danggui tablets discrimination model based on the prediction value G corresponding to each reference data group; N7: Continuously adjust the value of the kernel function coefficient gamma. Each time the value of the kernel function coefficient gamma is adjusted, perform steps N2 to N6 to obtain the discrimination accuracy H corresponding to each value of the kernel function coefficient gamma. The kernel function coefficient gamma value with the largest discrimination accuracy H is used as the kernel function coefficient gamma value in the SVM model. In step N6, the pth reference data set E is calculated. p The corresponding predicted value G p The method is as follows: Calculate the pth reference data set E p The distance between the reference data groups is calculated by sorting the other reference data groups in ascending order of distance, and the first k reference data groups are taken as support data groups. The k support data groups are denoted as Z1, Z2, ...Z k , calculate the pth reference data set E p The corresponding predicted value G p , if G p =1, then the pth reference data set E p The corresponding prediction result is true if G p =-1, then the pth reference data set E p The corresponding prediction result is false; K(E p ,From r )=exp(-gamma×M(E p ,From r ) 2 ), Among them, 1≤r≤k, α r To support data set Z r The Lagrange multiplier, K(E p , Z r ) represents the reference data set E p With support data set Z r The kernel function value between, gamma is the kernel function coefficient, M(E p , Z r ) is the reference data set E p With support data set Z r Manhattan distance, β r To support data set Z r The corresponding category label value, if the data group Z is supported r The corresponding Danggui tablet category is true, then β r =1; if data group Z is supported r The corresponding Danggui tablet category is false, then β r =-1.
5. The method for detecting angelica slices according to claim 4, characterized in that: The formula for calculating the bias value b of the SVM model in step N5 is as follows:
6. The method for detecting angelica slices according to claim 4, characterized in that: The method for calculating the discrimination accuracy H of the Angelicae Sinensis slice discrimination model according to the prediction value G corresponding to each reference data group in step N6 is as follows: If the prediction value G corresponding to a certain reference data set is 1, it means that the predicted Danggui tablet category corresponding to the reference data set is true; if the prediction value G corresponding to a certain reference data set is -1, it means that the predicted Danggui tablet category corresponding to the reference data set is false; The number F of reference data sets whose predicted Danggui tablet categories are consistent with the actual Danggui tablet categories is counted, and the discrimination accuracy H is calculated, H=F / d*m.
7. The method for detecting angelica slices according to claim 4, characterized in that: The coefficient D in step N3 is obtained by the following method: Calculate the kernel function value between each reference data group and each other reference data group, and take the largest kernel function value as the value of coefficient D.
Citation Information
Patent Citations
White pear surface damage detection system and method
CN115656103A
Angelica sinensis tablet detection method
CN116448722A