A method and system for identifying warehouse mildewed corn based on image visual detection

By using an improved Transformer model for image visual detection, the problems of limited detection range and low efficiency in existing technologies are solved, enabling efficient identification of various types of moldy corn and improving detection accuracy and speed.

CN115861244BActive Publication Date: 2026-04-10CHINA FUJIAN GREAT WALL HLDG CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-09
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Existing technologies are not widely applicable for detecting mold in stored corn, especially in their inability to effectively identify mycotoxins other than aflatoxin, and manual visual inspection is inefficient and inaccurate.

Method used

An improved Transformer model is used for image visual detection, including an image enhancement module, a feature extraction module, a candidate region generation module, and a target detection module. Gray-scale transformation layers and parallel convolutional layers are used to enhance local image information, and deformable attention modules and feature pyramid networks are combined to identify various mold features.

Benefits of technology

It expands the detection range, improves the ability to identify various types of moldy corn, reduces missed detections and false detections, lowers model training costs, accelerates the training process, and achieves more efficient identification of moldy corn.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115861244B_ABST
    Figure CN115861244B_ABST
Patent Text Reader

Abstract

The application discloses a kind of based on image visual detection's recognition method and system of warehouse mildewed corn, first using imaging device to collect the real-time image of warehouse corn, the real-time image is preprocessed, generates image to be detected;Then build the Transformer identification model of warehouse mildewed corn, including sequentially arranged image enhancement module, feature extraction module, candidate region generation module and target detection module;Finally the image to be detected is loaded to identification model and the identification of mildewed corn is carried out, and the identification result of warehouse mildewed corn is obtained.The mildewed corn identification method based on image visual detection proposed in the application uses computer vision to detect the real-time image of warehouse corn collected in real time, can identify a variety of mildewed corn characteristics, and expands the range of use;The identification model of the application improves the attention module, can reduce the overfitting risk in model training process, and speeds up the training process of model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computer vision, and particularly relates to a warehouse mildewed corn recognition method and system based on image visual detection. BACKGROUND

[0002] Corn is one of the main food crops for human survival and one of the most important energy feed sources for animal food. Lack of scientific management and cognition is one of the important reasons for mycotoxin pollution in the corn storage process. Due to rainy and humid weather in the corn harvest season, part of the corn is mildewed and deteriorated, and even hidden deterioration occurs before harvesting. If the corn infected with mold is sent to the warehouse, it is more likely to cause secondary mycotoxin pollution. Animal food processed using mycotoxin-contaminated corn can cause serious harm to animals. High-quality animal food must use high-quality fresh and uncontaminated raw materials, so the prevention and control of corn mycotoxin pollution is particularly important in feed enterprises.

[0003] At present, the main method for detecting whether corn is infected with aflatoxin is traditional manual visual detection. Corn is manually extracted and visually detected to determine whether it is infected with aflatoxin. Due to the strong subjectivity of this detection method and visual fatigue of workers after long-time work, it is easy to produce error sorting, has a large workload and low detection efficiency, so it is urgent to propose a more accurate and efficient detection method.

[0004] To solve the problems of large workload and low efficiency of manual visual detection of corn aflatoxin, a corn aflatoxin detection method based on YOLO is disclosed in Chinese patent application No. CN113506242A, which includes the following steps: S1, building a machine vision detection platform, computer controlling ultraviolet light source and industrial camera asynchronous triggering, real-time acquisition of corn color RGB image; S2, image processing and segmentation of the acquired corn image; S3, establishing a YOLO deep learning neural network detection model; S4, real-time identification of whether the segmented image is infected with aflatoxin, obtaining the identification result of whether it is infected with aflatoxin, and outputting the identification result.

[0005] However, this scheme uses the specific fluorescence reaction of corn infected with aflatoxin under ultraviolet light source to image, and lacks effective identification means for vomitoxin, zearalenone, T-2 toxin, fumonisin, fumonisin A, B and other toxins produced by other molds such as fusarium, fusarium roseum, aspergillus fumigatus and aspergillus fumigatus, making the scope of application of this scheme not wide. SUMMARY

