Chinese herbal medicine disease identification method and system based on visual detection
Patent Information
- Application Number
- CN202610687201.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-19
- Publication Date
- 2026-08-11
AI Technical Summary
当局部出现强光照或阴影时,光照分量的变化幅度会掩盖病斑区域微弱的纹理细节变化,导致标准的卷积神经网络在空域中无法区分特征是由光照引起的还是由病害引起的,从而造成特征提取错误,引发病害识别错误
[0043] 1. This invention converts an image from a red-green-blue color space to a hue-saturation-brightness color space and extracts the luminance channel. It then uses a two-dimensional discrete Fourier transform to convert the luminance channel to the frequency domain. Low-frequency and high-frequency masks are used to separate the illumination component from the texture detail component. An inverse Fourier transform is performed on the high-frequency mask to obtain a de-illuminated texture map. This processing method separates illumination and texture in the frequency domain, ensuring that the image input to the subsequent convolutional neural network retains only pathological texture information. It eliminates the interference of the illumination component on lesion feature extraction and solves the feature confusion problem caused by uneven natural illumination.
Smart Images

Figure CN122551278A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and more specifically to a method and system for identifying diseases of traditional Chinese medicinal herbs based on visual detection. Background Technology
[0002] In the field of image recognition for diseases of traditional Chinese medicinal herbs, existing conventional methods typically involve directly acquiring images of the leaves of medicinal herbs within the red-green-blue color space. After adjusting the contrast using image enhancement algorithms, the images are input into a standard convolutional neural network (CNN) for feature extraction and classification. This standard CNN contains sequential convolutional and pooling layers, extracting spatial features such as edges and textures from the image through layer-by-layer stacking, and finally outputting the disease category through a fully connected layer. When processing images acquired in natural environments, conventional methods rely on the network itself to learn the patterns of light changes within the red-green-blue color space, adapting to different lighting conditions by increasing the diversity of training samples.
[0003] In natural field environments, the leaves of Chinese medicinal herbs exhibit uneven light exposure and localized shadowing. Because existing conventional methods extract features directly within the red-green-blue color space, the light component in the image is mixed with the leaf's texture details. When strong light or shadow occurs in certain areas, the variation in the light component can mask subtle texture details in the lesion area. This prevents standard convolutional neural networks from distinguishing whether features are caused by light or disease in the spatial domain, leading to feature extraction errors and subsequent disease identification errors. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for identifying diseases of traditional Chinese medicinal herbs based on visual detection, which can effectively solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] A visual detection-based method for identifying diseases of Chinese herbal medicines includes: acquiring an image of the Chinese herbal medicine to be identified, converting the image of the Chinese herbal medicine to be identified from the RGB color space to the HSV color space, and extracting the luminance channel in the HSV color space.
[0007] A two-dimensional discrete Fourier transform is performed on the brightness channel to obtain a spectrum map. A low-frequency mask and a high-frequency mask are constructed in the spectrum map. An inverse Fourier transform is performed on the high-frequency mask to obtain a de-illuminated texture map.
[0008] The de-illuminated texture map is input into a pre-constructed convolutional neural network, which includes a first branch and a second branch set in parallel. The multi-scale lesion contour features in the de-illuminated texture map are extracted through the multi-scale hollow spatial pyramid pooling module in the first branch, and the weighted texture direction features in the de-illuminated texture map are extracted through the texture direction attention module in the second branch.
[0009] The multi-scale lesion contour features and the weighted texture direction features are concatenated in the channel dimension. The concatenated features are then input into a fully connected layer, and the disease category corresponding to the Chinese herbal medicine image to be identified is output.
[0010] Preferably, constructing a low-frequency mask and a high-frequency mask in the spectrum diagram includes: calculating the amplitude value of each frequency point in the spectrum diagram, and sorting the amplitude values according to their numerical values;
[0011] The frequency points in the sorting results that represent the first preset proportion are taken as the low-frequency region, and the frequency points other than the low-frequency region are taken as the high-frequency region.
[0012] The low-frequency mask is generated by assigning a value of 1 to frequency points within the low-frequency region and a value of 0 to frequency points outside the low-frequency region.
[0013] The high-frequency mask is generated by assigning a value of 1 to frequency points within the high-frequency region and a value of 0 to frequency points outside the high-frequency region.
[0014] The high-frequency mask is multiplied by the spectrum to obtain the masked high-frequency spectrum. The masked high-frequency spectrum is then subjected to a two-dimensional discrete inverse Fourier transform to obtain the de-illuminated texture map.
[0015] Preferably, the multi-scale lesion contour features in the de-illuminated texture map are extracted by the multi-scale hollow spatial pyramid pooling module in the first branch, including: inputting the de-illuminated texture map into four hollow convolutional layers with different dilation rates connected in parallel in the multi-scale hollow spatial pyramid pooling module to obtain initial feature maps with four different receptive fields.
[0016] The initial feature maps of the four different receptive fields are concatenated along the channel dimension. The concatenated feature map is then input into a 1×1 convolutional layer for channel dimensionality reduction, and the dimensionality-reduced feature map is output.
[0017] Perform bilinear interpolation upsampling on the reduced-dimensional feature map to restore its spatial dimensions to those of the de-illuminated texture. Figure 1 Then, the upsampled dimensionality-reduced feature map is added element-wise to the light-removed texture map to obtain the multi-scale lesion contour features.
[0018] Preferably, the weighted texture direction features in the de-illuminated texture map are extracted by the texture direction attention module in the second branch, including: performing a convolution operation on the de-illuminated texture map using a preset Gabor filter bank, wherein the Gabor filter bank contains multiple Gabor kernel functions with different orientation angles, and outputs a multi-channel response map corresponding to the number of orientation angles;
[0019] Calculate the number of pixels in the response map of each channel whose absolute value is greater than a preset threshold, and divide the number of pixels by the total number of pixels in the response map to obtain the response ratio corresponding to each directional angle.
[0020] The response proportion is normalized and used as the weight coefficient of the corresponding channel. The weight coefficient is multiplied by the corresponding channel response map channel by channel. The multiplied multi-channel response maps are then stitched together to obtain the weighted texture direction feature.
[0021] Preferably, before inputting the concatenated features into the fully connected layer, the method further includes: inputting the concatenated features into the batch normalization layer for feature distribution alignment processing;
[0022] The features processed by the batch normalization layer are input into the modified linear unit activation function layer for nonlinear mapping.
[0023] The features after nonlinear mapping are input into a global average pooling layer, which compresses the spatial dimension of the nonlinearly mapped features into a 1×1 feature vector.
[0024] The feature vector is flattened into a one-dimensional vector, and the one-dimensional vector is input into the fully connected layer. The number of output nodes of the fully connected layer is the same as the preset total number of Chinese herbal medicine disease categories.
[0025] Preferably, after acquiring the image of the Chinese herbal medicine to be identified, and before converting the image of the Chinese herbal medicine to be identified from the RGB color space to the HSV color space, the method further includes: inputting the image of the Chinese herbal medicine to be identified into a Gaussian filter for smoothing and denoising processing to obtain a filtered image;
[0026] The filtered image is cropped at the edges to remove the edge regions in the filtered image whose pixel values are constant at a set value, thus obtaining a cropped image.
[0027] The cropped image is scaled according to a preset fixed size;
[0028] Divide the pixel value of each pixel in the scaled cropped image by a set value, and map the range of pixel values to a preset interval to obtain a preprocessed Chinese herbal medicine image. Use the preprocessed Chinese herbal medicine image as the input image for performing color space conversion.
[0029] Preferably, the step of using the first preset proportion of frequency points in the sorting results as the low-frequency region includes: calculating the coordinates of the center point of the spectrum diagram, and calculating the Euclidean distance from the coordinates of each frequency point in the spectrum diagram to the coordinates of the center point.
[0030] Using the Euclidean distance as the horizontal axis and the sum of the amplitude values at the frequency points corresponding to the Euclidean distance as the vertical axis, a distance-amplitude distribution curve is generated.
[0031] Calculate the slope value of the distance-amplitude distribution curve at each distance point, and take the distance point where the slope value is first less than a set slope threshold as the cutoff distance;
[0032] Frequency points in the spectrum whose Euclidean distance is less than the cutoff distance are classified as low-frequency regions, and frequency points whose Euclidean distance is greater than or equal to the cutoff distance are classified as high-frequency regions.
[0033] Preferably, the Gabor filter bank includes multiple Gabor kernel functions with different orientation angles, including: dividing the angle range from 0 degrees to 180 degrees into sub-intervals equal to the number of Gabor kernel functions, and using the median value of each sub-interval as the orientation angle of the corresponding Gabor kernel function;
[0034] The wavelength parameters of each Gabor kernel function are all set to the same first preset pixel value, the spatial aspect ratio parameters of each Gabor kernel function are all set to the same second preset value, and the phase offset parameters of each Gabor kernel function are all set to the same third preset value.
[0035] During the convolution operation of the de-illuminated texture map using the Gabor filter bank, a reflection filling strategy is used to expand the boundary of the edge region of the de-illuminated texture map according to the size of the Gabor kernel function.
[0036] Preferably, the four dilated convolutional layers with different expansion rates connected in parallel in the multi-scale dilated spatial pyramid pooling module include: the first dilated convolutional layer with an expansion rate of 1 and a kernel size of 1×1, the second dilated convolutional layer with an expansion rate of a first set value and a kernel size of 3×3, the third dilated convolutional layer with an expansion rate of a second set value and a kernel size of 3×3, and the fourth dilated convolutional layer with an expansion rate of a third set value and a kernel size of 3×3, wherein the first set value, the second set value, and the third set value increase in a geometric progression.
[0037] The number of input and output channels of the four dilated convolutional layers with different dilation rates are kept consistent, and all dilated convolutional layers use the same padding parameters to maintain the spatial size of the feature map.
[0038] A visual detection-based system for identifying diseases of Chinese herbal medicines includes an image acquisition device, a feature processing device, and a classification device. The image acquisition device is communicatively connected to the feature processing device, and the feature processing device is communicatively connected to the classification device.
[0039] The image acquisition device is used to acquire images of Chinese herbal medicines to be identified, convert the images of Chinese herbal medicines to be identified from RGB color space to HSV color space, extract the luminance channel in the HSV color space, perform a two-dimensional discrete Fourier transform on the luminance channel to obtain a spectrum map, construct a low-frequency mask and a high-frequency mask in the spectrum map, and perform an inverse Fourier transform on the high-frequency mask to obtain a de-illuminated texture map.
[0040] The feature processing device is used to input the de-illuminated texture map into a pre-constructed convolutional neural network. The convolutional neural network includes a first branch and a second branch set in parallel. The multi-scale lesion contour features in the de-illuminated texture map are extracted by the multi-scale hollow spatial pyramid pooling module in the first branch, and the weighted texture direction features in the de-illuminated texture map are extracted by the texture direction attention module in the second branch.
[0041] The classification device is used to concatenate the multi-scale lesion contour features and the weighted texture direction features in the channel dimension, input the concatenated features into a fully connected layer, and output the disease category corresponding to the Chinese herbal medicine image to be identified.
[0042] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0043] 1. This invention converts an image from a red-green-blue color space to a hue-saturation-brightness color space and extracts the luminance channel. It then uses a two-dimensional discrete Fourier transform to convert the luminance channel to the frequency domain. Low-frequency and high-frequency masks are used to separate the illumination component from the texture detail component. An inverse Fourier transform is performed on the high-frequency mask to obtain a de-illuminated texture map. This processing method separates illumination and texture in the frequency domain, ensuring that the image input to the subsequent convolutional neural network retains only pathological texture information. It eliminates the interference of the illumination component on lesion feature extraction and solves the feature confusion problem caused by uneven natural illumination.
[0044] 2. This invention employs a parallel dual-branch structure within a convolutional neural network. The first branch extracts multi-scale lesion contour features through convolutional layers with varying dilation rates in a multi-scale hollow spatial pyramid pooling module, adapting to the size differences of various lesion patches. The second branch extracts response maps at different directional angles through a Gabor filter bank in a texture orientation attention module, using the response proportion as a weighting coefficient to highlight the unique microscopic texture orientation features of Chinese herbal medicine lesions. The dual-branch features are concatenated along the channel dimension and input into a fully connected layer, combining macroscopic multi-scale contours with microscopic directional textures, overcoming the misjudgment problem when different diseases have similar macroscopic appearances. Attached Figure Description
[0045] Figure 1 This is a flowchart of the overall method for identifying diseases of traditional Chinese medicinal herbs based on visual detection according to the present invention;
[0046] Figure 2 This is a flowchart of the image preprocessing and frequency domain mask construction of traditional Chinese medicine in this invention;
[0047] Figure 3 This is a flowchart of the feature extraction process for the multi-scale void space pyramid pooling module of the present invention;
[0048] Figure 4 This is a flowchart of the feature extraction process for the texture direction attention module of the present invention;
[0049] Figure 5 This is a flowchart of the feature post-processing and fully connected layer classification of the present invention;
[0050] Figure 6 This is a flowchart illustrating the architecture of the visual detection-based herbal disease identification system of the present invention. Detailed Implementation
[0051] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0052] Please refer to Figure 1This embodiment provides a method and system for identifying diseases of traditional Chinese medicinal herbs based on visual detection. The method involves acquiring an image of the medicinal herb to be identified. This image is a visible light digital image containing the plant or leaf area of the herb. The image contains three channels, corresponding to the red, green, and blue color channels of the RGB color space, with each channel having a pixel value ranging from 0 to 255. The image is then converted from the RGB color space to the HSV color space, and the luminance channel is extracted from the HSV color space. Specifically, during the conversion from RGB to HSV, the luminance channel value is calculated using the following formula:
[0053] in, These are the spatial coordinates of pixels in the image. , , These represent the pixel values for the red, green, and blue channels in the RGB color space. This represents the brightness value of the pixel in the HSV color space, with a value range consistent with the pixel value range of the RGB channel. The extracted brightness channel is a two-dimensional matrix, with the height and width of the matrix matching the height and width of the image of the Chinese herbal medicine to be identified, respectively. Each element in the matrix corresponds to the brightness value of the corresponding pixel in the image.
[0054] The spectrum is obtained by performing a two-dimensional discrete Fourier transform on the brightness channel. The calculation process of the two-dimensional discrete Fourier transform is achieved by the following formula:
[0055] in, Let M be the two-dimensional matrix of the luminance channels, N be the height of the luminance channel matrix, x be the row coordinate in the spatial domain, y be the column coordinate in the spatial domain, u be the row frequency coordinate in the frequency domain, and v be the column frequency coordinate in the frequency domain. The spectrum obtained after transformation at frequency points The complex value at the position, j is the imaginary unit. In the transformed spectrogram, the low-frequency components are concentrated in the central region of the spectrogram, corresponding to the slowly changing illumination background components in the image, while the high-frequency components are distributed in the edge region of the spectrogram, corresponding to the rapidly changing texture, edge, and lesion detail components in the image.
[0056] Low-frequency and high-frequency masks are constructed from the spectrum image. Both masks are two-dimensional matrices with the same dimensions as the spectrum image, and their elements are either 0 or 1. In the low-frequency mask, elements corresponding to the low-frequency regions of the spectrum image are set to 1, while elements in other regions are set to 0. In the high-frequency mask, elements corresponding to the high-frequency regions of the spectrum image are set to 1, while elements in other regions are set to 0. The high-frequency mask is multiplied by the spectrum image to obtain the masked high-frequency spectrum image. In the multiplication operation, the complex value of each frequency point in the spectrum image is multiplied by the corresponding value in the high-frequency mask, retaining only the frequency components of the high-frequency regions and filtering out the frequency components of the low-frequency regions. A two-dimensional discrete inverse Fourier transform is performed on the masked high-frequency spectrum image to obtain the de-illuminated texture map. The calculation process of the two-dimensional discrete inverse Fourier transform is implemented using the following formula:
[0057] in, The high-frequency spectrum after high-frequency masking is shown at the frequency points. Complex values at that location, The de-illuminated texture map obtained after inverse transformation is at the pixel level. The pixel values at each location are consistent with the parameters in the two-dimensional discrete Fourier transform formula. The resulting de-illuminated texture map is a single-channel two-dimensional spatial domain image. It removes the low-frequency illumination components from the original image, retaining only the high-frequency texture and lesion detail components, thus eliminating the interference of uneven illumination and local shadows on subsequent feature extraction.
[0058] The de-illuminated texture map is input into a pre-constructed convolutional neural network (CNN). The CNN includes a first branch and a second branch configured in parallel. Both branches receive the same de-illuminated texture map as input. The two branches perform feature extraction operations in parallel, outputting corresponding feature maps. The input layer of the CNN receives a single-channel de-illuminated texture map, and its output is simultaneously transmitted to the inputs of both the first and second branches, ensuring complete consistency between the input data of the two branches.
[0059] The multi-scale lesion contour features in the de-illuminated texture map are extracted using the multi-scale dilated spatial pyramid pooling module in the first branch. This module contains multiple parallel dilated convolutional layers with different dilation rates. Different dilation rates correspond to different receptive field sizes, enabling the capture of lesion contour information of different sizes in the de-illuminated texture map. The dilated convolution is calculated using the following formula:
[0060] in, To output the feature map in coordinates The pixel value at that location, I is the input feature map, K is the size of the convolution kernel, and r is the dilation rate of the dilated convolution. For the convolution kernel in coordinates The weight values at each point. Feature maps output by dilated convolutional layers with different dilation rates are concatenated along the channel dimension. The concatenated feature maps undergo channel dimensionality reduction through convolutional layers, followed by upsampling to restore the input unilluminated texture. Figure 1 The spatial dimensions are determined, and the final output is a multi-scale lesion contour feature. The multi-scale lesion contour feature integrates lesion contour information from different receptive fields, adapting to the feature extraction needs of lesions of different sizes.
[0061] The second branch uses a texture orientation attention module to extract weighted texture orientation features from the delit texture map. This module includes a pre-defined multi-directional filter bank, which extracts texture response information from different directions within the delit texture map. The multi-directional filter bank performs a convolution operation on the delit texture map, outputting a multi-channel response map corresponding to the number of filter directions. Each channel's response map corresponds to the texture response intensity in one direction. The saliency of each channel's response map is calculated, and a weight coefficient is assigned to the corresponding channel based on the saliency. This weight coefficient is then multiplied channel-by-channel by the corresponding channel's response map. The weighted multi-channel response maps are then concatenated to obtain the weighted texture orientation features. These weighted texture orientation features highlight the texture orientation information with significant responses, i.e., the unique texture orientation features corresponding to lesions, while suppressing background-irrelevant texture information, thus improving the discriminative power of the texture features.
[0062] Multi-scale lesion contour features and weighted texture direction features are concatenated along the channel dimension. During the concatenation process, the spatial dimensions of the feature maps output by the two branches are completely identical; merging only occurs along the channel dimension. The number of channels in the concatenated feature map is the sum of the number of channels in the multi-scale lesion contour features and the number of channels in the weighted texture direction features. The spatial dimensions remain consistent with the input unilluminated texture. Figure 1 The concatenated features are input into a fully connected layer. The fully connected layer maps the concatenated features into an output vector corresponding to the disease category using a pre-trained weight matrix. The length of the output vector is the same as the total number of preset Chinese herbal medicine disease categories. Each element in the output vector corresponds to the prediction score of a disease category. The disease category with the highest prediction score is taken as the disease category corresponding to the Chinese herbal medicine image to be identified, thus completing the identification process of Chinese herbal medicine diseases.
[0063] In this embodiment, the correspondence between the input and output parameters of the dual-branch structure of the convolutional neural network is shown in the table below:
[0064] Table 1. Correspondence between input and output parameters of the dual-branch structure of convolutional neural networks
[0065]
[0066] In Table 1, H represents the height of the input image, W represents the width of the input image, C1 represents the number of channels in the output features of the first branch, C2 represents the number of channels in the output features of the second branch, and N represents the total number of preset categories of Chinese herbal medicine diseases. This table clarifies the parameter flow relationships among the modules of the convolutional neural network and clearly demonstrates the data processing flow and dimensional changes within the network.
[0067] This embodiment converts the image to the HSV color space and extracts the luminance channel. It then separates the illumination component and texture detail component in the frequency domain to obtain a de-illuminated texture map, avoiding feature confusion caused by uneven illumination and local shadows. By using a parallel dual-branch convolutional neural network, multi-scale lesion contour features and weighted texture direction features are extracted separately. This fuses the macroscopic contour information and microscopic texture direction information of the lesions, achieving accurate identification of diseases affecting traditional Chinese medicinal herbs.
[0068] In a preferred embodiment, reference Figure 2After acquiring the image of the Chinese herbal medicine to be identified, before converting it from the RGB color space to the HSV color space, preprocessing is performed on the image. The image is then input into a Gaussian filter for smoothing and denoising, resulting in a filtered image. The kernel size of the Gaussian filter is an odd number, set according to the noise level of the image. The standard deviation of the Gaussian filter is calculated based on the kernel size. This smoothing and denoising process removes Gaussian noise introduced during image acquisition, preventing noise signals from being amplified during subsequent frequency domain transformations and interfering with the extraction of high-frequency texture components. Edge cropping is performed on the filtered image to remove edge regions where the pixel values around the filtered image are constant at a set value. The cropped image is obtained with a set value of 0 or 255, corresponding to black or white edges generated during image acquisition. The edge cropping process involves detecting each row sequentially, starting from the top row. When all pixel values in a row are the set value, that row is discarded until a row with non-set values is detected. The bottom, left, and right edges of the image are detected and cropped in the same way to ensure that the cropped image contains only valid medicinal plant or leaf areas and no invalid constant pixel edges. The cropped image is then scaled to a preset fixed size using bilinear interpolation. Bilinear interpolation calculates the target pixel value by weighted averaging of the four neighboring pixels around the target pixel, preserving edge and texture details and avoiding jagged distortion during scaling. The scaled image size is consistent with the input size of the subsequent convolutional neural network, ensuring that images from different sources and with different original sizes can be uniformly input into the network for processing. The pixel values of each pixel in the scaled cropped image are divided by a set value, mapping the range of pixel values to a preset interval, resulting in a preprocessed image of the Chinese herbal medicine. The set value is 255, and the preset interval is [0,1]. The mapped pixel values can adapt to the numerical processing range of the convolutional neural network, reducing numerical fluctuations during network computation and accelerating the inference convergence speed of the network. The preprocessed image of the Chinese herbal medicine is then used as the input image for color space conversion, performing subsequent HSV color space conversion and luminance channel extraction operations.
[0069] After performing a two-dimensional discrete Fourier transform on the extracted luminance channel to obtain the spectrum, the process of constructing low-frequency and high-frequency masks in the spectrum involves calculating the amplitude value at each frequency point in the spectrum. The amplitude value is the modulus of the complex value at each frequency point in the spectrum, i.e. The magnitude of the amplitude reflects the proportion of the component corresponding to that frequency point in the image. The amplitude values are sorted from highest to lowest value to obtain a sorted result. Frequency points in the top preset proportion of the sorted result are designated as low-frequency regions, and frequency points outside the low-frequency regions are designated as high-frequency regions. The preset proportion ranges from 5% to 15% and can be adjusted according to the image's lighting conditions. A low-frequency mask is generated by assigning a value of 1 to frequency points within the low-frequency regions and a value of 0 to frequency points outside the low-frequency regions; similarly, a high-frequency mask is generated by assigning a value of 1 to frequency points within the high-frequency regions and a value of 0 to frequency points outside the high-frequency regions. A dot product operation is performed between the high-frequency mask and the spectrogram to obtain the masked high-frequency spectrogram. This dot product operation completely preserves the frequency components of the high-frequency regions in the spectrogram, while setting all frequency components of the low-frequency regions to zero, thus separating the lighting components from the texture components. A two-dimensional discrete inverse Fourier transform is performed on the masked high-frequency spectrogram to obtain the de-illuminated texture map.
[0070] Furthermore, the low-frequency region can also be divided as follows: calculate the coordinates of the center point of the spectrum, where the coordinates of the center point of the spectrum are... Where M is the height of the spectrum and N is the width of the spectrum. The Euclidean distance from the coordinates of each frequency point in the spectrum to the center point is calculated using the following formula:
[0071] in, Frequency point The Euclidean distance to the center point of the spectrum is used, and the meanings of the other parameters are consistent with those in the two-dimensional discrete Fourier transform formula. A distance-amplitude distribution curve is generated by plotting the Euclidean distance as the x-axis and the sum of the amplitude values at the corresponding frequency points as the y-axis. This curve reflects the total contribution of frequency components within different distance ranges to the image. The slope of the distance-amplitude distribution curve at each distance point is calculated; the slope is the rate of change of the sum of amplitudes with distance, reflecting the amplitude contribution of newly added frequency components at that distance point. The distance point where the slope value first falls below a set slope threshold is taken as the cutoff distance. This slope threshold can be adjusted according to the texture richness of the image. When the slope value first falls below the set threshold, it indicates that the amplitude contribution of frequency components outside that distance point has significantly decreased, corresponding to high-frequency texture detail components in the image. Frequency points whose Euclidean distance is less than the cutoff distance in the spectrum are classified as low-frequency regions, and frequency points whose Euclidean distance is greater than or equal to the cutoff distance are classified as high-frequency regions. This classification method can adaptively determine the boundary between low-frequency and high-frequency regions based on the actual frequency distribution of the image, without the need to pre-set fixed ratio parameters, and can adapt to Chinese herbal medicine images with different lighting conditions and different texture richness.
[0072] In this embodiment, the parameters for the light removal processing effect corresponding to different low-frequency region division methods are shown in the table below:
[0073] Table 2. Parameters of light removal effect corresponding to different low-frequency region division methods.
[0074]
[0075] Table 2 shows that the illumination component suppression rate represents the proportion of low-frequency illumination components removed from the processed image, while the texture detail retention rate represents the proportion of high-frequency lesion texture components retained in the processed image. This table illustrates the processing effects and applicable scenarios of different partitioning methods, providing a clear reference for those skilled in the art to select the appropriate partitioning method based on the actual acquisition environment.
[0076] This embodiment removes noise and invalid edge regions from the image through preprocessing, unifies the image size and numerical range, and improves the stability of subsequent frequency domain processing and feature extraction. By employing two methods—amplitude sorting ratio partitioning and distance-amplitude curve adaptive partitioning—precise division of low-frequency and high-frequency regions is achieved. This adapts to images of Chinese herbal medicines under different lighting conditions, effectively separating the illumination component and texture detail component, further reducing the interference of lighting factors on disease identification.
[0077] In another preferred embodiment, reference Figure 3 The process of extracting multi-scale lesion contour features by inputting the de-illuminated texture map into the multi-scale dilated spatial pyramid pooling module involves inputting the de-illuminated texture map into four dilated convolutional layers with different dilation rates connected in parallel within the multi-scale dilated spatial pyramid pooling module, resulting in initial feature maps with four different receptive fields. In the four dilated convolutional layers with different dilation rates, the first dilated convolutional layer has a dilation rate of 1 and a kernel size of 1×1; the second dilated convolutional layer has a dilation rate of a first set value and a kernel size of 3×3; the third dilated convolutional layer has a dilation rate of a second set value and a kernel size of 3×3; and the fourth dilated convolutional layer has a dilation rate of a third set value and a kernel size of 3×3. The first, second, and third set values increase in a geometric progression with a common ratio of 2. The first set value is 2, the second set value is 4, and the third set value is 8. The number of input and output channels of the four dilated convolutional layers with different dilation rates are kept consistent. The stride of all dilated convolutional layers is set to 1, and all dilated convolutional layers use the same zero-padding operation with the same parameters. The padding size is calculated based on the convolutional kernel size and dilation rate to ensure that the spatial size of the initial feature map output by each dilated convolutional layer is completely consistent with the spatial size of the input de-illuminated texture map, thus avoiding size mismatch problems in the subsequent feature stitching process.
[0078] Four dilated convolutional layers with different dilation rates output corresponding initial feature maps. The four initial feature maps have the same spatial size and the same number of channels. The four initial feature maps with different receptive fields are concatenated along the channel dimension. The number of channels in the concatenated feature map is four times that of a single initial feature map.
[0079] The concatenated feature map is input into a 1×1 convolutional layer for channel dimensionality reduction. The number of input channels of the 1×1 convolutional layer is the same as the number of channels in the concatenated feature map, and the number of output channels of the 1×1 convolutional layer is the same as the number of channels in a single initial feature map. Through the convolution operation of the 1×1 convolutional layer, the concatenated high-channel-count feature map is transformed into a low-channel-count dimensionality-reduced feature map, reducing the computational load of subsequent processing, while fusing feature information from different channels.
[0080] Perform bilinear interpolation upsampling on the dimensionality-reduced feature map to restore its spatial dimensions to those of the de-illuminated texture. Figure 1 In this embodiment, all dilated convolutional layers maintain the spatial size of the feature map through padding operations. Therefore, the scaling factor of the upsampling operation is 1, used only to ensure that the spatial size of the dimensionality-reduced feature map perfectly matches the input de-illuminated texture map. The upsampled dimensionality-reduced feature map and the de-illuminated texture map are added element-wise to obtain the multi-scale lesion contour features. The element-wise addition calculation process is implemented by the following formula:
[0081] in, The final output multi-scale lesion contour features are in coordinates Pixel value at that location, The feature map after dimensionality reduction and upsampling is in coordinates Pixel value at that location, To input the deilluminated texture map of the multi-scale void space pyramid pooling module in coordinates The pixel value at that location. The element-wise additive residual connection structure can preserve the basic texture information of the input image, while fusing multi-scale lesion contour features, avoiding the loss of basic detail information during multi-scale convolution, and improving the expressive power of features.
[0082] In this embodiment, the parameter configurations of each convolutional layer in the multi-scale hollow spatial pyramid pooling module are shown in the table below:
[0083] Table 3. Parameter configuration of each convolutional layer in the multi-scale void space pyramid pooling module.
[0084]
[0085] In Table 3, the stride of all convolutional layers is set to 1, and the padding size is calculated based on the kernel size and dilation rate to ensure that the spatial dimensions of the output feature map are completely consistent with those of the input feature map. This table clarifies the complete parameter configuration of each convolutional layer in the multi-scale dilated spatial pyramid pooling module, clearly demonstrating the differences in receptive fields and parameter setting logic of different convolutional layers.
[0086] This embodiment constructs a parallel multi-scale feature extraction structure using four dilated convolutional layers with different dilation rates. This structure can capture the contour features of lesions of different sizes, adapting to application scenarios where lesion sizes vary greatly across different diseases. By employing channel splicing, 1×1 convolutional dimensionality reduction, and residual connection structures, the computational load is reduced while preserving basic texture details. This integration of multi-scale lesion contour features enhances the adaptability and expressive power of features for lesions of different sizes, solving the problem of insufficient feature extraction for lesions of different sizes.
[0087] In yet another preferred embodiment, reference is made to Figure 4 The process of inputting the de-illuminated texture map into the texture direction attention module and extracting weighted texture direction features involves convolving the de-illuminated texture map using a pre-defined Gabor filter bank. This Gabor filter bank contains multiple Gabor kernel functions with different orientation angles, outputting a multi-channel response map corresponding to the number of orientation angles. Each channel's response map corresponds to the convolution result of the Gabor kernel function with the de-illuminated texture map at a specific orientation angle, reflecting the texture response intensity of the image in that direction. The Gabor kernel function is calculated using the following formula:
[0088] in:
[0089] in, The Gabor kernel function with direction angle θ in coordinates The values at θ represent the orientation angle of the Gabor core, and γ represents the spatial aspect ratio parameter. Let λ be the standard deviation of the Gaussian function, λ be the wavelength parameter, and ψ be the phase shift parameter. The coordinates are those after rotation by the direction angle. The Gabor kernel function, through the product of a Gaussian function and a sine function, can simulate the texture perception characteristics of the human visual system, accurately extract texture features of specific directions and frequencies, and adapt to the micro-texture extraction needs of lesions in traditional Chinese medicine.
[0090] In the Gabor filter bank, the orientation angles of each Gabor kernel function are set as follows: the angle range from 0 to 180 degrees is divided into sub-intervals equal to the number of Gabor kernel functions. The median value of each sub-interval is used as the orientation angle of the corresponding Gabor kernel function. The number of Gabor kernel functions is set to 8, and the width of the corresponding angle sub-interval is 22.5 degrees. The orientation angles of each Gabor kernel function are 11.25 degrees, 33.75 degrees, 56.25 degrees, 78.75 degrees, 101.25 degrees, 123.75 degrees, 146.25 degrees, and 168.75 degrees, covering all directions from 0 to 180 degrees, ensuring the extraction of texture features in any direction in the image. The wavelength parameter of each Gabor kernel function is set to the same first preset pixel value, the aspect ratio parameter of each Gabor kernel function is set to the same second preset value, and the phase offset parameter of each Gabor kernel function is set to the same third preset value. The standard deviation σ of the Gaussian function of the Gabor kernel function is calculated based on the wavelength parameter λ. To ensure the effective coverage of the kernel function matches the wavelength, uniform parameter settings ensure that Gabor kernel functions in different directions differ only in their angular direction, avoiding interference from other parameters and ensuring the comparability of response maps in different directions. During the convolution operation on the deilluminated texture map using the Gabor filter bank, a reflection-filling strategy is employed for the edge regions of the deilluminated texture map. This strategy expands the boundaries according to the size of the Gabor kernel function, mirroring the pixels at the image edges to avoid edge response distortion caused by zero-filling and improving the accuracy of texture feature extraction in image edge regions.
[0091] Calculate the number of pixels with an absolute value greater than a preset threshold in the response map of each channel. The preset threshold is used to filter out weak responses caused by noise, retaining only significant texture response signals. Divide the number of pixels by the total number of pixels in the response map to obtain the response percentage for each orientation angle. The response percentage is calculated using the following formula:
[0092] in, This represents the proportion of the response corresponding to the direction angle θ. This represents the number of pixels in the response map whose absolute value is greater than a preset threshold corresponding to that directional angle. H is the height of the response map, W is the width of the response map, and H·W is the total number of pixels in the response map. The higher the response percentage, the more significant the texture in that direction is in the image, corresponding to the unique texture direction characteristics of lesions.
[0093] The response proportions are normalized and used as the weighting coefficients for the corresponding channels. The normalization process is calculated using the following formula:
[0094] in, The weighting coefficient is the one corresponding to the direction angle θ. Let θ represent the response proportion corresponding to the direction angle θ, and K be the total number of kernel functions in the Gabor filter bank. Let be the orientation angle corresponding to the k-th Gabor kernel function, and the denominator be the sum of the response proportions corresponding to all orientation angles. Normalization ensures that the sum of all weight coefficients is 1, avoiding large fluctuations in the range of weighted feature values and ensuring the stability of subsequent feature processing. The weight coefficients are multiplied channel by channel by channel in the corresponding channel response map. The calculation process for channel-by-channel multiplication is implemented using the following formula:
[0095] in, The weighted response plot corresponding to the direction angle θ in coordinates Pixel value at that location, The weighting coefficient is the one corresponding to the direction angle θ. The original response map corresponding to the direction angle θ in coordinates The pixel values at each location are used. Channel-by-channel multiplication achieves weighted adjustment of the response maps in different directions, highlighting the unique texture direction features of lesions with high response proportions and suppressing background-irrelevant texture features with low response proportions, thereby improving the discriminativeness of texture features. The multiplied multi-channel response maps are then concatenated to obtain the weighted texture direction features. The number of channels in the concatenated weighted texture direction features is consistent with the number of Gabor kernel functions, and the spatial size is consistent with the input irradiated texture. Figure 1 To.
[0096] refer to Figure 5 Before concatenating the multi-scale lesion contour features with the weighted texture direction features along the channel dimension and inputting the concatenated features into the fully connected layer, the concatenated features are further processed as follows: the concatenated features are then input into a batch normalization layer for feature distribution alignment. The batch normalization process is calculated using the following formula:
[0097] in, This is the feature map of the c-th channel after batch normalization. Let c be the input feature map for the c-th channel. This represents the mean value of the c-th channel feature in the current batch. Let V be the variance of the c-th channel feature in the current batch. To prevent tiny constants with a denominator of 0, For scaling parameters, Here is the offset parameter, where and These are the trainable parameters learned during network training. Batch normalization adjusts the mean of features in each batch to 0 and the variance to 1, aligning the feature distributions of different batches, reducing the impact of covariate shifts within the network, accelerating the network's inference speed, and reducing the risk of overfitting.
[0098] The features processed by the batch normalization layer are input into the modified linear unit activation function layer for nonlinear mapping. The expression for the modified linear unit activation function is as follows: When the input value is greater than 0, the output value is equal to the input value; when the input value is less than or equal to 0, the output value is 0. Through nonlinear mapping, the network can fit complex nonlinear feature relationships and improve the network's ability to distinguish different disease features.
[0099] The features after nonlinear mapping are input into a global average pooling layer, which compresses the spatial dimension of the nonlinearly mapped features into a 1×1 feature vector. The calculation process of global average pooling is implemented by the following formula:
[0100] in, This represents the output value of the c-th channel after global average pooling. The input feature map of the c-th channel in coordinates The pixel value at point H is the height of the input feature map, and W is the width of the input feature map. Global average pooling averages the pixel values of all pixels in the feature map for each channel. Feature map conversion The feature vector significantly reduces the feature dimensionality, thereby reducing the computational cost of subsequent fully connected layers. At the same time, it preserves the global feature information of each channel, avoiding information loss caused by excessive compression of the feature space dimension by the fully connected layers.
[0101] Flattening the feature vector into a one-dimensional vector, the flattening operation will... The feature vector is converted into a one-dimensional vector of length C. This one-dimensional vector is then input into a fully connected layer. The number of output nodes of the fully connected layer is the same as the total number of preset Chinese herbal medicine disease categories. The output calculation of the fully connected layer is achieved through the following formula:
[0102] in, Let be the output value of the k-th output node of the fully connected layer, and C be the total number of channels in the feature vector of the input fully connected layer. Let be the weight value between the k-th output node and the c-th input channel. Let c be the feature value of the input channel. Let be the bias value of the k-th output node, where and These are the trainable parameters learned during network training. In the output vector of the fully connected layer, each element corresponds to a predicted score for a disease category, and the disease category with the highest predicted score is taken as the final recognition result.
[0103] refer to Figure 6 This embodiment also provides a visual detection-based system for identifying diseases in traditional Chinese medicinal herbs. The system includes an image acquisition device, a feature processing device, and a classification device. The image acquisition device and the feature processing device establish a communication connection via a wired or wireless communication link, and the feature processing device and the classification device establish a communication connection via a wired or wireless communication link. The image acquisition device is used to acquire images of the traditional Chinese medicinal herbs to be identified, convert the images from the RGB color space to the HSV color space, extract the luminance channel in the HSV color space, perform a two-dimensional discrete Fourier transform on the luminance channel to obtain a spectrum, construct low-frequency and high-frequency masks in the spectrum, and perform an inverse Fourier transform on the high-frequency mask to obtain a de-illuminated texture map. The image acquisition device has a built-in visible light image sensor and image processing unit, which can complete image acquisition, preprocessing, color space conversion, and frequency domain processing operations. The feature processing device inputs the de-illuminated texture map into a pre-constructed convolutional neural network (CNN). The CNN includes a first branch and a second branch set in parallel. The first branch uses a multi-scale hollow spatial pyramid pooling module to extract multi-scale lesion contour features from the de-illuminated texture map, while the second branch uses a texture direction attention module to extract weighted texture direction features. The feature processing device has a built-in CNN inference engine capable of performing parallel dual-branch feature extraction. The classification device concatenates the multi-scale lesion contour features and the weighted texture direction features along the channel dimension. The concatenated features are input into a fully connected layer, which outputs the disease category corresponding to the herbal medicine image to be identified. The classification device generates disease identification results based on the output of the fully connected layer, completing the entire identification process.
[0104] In this embodiment, the orientation angle and core parameters of the Gabor filter bank are configured as shown in the table below:
[0105] Table 4. Direction Angle and Core Parameter Configuration of Gabor Filter Bank
[0106]
[0107] In Table 4, the standard deviation σ of the Gaussian function of the Gabor kernel function is calculated based on the wavelength parameter λ. This ensures that the effective coverage of the kernel function matches the wavelength. The table clearly defines the orientation angle and core parameter configuration of each kernel function in the Gabor filter bank, clearly demonstrating the parameter setting logic of the filter bank.
[0108] This embodiment extracts texture responses in different directions from an image using a multi-directional Gabor filter bank. The response proportion is used as a weighting coefficient to weight the response maps in different directions, accurately highlighting the unique texture direction features of lesions and suppressing interference from background-irrelevant textures. Batch normalization, non-linear activation, and global average pooling are used to optimize the distribution and dimensionality of features, improving the network's inference stability and feature discrimination ability. Through a multi-device collaborative system architecture, end-to-end deployment for identifying diseases of Chinese medicinal herbs is achieved, adaptable to various application scenarios such as field detection and cloud-based batch processing, enabling automated identification of diseases of Chinese medicinal herbs.
Claims
1. A method for identifying diseases of traditional Chinese medicinal herbs based on visual detection, characterized in that, include: Acquire the image of the Chinese herbal medicine to be identified, convert the image of the Chinese herbal medicine to be identified from the RGB color space to the HSV color space, and extract the luminance channel in the HSV color space; A two-dimensional discrete Fourier transform is performed on the brightness channel to obtain a spectrum map. A low-frequency mask and a high-frequency mask are constructed in the spectrum map. An inverse Fourier transform is performed on the high-frequency mask to obtain a de-illuminated texture map. The de-illuminated texture map is input into a pre-constructed convolutional neural network, which includes a first branch and a second branch set in parallel. The multi-scale lesion contour features in the de-illuminated texture map are extracted through the multi-scale hollow spatial pyramid pooling module in the first branch, and the weighted texture direction features in the de-illuminated texture map are extracted through the texture direction attention module in the second branch. The multi-scale lesion contour features and the weighted texture direction features are concatenated in the channel dimension. The concatenated features are then input into a fully connected layer, and the disease category corresponding to the Chinese herbal medicine image to be identified is output.
2. The method for Chinese herbal medicine disease identification based on visual detection according to claim 1, characterized in that, Constructing low-frequency and high-frequency masks in the spectrum diagram includes: calculating the amplitude value of each frequency point in the spectrum diagram and sorting the amplitude values according to their numerical values; The frequency points in the sorting results that represent the first preset proportion are taken as the low-frequency region, and the frequency points other than the low-frequency region are taken as the high-frequency region. The low-frequency mask is generated by assigning a value of 1 to frequency points within the low-frequency region and a value of 0 to frequency points outside the low-frequency region. The high-frequency mask is generated by assigning a value of 1 to frequency points within the high-frequency region and a value of 0 to frequency points outside the high-frequency region. The high-frequency mask is multiplied by the spectrum to obtain the masked high-frequency spectrum. The masked high-frequency spectrum is then subjected to a two-dimensional discrete inverse Fourier transform to obtain the de-illuminated texture map. 3.The Chinese herbal medicine disease identification method based on visual detection according to claim 1, characterized in that, Extracting multi-scale lesion contour features from the de-illuminated texture map using the multi-scale hollow spatial pyramid pooling module in the first branch includes: inputting the de-illuminated texture map into four parallel hollow convolutional layers with different dilation rates in the multi-scale hollow spatial pyramid pooling module to obtain initial feature maps with four different receptive fields. The initial feature maps of the four different receptive fields are concatenated along the channel dimension. The concatenated feature map is then input into a 1×1 convolutional layer for channel dimensionality reduction, and the dimensionality-reduced feature map is output. A bilinear interpolation upsampling operation is performed on the dimensionality-reduced feature map to restore the spatial size of the dimensionality-reduced feature map to be consistent with the light-removed texture map. The upsampled dimensionality-reduced feature map and the light-removed texture map are then added element-wise to obtain the multi-scale lesion contour features. 4.The Chinese herbal medicine disease identification method based on visual detection according to claim 1, characterized in that, The weighted texture direction features in the de-illuminated texture map are extracted through the texture direction attention module in the second branch, including: performing a convolution operation on the de-illuminated texture map using a preset Gabor filter bank, wherein the Gabor filter bank contains multiple Gabor kernel functions with different direction angles, and outputting a multi-channel response map corresponding to the number of direction angles; Calculate the number of pixels in the response map of each channel whose absolute value is greater than a preset threshold, and divide the number of pixels by the total number of pixels in the response map to obtain the response ratio corresponding to each directional angle. The response proportion is normalized and used as the weight coefficient of the corresponding channel. The weight coefficient is multiplied by the corresponding channel response map channel by channel. The multiplied multi-channel response maps are then stitched together to obtain the weighted texture direction feature.
5. The method for Chinese herbal medicine disease identification based on visual detection according to claim 1, characterized in that, Before inputting the concatenated features into the fully connected layer, the method further includes: inputting the concatenated features into the batch normalization layer for feature distribution alignment processing; The features processed by the batch normalization layer are input into the modified linear unit activation function layer for nonlinear mapping. The features after nonlinear mapping are input into a global average pooling layer, which compresses the spatial dimension of the nonlinearly mapped features into a 1×1 feature vector. The feature vector is flattened into a one-dimensional vector, and the one-dimensional vector is input into the fully connected layer. The number of output nodes of the fully connected layer is the same as the preset total number of Chinese herbal medicine disease categories. 6.The Chinese herbal medicine disease identification method based on visual detection according to claim 1, characterized in that, After acquiring the image of the Chinese herbal medicine to be identified, and before converting the image of the Chinese herbal medicine to be identified from the RGB color space to the HSV color space, the method further includes: inputting the image of the Chinese herbal medicine to be identified into a Gaussian filter for smoothing and denoising processing to obtain a filtered image; The filtered image is cropped at the edges to remove the edge regions in the filtered image whose pixel values are constant at a set value, thus obtaining a cropped image. The cropped image is scaled according to a preset fixed size; Divide the pixel value of each pixel in the scaled cropped image by a set value, and map the range of pixel values to a preset interval to obtain a preprocessed Chinese herbal medicine image. Use the preprocessed Chinese herbal medicine image as the input image for performing color space conversion.
7. The method for Chinese herbal medicine disease identification based on visual detection according to claim 2, characterized in that, The step of using the frequency points in the sorting results that represent the first preset proportion as the low-frequency region includes: calculating the coordinates of the center point of the spectrum diagram, and calculating the Euclidean distance from the coordinates of each frequency point in the spectrum diagram to the coordinates of the center point. Using the Euclidean distance as the abscissa and the sum of the amplitude values of the frequency points corresponding to the Euclidean distance as the ordinate, a distance-amplitude distribution curve is generated. Calculate the slope value of the distance-amplitude distribution curve at each distance point, and take the distance point where the slope value is first less than a set slope threshold as the cutoff distance; Frequency points in the spectrum whose Euclidean distance is less than the cutoff distance are classified as low-frequency regions, and frequency points whose Euclidean distance is greater than or equal to the cutoff distance are classified as high-frequency regions. 8.The Chinese herbal medicine disease identification method based on visual detection of claim 4, characterized in that, The Gabor filter bank includes multiple Gabor kernel functions with different orientation angles, including: dividing the angle range from 0 degrees to 180 degrees into sub-intervals equal to the number of Gabor kernel functions, and using the median value of each sub-interval as the orientation angle of the corresponding Gabor kernel function; The wavelength parameters of each Gabor kernel function are all set to the same first preset pixel value, the spatial aspect ratio parameters of each Gabor kernel function are all set to the same second preset value, and the phase offset parameters of each Gabor kernel function are all set to the same third preset value. During the convolution operation of the de-illuminated texture map using the Gabor filter bank, a reflection filling strategy is used to expand the boundary of the edge region of the de-illuminated texture map according to the size of the Gabor kernel function. 9.The Chinese herbal medicine disease identification method based on visual detection of claim 3, characterized in that, The multi-scale hollow spatial pyramid pooling module contains four parallel hollow convolutional layers with different expansion rates, including: the first hollow convolutional layer with an expansion rate of 1 and a kernel size of 1×1, the second hollow convolutional layer with an expansion rate of a first set value and a kernel size of 3×3, the third hollow convolutional layer with an expansion rate of a second set value and a kernel size of 3×3, and the fourth hollow convolutional layer with an expansion rate of a third set value and a kernel size of 3×3, wherein the first set value, the second set value, and the third set value increase in a geometric progression. The number of input and output channels of the four dilated convolutional layers with different dilation rates are kept consistent, and all dilated convolutional layers use the same padding parameters to maintain the spatial size of the feature map.
10. A Chinese herbal medicine disease identification system based on visual inspection, characterized by, It includes an image acquisition device, a feature processing device, and a classification device, wherein the image acquisition device is communicatively connected to the feature processing device, and the feature processing device is communicatively connected to the classification device; The image acquisition device is used to acquire images of Chinese herbal medicines to be identified, convert the images of Chinese herbal medicines to be identified from RGB color space to HSV color space, extract the luminance channel in the HSV color space, perform a two-dimensional discrete Fourier transform on the luminance channel to obtain a spectrum map, construct a low-frequency mask and a high-frequency mask in the spectrum map, and perform an inverse Fourier transform on the high-frequency mask to obtain a de-illuminated texture map. The feature processing device is used to input the de-illuminated texture map into a pre-constructed convolutional neural network. The convolutional neural network includes a first branch and a second branch set in parallel. The multi-scale lesion contour features in the de-illuminated texture map are extracted by the multi-scale hollow spatial pyramid pooling module in the first branch, and the weighted texture direction features in the de-illuminated texture map are extracted by the texture direction attention module in the second branch. The classification device is used to concatenate the multi-scale lesion contour features and the weighted texture direction features in the channel dimension, input the concatenated features into a fully connected layer, and output the disease category corresponding to the Chinese herbal medicine image to be identified.