[0006] The application provides a warehouse mildewed corn recognition method and system based on image visual detection, aiming at solving the problem of narrow application range in detecting warehouse mildewed corn in the prior art.

[0007] To solve the above technical problems, the application provides a warehouse mildewed corn recognition method and system based on image visual detection, comprising the following steps:

[0008] S1: collecting real-time images of warehouse corn, pre-processing the real-time images to generate images to be detected.

[0009] S2: constructing a warehouse mildewed corn recognition model, wherein the recognition model is an improved Transformer model, comprising an image enhancement module, a feature extraction module, a candidate region generation module and a target detection module arranged in sequence.

[0010] S3: loading the image to be detected into the recognition model constructed in step S2 for mildewed corn recognition, to obtain a warehouse mildewed corn recognition result.

[0011] The image enhancement module comprises a gray scale transformation layer and three parallel convolution layers arranged in sequence, for pre-processing the image to be detected and enhancing the local information of the image to be detected, to output a first feature map.

[0012] The feature extraction module comprises four consecutive attention modules, the first attention module is a self-attention module based on a shift window, receiving the first feature map for processing to output a second feature map, the second attention module is a self-attention module based on a shift window, receiving the second feature map for processing to output a third feature map, the third attention module is a deformable attention module, receiving the third feature map for processing to output a fourth feature map, and the fourth attention module is a deformable attention module, receiving the fourth feature map for processing to output a fifth feature map.

[0013] The candidate region generation module comprises a feature pyramid network, a candidate region generation network and an alignment module, the feature pyramid network fuses the received second, third, fourth and fifth feature maps, outputs a sixth feature map to the candidate region generation network, generates a series of candidate regions with different length and width to the alignment module, and adjusts the candidate regions to a seventh feature map with fixed length and width.

[0014] The target detection module detects the seventh feature map to identify the type and position of the mildewed corn target.

[0015] Preferably, the method for constructing the warehouse mildewed corn recognition model in step S2 is as follows:

[0016] S1-1: Collecting a moldy image of corn, preprocessing the moldy image, then screening out a corn picture containing moldy corn, counting the types and quantities of mold, making the quantities of each type of mold the same, labeling foreign matter in the moldy image, and finally converting the labeled data into a data set in a set format, wherein the data set in the set format includes a training set and a test set divided in a set proportion.

[0017] S1-2: Inputting the training set into an improved Transformer model for iterative training, and saving the trained model after training for a set number of times.

[0018] S1-3: Testing the trained model using the test set, saving the model as a final recognition model if the test accuracy reaches a set threshold, and repeating the training process until the accuracy reaches the threshold if the test accuracy does not reach the threshold.

[0019] The preprocessing of the moldy image in step S1-1 includes image alignment and image noise reduction; the image alignment aligns the moldy image to a set resolution, and the image noise reduction uses median filtering to reduce the noise of the moldy image.

[0020] Preferably, the three parallel convolution layers include three parallel branches, the first branch is a 1x1 convolution, the second branch is a 3x3 convolution, and the third branch is a 5x5 convolution and a 3x3 deconvolution, and the outputs of the three branches are stacked along the channel direction to enhance the local information of the moldy image, and output a first feature map.

[0021] Preferably, the shift window-based self-attention module includes four linearly arranged layer normalization modules, and the output end of each layer normalization module is respectively inserted into a window-based self-attention layer, a multi-layer perception, a shift window-based self-attention layer, and a multi-layer perception.

[0022] Preferably, the deformable attention module includes four linearly arranged layer normalization modules, and the output end of each layer normalization module is respectively inserted into a deformable attention layer, a multi-layer perception, a deformable attention layer, and a multi-layer perception.

[0023] Preferably, the target detection module includes a class detection head and a position detection head, the class detection head classifies the seventh feature map to determine the class of mold, and the position detection head detects the position of the mold target by regressing the position of the real bounding box.

[0024] Preferably, the regression of the real bounding box is performed by translation and scaling operations, so that:

[0025]

[0026] wherein, K is the center point coordinate, width and height of the feature map; K is the center point coordinate, width and height of the feature map;

[0027] An image visual detection-based recognition system for moldy corn in storage, comprising: an imaging module and a detection module, the imaging module being used to collect real-time images of corn in storage and output to the detection module; the detection module adopting an improved Transformer model, comprising an image enhancement module, a feature extraction module, a candidate region generation module and a target detection module arranged in sequence, and being used to detect the real-time images and identify the positions and moldy categories of moldy corn.

[0028] The image enhancement module comprises a gray scale transformation layer and three parallel convolution layers arranged in sequence, and is used to pre-process the real-time images, enhance the local information of the real-time images and output a first feature map.

[0029] The feature extraction module comprises four consecutive attention modules, the first attention module being a self-attention module based on a shift window, receiving the first feature map for processing and outputting a second feature map, the second attention module being a self-attention module based on a shift window, receiving the second feature map for processing and outputting a third feature map, the third attention module being a deformable attention module, receiving the third feature map for processing and outputting a fourth feature map, and the fourth attention module being a deformable attention module, receiving the fourth feature map for processing and outputting a fifth feature map.

[0030] The candidate region generation module comprises a feature pyramid network, a candidate region generation network and an alignment module, the feature pyramid network fusing the received second, third, fourth and fifth feature maps, outputting a sixth feature map to the candidate region generation network, generating a series of candidate regions with different lengths and widths to the alignment module, and adjusting the candidate regions to a seventh feature map with a fixed length and width.

[0031] The target detection module detects the seventh feature map to identify the categories and positions of moldy corn targets.

[0032] Preferably, the pre-processing of the moldy image in step S1-1 comprises image alignment and image noise reduction, the image alignment aligning the moldy image to a set resolution, and the image noise reduction using median filtering to reduce the noise of the moldy image.

[0033] Preferably, the three-parallel convolution layer includes three parallel branches, the first branch is a 1x1 convolution, the second branch is a 3x3 convolution, and the third branch is a 5x5 convolution and a 3x3 deconvolution, and the outputs of the three branches are stacked in the channel direction to enhance the local information of the moldy image, and output the first feature map.

[0034] Preferably, the shift window-based self-attention module includes four layer normalization modules arranged in a line, and the output end of each layer normalization module is respectively inserted into a window-based self-attention layer, a multi-layer perception, a shift window-based self-attention layer, and a multi-layer perception.

[0035] Preferably, the deformable attention module includes four layer normalization modules arranged in a line, and the output end of each layer normalization module is respectively inserted into a deformable attention layer, a multi-layer perception, a deformable attention layer, and a multi-layer perception.

[0036] Preferably, the target detection module includes a class detection head and a position detection head, the class detection head classifies the seventh feature map to determine the class of mold, and the position detection head detects the position of the mold target by regressing the position of the real bounding box.

[0037] Preferably, the real bounding box regression operation is performed by translation and scaling operations, so that:

[0038]

[0039] In the formula, is the center point coordinate, width and height of the feature map K; is the center point coordinate, width and height of the real bounding box.

[0040] A warehouse moldy corn recognition system based on image visual detection, comprising: an imaging module and a detection module, the imaging module is used for collecting real-time images of warehouse corn and outputting the detection module; the detection module adopts an improved Transformer model, including sequentially arranged image enhancement module, feature extraction module, candidate region generation module and target detection module, which are used for detecting the real-time image, identifying the position and mold class of moldy corn.

[0041] The image enhancement module includes a gray scale transformation layer and a three-parallel convolution layer arranged in sequence, which is used for pre-processing the image to be detected, enhancing the local information of the image to be detected, and outputting the first feature map.

[0042] The feature extraction module includes four continuous attention modules, the first attention module is a self-attention module based on a shift window, receives the first feature map for processing and outputs a second feature map, the second attention module is a self-attention module based on a shift window, receives the second feature map for processing and outputs a third feature map, the third attention module is a deformable attention module, receives the third feature map for processing and outputs a fourth feature map, and the fourth attention module is a deformable attention module, receives the fourth feature map for processing and outputs a fifth feature map.

[0043] The candidate region generation module includes a feature pyramid network, a candidate region generation network and an alignment module, the feature pyramid network fuses the received second feature map, third feature map, fourth feature map and fifth feature map, outputs a sixth feature map to the candidate region generation network, generates a series of candidate regions with different length and width to the alignment module, and adjusts to a seventh feature map with fixed length and width.

[0044] The target detection module detects the seventh feature map, and identifies the type and position of the moldy corn target.

[0045] Compared with the prior art, the present application has the following technical effects:

[0046] 1. The moldy corn recognition method based on image visual detection provided by the present application uses computer vision to detect real-time images of stored corn collected in real time, and compared with the prior art which uses ultraviolet light source to irradiate and generate fluorescence to recognize aflatoxin, the recognition method provided by the present application can recognize multiple moldy corn characteristics, and expands the application range.

[0047] 2. The Transformer model of the moldy corn recognition method provided by the present application adds an image enhancement module to pre-process the to-be-detected image, which can enhance the local information of the to-be-detected image without changing the image size, improve the recognition ability of the model to the moldy corn target, and improve the problems of missed detection and false detection of the model in small target recognition.

[0048] 3. The deformable attention model is used in the feature extraction module of the Transformer model of the moldy corn recognition method provided by the present application instead of the conventional self-attention model, which reduces the risk of overfitting in the model training process, reduces the training cost of the Transformer model, and speeds up the model training process. DETAILED DESCRIPTION

[0049] Figure 1 is a flow chart of a moldy corn recognition method based on image visual detection of a storage according to the present application;

[0050] Figure 2It is an improved Transformer model structure diagram of the recognition method of the warehouse mildewed corn based on image visual detection according to the application;

[0051] Figure 3 It is a shift window-based self-attention module structure diagram of the improved Transformer model of the recognition method of the warehouse mildewed corn based on image visual detection according to the application;

[0052] Figure 4 It is a deformable attention module structure diagram of the improved Transformer model of the recognition method of the warehouse mildewed corn based on image visual detection according to the application. DETAILED DESCRIPTION

[0053] In order to make the objects, technical solutions and advantages of the application clearer, the technical solutions of the application will be described clearly and completely below with reference to the embodiments of the application and the accompanying drawings.

[0054] Please refer to Figure 1 , the flowchart of the recognition method according to the application, a recognition method of warehouse mildewed corn based on image visual detection, comprising the following steps:

[0055] S1: collecting real-time images of warehouse corn, pre-processing the real-time images to generate images to be detected.

[0056] S2: constructing a recognition model of warehouse mildewed corn, the recognition model being an improved Transformer model, comprising an image enhancement module, a feature extraction module, a candidate region generation module and a target detection module arranged in sequence.

[0057] S3: loading the image to be detected into the recognition model constructed in step S2 to recognize the mildewed corn, and obtaining the recognition result of the warehouse mildewed corn.

[0058] Please refer to Figure 2 , the improved Transformer model structure diagram of the recognition method according to the application. The image enhancement module comprises a gray scale transformation layer and three parallel convolution layers arranged in sequence, for pre-processing the real-time image Pic, enhancing the local information of the real-time image, and outputting a first feature map. The gray scale transformation layer adjusts the gray scale of the image by establishing a gray scale mapping, linearly expands or compresses the gray scale of the image, and thus achieves the purpose. The gray scale transformation layer adopts a linear transformation method: let the gray scale range of the image be , and the range of the image after linear transformation is , and The relationship between them is:

[0059]

[0060] The three parallel branches in the image enhancement module of the embodiment are: the first branch is a 1x1 convolution, the second branch is a 3x3 convolution, and the third branch is a 5x5 convolution and a 3x3 deconvolution. The feature maps output by the three branches are stacked in the channel direction to enhance the local information of the moldy image, and the first feature map is output. After image enhancement, the size of the image does not change, but the information is more abundant, thereby improving the global modeling capability of the network and improving the detection capability of the network for small target mold, effectively improving the problem of missed detection and false detection caused by insufficient detection precision of the target detection model.

[0061] The feature extraction module includes four consecutive attention modules. The first attention module is a self-attention module based on a shift window (SW-Attention), which receives the first feature map for processing and outputs the second feature map. The second attention module is a self-attention module based on a shift window, which receives the second feature map for processing and outputs the third feature map. The third attention module is a deformable attention module (Deformable Attention), which receives the third feature map for processing and outputs the fourth feature map. The fourth attention module is a deformable attention module, which receives the fourth feature map for processing and outputs the fifth feature map.

[0062] The self-attention module based on the shift window includes four linearly arranged layer normalization modules. The output end of each layer normalization module is respectively inserted into a window-based self-attention layer, a multi-layer perception, a self-attention layer based on a shift window, and a multi-layer perception. The deformable attention module includes four linearly arranged layer normalization modules. The output end of each layer normalization module is respectively inserted into a deformable attention layer, a multi-layer perception, a deformable attention layer, and a multi-layer perception. In the feature extraction module of the embodiment, two deformable attention modules are used to replace the self-attention module based on the shift window of the conventional Transformer model. In the feature extraction module, the block partition layer (PatchPartition) first performs block processing on the input first feature map and then inputs it to the consecutive four stages. Stage1 and Stage2 have the same structure, both of which are composed of a local attention module and a self-attention module based on a shift window. Stage3 and Stage4 have the same structure, both of which are composed of a local attention module and a deformable attention module.

[0063] The structure of the self-attention module based on the shift window of Stage1 and Stage2 is as follows: Figure 3As shown, the feature map sequentially passes through an LN (Layer Normalization) layer, a W-MSA (Window based Self-Attention) module, an LN layer, an MLP (Muti-Layer Perception) layer, an LN layer, an SW-MSA (Shifted Window based Self-Attention) module, an LN layer, and an MLP layer. The feature map before each LN layer is added to the feature map initially input into the shifted window based self-attention module. The Stage 1 outputs a second feature map, and the Stage 2 outputs a third feature map, so that the input feature information can be reused, while avoiding excessive increase in the amount of calculation and interference of redundant information.

[0064] The structure of the deformable attention module of the Stage 3 and the Stage 4 is as shown in Figure 4 As shown, the feature map sequentially passes through an LN layer, a DE-A (Deformable Attention) module, an LN layer, an MLP, an LN layer, a DE-A module, an LN layer, and an MLP layer. The Stage 3 outputs a fourth feature map, and the Stage 4 outputs a fifth feature map.

[0065] The candidate region generation module includes a FPN (Feature Pyramid Networks), an RPN (Region Proposal Networks), and an alignment module. The FPN fuses the received second feature map, the third feature map, the fourth feature map, and the fifth feature map, and outputs a sixth feature map to the RPN, which generates a series of candidate regions with different lengths and widths to the alignment module, which adjusts the candidate regions to a seventh feature map with fixed length and width. The sixth feature map includes multiple feature maps with different sizes. The candidate region generation module further processes the sixth feature map to generate a series of candidate regions with different lengths and widths, and then inputs the candidate regions to the alignment module to adjust the candidate regions to the seventh feature map with fixed length and width. Finally, the seventh feature map is input to the target detection module to detect the target type and position.

[0066] The target detection module includes a Class Head and a Box Head. The Class Head classifies the seventh feature map to determine the type of moldy area, and the Box Head detects the position of the moldy target by regressing the position of the real boundary box. The identification result is as shown in Figure 2As shown, the output Result picture includes the framed moldy area and the moldy type and its confidence.

[0067] The regression real boundary box operation is translated and scaled, so that:

[0068]

[0069] wherein, is the center point coordinate, width and height of the feature map K; is the center point coordinate, width and height of the real label box.

[0070] Further, the method for constructing the recognition model of the warehouse moldy corn in step S2 is specifically as follows:

[0071] S1-1: Collecting moldy images of corn, pre-processing the moldy images, then screening corn images containing moldy corn, counting the types and quantities of mold, making the number of each type of mold the same, labeling foreign matter in the moldy images, and finally converting the labeled data into a set of data in a set format, the set of data in the set format including a training set and a test set divided according to a set proportion.

[0072] S1-2: Input the training set into the improved Transformer model for iterative training, and save the trained model after training for a set number of times.

[0073] S1-3: Test the trained model using the test set, if the test accuracy rate reaches a set threshold, save the model as the final recognition model, if the test accuracy rate does not reach the threshold, repeat the training process until the accuracy rate reaches the threshold.

[0074] A recognition system for warehouse moldy corn based on image visual detection, comprising: an imaging module and a detection module, the imaging module being used to collect real-time images of warehouse corn and output to the detection module; the detection module adopts an improved Transformer model, including an image enhancement module, a feature extraction module, a candidate region generation module and a target detection module arranged in sequence, for detecting the real-time images, identifying the position of moldy corn and the moldy category.

[0075] The image enhancement module includes a gray scale transformation layer and three parallel convolution layers arranged in sequence, for pre-processing the real-time images, enhancing the local information of the real-time images, and outputting a first feature map.

[0076] The feature extraction module comprises four continuous attention modules, the first attention module is a self-attention module based on a shift window, receives the first feature map for processing and outputs a second feature map, the second attention module is a self-attention module based on a shift window, receives the second feature map for processing and outputs a third feature map, the third attention module is a deformable attention module, receives the third feature map for processing and outputs a fourth feature map, and the fourth attention module is a deformable attention module, receives the fourth feature map for processing and outputs a fifth feature map.

[0077] The candidate region generation module comprises a feature pyramid network, a candidate region generation network and an alignment module, the feature pyramid network fuses the received second feature map, third feature map, fourth feature map and fifth feature map, outputs a sixth feature map to the candidate region generation network, generates a series of candidate regions with different length and width to the alignment module, and adjusts the candidate regions into a seventh feature map with fixed length and width.

[0078] The target detection module detects the seventh feature map, and identifies the category and position of the moldy corn target.

[0079] The above only describes the preferred embodiments of the present application, and it should be noted that, for those skilled in the art, without departing from the inventive concept, a number of modifications and improvements can be made, which are all within the scope of the present application.

Claims

1. A method for identifying moldy corn in a warehouse based on image visual inspection, characterized in that, The method comprises the following steps: S1: collecting real-time images of stored corn, pre-processing the real-time images to generate images to be detected; S2: constructing a recognition model for moldy corn in storage, the recognition model being an improved Transformer model comprising sequentially arranged image enhancement module, feature extraction module, candidate region generation module and target detection module; S3: loading the images to be detected into the recognition model constructed in step S2 for recognition of moldy corn to obtain a recognition result of moldy corn in storage; The image enhancement module comprises sequentially arranged gray scale conversion layer and three parallel convolution layers, for pre-processing the images to be detected and enhancing local information of the images to be detected, and outputs a first feature map; The feature extraction module comprises four consecutive attention modules, the first attention module being a self-attention module based on a shift window, receiving the first feature map for processing and outputting a second feature map, the second attention module being a self-attention module based on a shift window, receiving the second feature map for processing and outputting a third feature map, the third attention module being a deformable attention module, receiving the third feature map for processing and outputting a fourth feature map, and the fourth attention module being a deformable attention module, receiving the fourth feature map for processing and outputting a fifth feature map; The candidate region generation module comprises feature pyramid network, candidate region generation network and alignment module, the feature pyramid network fuses the received second, third, fourth and fifth feature maps, outputs a sixth feature map to the candidate region generation network, generates a series of candidate regions with different length and width to the alignment module, and adjusts the candidate regions to a seventh feature map with fixed length and width; The target detection module detects the seventh feature map to identify the type and position of the moldy corn target.

2. The method according to claim 1, wherein, The method for constructing the recognition model for moldy corn in storage in step S2 is as follows: S1-1: collecting moldy images of corn, pre-processing the moldy images, then screening corn pictures containing moldy corn, counting the types and quantities of mold, making the quantity of each type of mold the same, labeling foreign matter in the moldy images, and finally converting the labeled data into a data set in a set format, the data set in the set format comprising a training set and a test set divided in a set proportion; S1-2: inputting the training set into the improved Transformer model for iterative training, saving the trained model after training for a set number of times; S1-3: testing the trained model using the test set, if the test accuracy rate reaches a set threshold, saving the model as the final recognition model, if the test accuracy rate does not reach the threshold, repeating the training process until the accuracy rate reaches the threshold.

3. The method of claim 2, wherein the method further comprises: The pre-processing of the moldy images in step S1-1 comprises image alignment and image noise reduction, the image alignment aligns the moldy images to a set resolution, and the image noise reduction uses median filtering to reduce the noise of the moldy images.

4. The method of claim 1, wherein the method is characterized by: The three-parallel convolutional layer includes three parallel branches, the first branch is a 1*1 convolution, the second branch is a 3*3 convolution, and the third branch is a 5*5 convolution and a 3*3 deconvolution, and the outputs of the three branches are stacked along the channel direction to enhance the local information of the moldy image and output a first feature map.

5. The method of claim 1, wherein the method is characterized by: The window-based self-attention module includes four linearly arranged layer normalization modules, and the output ends of each layer normalization module are respectively inserted into a window-based self-attention layer, a multi-layer perception, a window-based self-attention layer based on shifting, and a multi-layer perception.

6. The method of claim 1, wherein the method is characterized by: The deformable attention module includes four linearly arranged layer normalization modules, and the output ends of each layer normalization module are respectively inserted into a deformable attention layer, a multi-layer perception, a deformable attention layer, and a multi-layer perception.

7. The method of claim 1, wherein the method is characterized by: The target detection module includes a category detection head and a position detection head, the category detection head classifies the seventh feature map to determine the category of mold, and the position detection head detects the position of the mold target by regression of the real bounding box.

8. The method of claim 7, wherein the method further comprises: The regression of the real bounding box operation is performed through translation and scaling operations, so that: In the formula, are the center point coordinates, width and height of the feature map K; are the center point coordinates, width and height of the real label frame.

9. A system for identifying moldy corn in a storage based on image visual inspection, characterized in that, It comprises: An imaging module and a detection module, the imaging module is used for collecting real-time images of stored corn and outputting to the detection module; the detection module adopts an improved Transformer model, including sequentially arranged image enhancement module, feature extraction module, candidate region generation module and target detection module, which are used for detecting the real-time image, identifying the position and mold category of moldy corn; The image enhancement module includes a gray scale transformation layer and a three-parallel convolutional layer arranged in sequence, which is used for pre-processing the image to be detected and enhancing the local information of the image to be detected, and outputting a first feature map; The feature extraction module includes four consecutive attention modules, the first attention module is a window-based self-attention module based on shifting, which receives the first feature map and outputs a second feature map after processing, the second attention module is a window-based self-attention module based on shifting, which receives the second feature map and outputs a third feature map after processing, the third attention module is a deformable attention module, which receives the third feature map and outputs a fourth feature map after processing, and the fourth attention module is a deformable attention module, which receives the fourth feature map and outputs a fifth feature map after processing; The candidate region generation module includes a feature pyramid network, a candidate region generation network and an alignment module, the feature pyramid network fuses the received second feature map, third feature map, fourth feature map and fifth feature map, outputs a sixth feature map to the candidate region generation network, generates a series of candidate regions with different length and width to the alignment module, and adjusts to a fixed length and width of the seventh feature map; The target detection module detects the seventh feature map to identify the category and position of the moldy corn target.

Citation Information

Patent Citations

  • Corn aflatoxin detection method based on YOLO

    CN113506242A

  • Livestock image instance segmentation method based on improved Transform

    CN115115830A

  • Photovoltaic surface defect identification method and system based on end-to-end architecture

    CN115205233A