Seed cotton foreign fiber accurate identification method and device based on vision intelligence
Through visual intelligence technology, adaptive illumination normalization and parallel dual-stream feature encoding are performed on seed cotton foreign fibers, and error-guided segmentation stream decoding is performed using reconstructed error maps. This solves the problem of difficulty in identifying small and hidden foreign fibers in existing technologies, achieves efficient and accurate identification and automatic removal of foreign fibers, and improves cotton quality and production efficiency.
Patent Information
- Application Number
- CN202510946004.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-09
- Publication Date
- 2025-10-10
AI Technical Summary
Existing technologies make it difficult to effectively identify small, hidden foreign fibers in cotton, and most existing cleaning equipment is used in subsequent processing steps, resulting in incomplete and inefficient cleaning, which affects the quality of cotton and the uniformity of textile products.
A method for accurately identifying foreign fibers in seed cotton based on visual intelligence is adopted. The cotton layer image frames are acquired through a camera and adaptive illumination normalization processing is performed. Combined with parallel dual-stream feature encoding, error-guided segmentation stream decoding is performed using the reconstructed error map to generate a multi-channel semantic mask and accurately extract the seed cotton foreign fiber ROI image.
It achieves high-precision identification and automatic removal of small and hidden foreign fibers, improves cleaning efficiency, reduces production costs, and improves the quality of cotton products.
Smart Images

Figure CN120765620A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of seed cotton foreign fiber identification, and more specifically, to a method and device for accurately identifying seed cotton foreign fibers based on visual intelligence. Background Art
[0002] During cotton production and processing, the ingress of foreign fibers has always been the most significant factor affecting cotton quality. These foreign fibers, including but not limited to mulch film fragments, drip irrigation tape, chemical fibers, string, hair, and dust, are difficult to clean, highly harmful, and have a wide-ranging impact. With the widespread adoption of mechanized cotton harvesting in my country, cotton pickers are prone to dislodging residual mulch film and drip irrigation tape from fields during operation, creating the widespread problem of "three fibers," further exacerbating the severity of foreign fiber contamination. The presence of foreign fibers not only lowers the grade of cotton, leading to lower purchase prices and a direct impact on farmers' income, but also creates serious problems in subsequent textile processing. For example, foreign fibers are difficult to completely remove and are easily torn and broken during the carding process, creating smaller defects. This, in turn, leads to quality defects such as yarn entanglement, warp breakage, color spots on textile fabrics, and uneven dyeing. Therefore, accurately identifying foreign fibers during cotton processing is a critical issue that the cotton industry urgently needs to address.
[0003] Currently, detection technologies for foreign fibers in cotton primarily include ultrasonic, photoelectric, sensor, and optical detection. Ultrasonic detection utilizes the density difference between foreign fibers and cotton to identify them, but its accuracy is insufficient for relatively small foreign fibers, and its detection speed is insufficient to meet real-time requirements. Photoelectric detection utilizes the principle of color difference for identification. While simple and cost-effective, it is ineffective for detecting small foreign fibers with a color similar to cotton, and the lifespan and stability of the photoelectric tube need to be improved. Sensor detection has a wider range of applications but is relatively expensive. Optical detection, which uses industrial cameras to capture images of the cotton flow and processes and analyzes them through a computer system, is currently the most widely used and effective technology, offering a high detection rate and processing speed. However, existing foreign fiber cleaning equipment is mostly focused on cleaning lint (after ginning). This post-processing cleaning method has numerous drawbacks, including incomplete cleaning, low efficiency, the need for repeated cleaning, and the fact that foreign fibers are shredded during early processing, increasing the difficulty and cost of cleaning and resulting in varying quality in the final textile product.
[0004] Therefore, in order to overcome the deficiencies of the prior art, the present application provides a solution for accurately identifying foreign fibers in seed cotton based on visual intelligence. Summary of the Invention
[0005] This application is proposed to address the above-mentioned technical issues. The embodiments of this application provide a method and device for accurately identifying foreign fibers in seed cotton based on visual intelligence. By introducing advanced visual intelligence technology, this method achieves automated, high-precision identification of various foreign fibers in seed cotton, particularly addressing the existing issues of difficulty in effectively identifying small, hidden foreign fibers and the inefficiency caused by the post-cleaning process.
[0006] According to one aspect of the present application, a method for accurately identifying foreign fibers in seed cotton based on visual intelligence is provided, comprising: acquiring a cotton layer original image frame captured by a camera; performing adaptive illumination normalization preprocessing on the cotton layer original image frame to obtain a cotton layer normalized image; performing parallel dual-stream feature encoding on the cotton layer normalized image to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map; decoding and reconstructing the cotton layer reconstruction feature map to obtain a cotton layer reconstructed image, and calculating a reconstruction error based on the cotton layer reconstructed image and the cotton layer original image frame to obtain a reconstruction error map; based on the reconstruction error map, performing error-guided segmentation stream decoding on the cotton layer segmentation feature map to obtain a cotton layer multi-channel semantic mask; and extracting a seed cotton foreign fiber ROI image from the cotton layer original image frame based on the cotton layer multi-channel semantic mask.
[0007] In the above-mentioned method for accurately identifying foreign fibers in seed cotton based on visual intelligence, the cotton layer normalized image is subjected to parallel dual-stream feature encoding to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map, including: inputting the cotton layer normalized image into a shared backbone network; extracting an initial cotton layer segmentation feature map and an initial cotton layer reconstruction feature map from the middle layer of the shared backbone network; inputting the initial cotton layer segmentation feature map into a segmentation branch to obtain the cotton layer segmentation feature map; and inputting the initial cotton layer reconstruction feature map into a reconstruction branch to obtain the cotton layer reconstruction feature map.
[0008] In the above-mentioned method for accurately identifying foreign fibers in seed cotton based on visual intelligence, the shared backbone network is a MobileNetV2 network, and the intermediate layer is a block 13 expand relu layer.
[0009] In the above-mentioned method for accurately identifying foreign fibers in seed cotton based on visual intelligence, the cotton layer reconstruction feature map is decoded and reconstructed to obtain a cotton layer reconstruction image, and a reconstruction error is calculated based on the cotton layer reconstruction image and the cotton layer original image frame to obtain a reconstruction error map, including: inputting the cotton layer reconstruction feature map into a reconstruction head, and the reconstruction head upsampling and decoding the cotton layer reconstruction feature map to obtain the cotton layer reconstruction image; calculating the pixel-by-pixel subtraction between the cotton layer reconstruction image and the cotton layer original image frame to obtain an initial reconstruction error map; and performing Gaussian blur and normalization processing on the initial reconstruction error map to obtain the reconstruction error map.
[0010] In the above-mentioned method for accurately identifying foreign fibers in seed cotton based on visual intelligence, the pixel-by-pixel subtraction between the reconstructed image of the cotton layer and the original image frame of the cotton layer is calculated to obtain an initial reconstruction error map, including: calculating the pixel-by-pixel subtraction between the reconstructed image of the cotton layer and the original image frame of the cotton layer to obtain an initial three-channel reconstruction error map; taking the absolute value of the initial three-channel reconstruction error map to obtain an initial three-channel reconstruction error scalar map; and performing channel merging on the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map of a single channel.
[0011] In the above-mentioned method for accurately identifying foreign fibers in seed cotton based on visual intelligence, the initial three-channel reconstruction error scalar map is channel-merged to obtain the initial reconstruction error map of a single channel, including: calculating the mean of the reconstruction error values of the three channels in the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map.
[0012] In the above-mentioned method for precise identification of foreign fibers in seed cotton based on visual intelligence, based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask, including: copying the reconstruction error map in the channel dimension to obtain a reconstruction error tensor, and the reconstruction error tensor has the same number of channels as the cotton layer segmentation feature map; calculating the element-by-element multiplication between the reconstruction error tensor and the cotton layer segmentation feature map to obtain the cotton layer multi-channel semantic mask.
[0013] In the above-mentioned method for precise identification of seed cotton foreign fibers based on visual intelligence, based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask, including: calculating the vector bi-norm of each channel dimension vector of the cotton layer segmentation feature map to obtain a spatial distribution matrix; based on the reconstruction error map, constructing a global adaptive setting matrix of the spatial distribution matrix; establishing a composite cosine-like correlation between the reconstruction error map and the spatial distribution matrix to obtain an error-guided nonlinear correlation enhancement matrix; after weighted summation of the error-guided nonlinear correlation enhancement matrix and the global adaptive setting matrix, performing a point multiplication correction based on the reconstruction error map to obtain a reconstruction error guided matrix; calculating the element-by-element multiplication between the reconstruction error guided matrix and each local feature matrix of the cotton layer segmentation feature map to obtain the cotton layer multi-channel semantic mask.
[0014] According to another aspect of the present application, a device for accurately identifying foreign fibers in seed cotton based on visual intelligence is also provided. The device for accurately identifying foreign fibers in seed cotton based on visual intelligence includes a memory, a processor, and a computer program stored in the memory and executable on the processor. The device is characterized in that when the processor executes the computer program, the steps of the aforementioned method for accurately identifying foreign fibers in seed cotton based on visual intelligence are implemented.
[0015] Compared with the existing technology, the method and equipment for accurately identifying foreign fibers in seed cotton based on visual intelligence provided by this application first obtains the original image frame of the cotton layer through a camera and performs adaptive illumination normalization preprocessing to eliminate the interference of uneven illumination and color deviation on identification, thereby ensuring the stability and consistency of image quality. Subsequently, a parallel dual-stream feature encoding mechanism is introduced, in which one stream is used to extract the cotton layer segmentation feature map, aiming to directly identify the foreign fiber area; the other stream is used to extract the cotton layer reconstruction feature map, and the cotton layer reconstructed image is obtained by decoding and reconstructing, and the reconstruction error is calculated with the original image frame to generate a reconstruction error map. This reconstruction error map can effectively characterize the abnormal area in the cotton layer, that is, the presence of foreign fibers. Furthermore, the reconstruction error map is used to perform error-guided segmentation stream decoding on the cotton layer segmentation feature map, so that the segmentation process can make full use of abnormal information, thereby significantly improving the recognition accuracy and robustness of small and hidden foreign fibers. Finally, based on the generated multi-channel semantic mask of the cotton layer, the seed cotton foreign fiber ROI image is accurately extracted, providing accurate location information for the subsequent automatic removal of foreign fibers. In this way, the accuracy and efficiency of foreign fiber detection are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The above and other purposes, features, and advantages of the present application will become more apparent through a more detailed description of the embodiments of the present application in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application.
[0017] Figure 1 The figure shows a schematic flow chart of a method for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application.
[0018] Figure 2 The figure illustrates a schematic flow chart of S3 in the method for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application.
[0019] Figure 3 The figure illustrates a schematic flow chart of S4 in the method for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application.
[0020] Figure 4The figure illustrates a schematic flow chart of S42 in the method for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application.
[0021] Figure 5 The figure illustrates a schematic flow chart of S5 in the method for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application.
[0022] Figure 6 The figure shows a schematic structural diagram of a device for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] Below, the exemplary embodiments according to the present application will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application, and it should be understood that the present application is not limited to the exemplary embodiments described herein.
[0024] Based on this, this application provides a method for accurately identifying foreign fibers in seed cotton based on visual intelligence. Figure 1 The figure shows a schematic flow chart of a method for accurately identifying foreign fibers in seed cotton based on visual intelligence according to an embodiment of the present application. Figure 1 As shown, the method for accurately identifying seed cotton foreign fibers based on visual intelligence includes: S1, obtaining a cotton layer original image frame captured by a camera; S2, performing adaptive illumination normalization preprocessing on the cotton layer original image frame to obtain a cotton layer normalized image; S3, performing parallel dual-stream feature encoding on the cotton layer normalized image to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map; S4, decoding and reconstructing the cotton layer reconstruction feature map to obtain a cotton layer reconstructed image, and calculating the reconstruction error based on the cotton layer reconstructed image and the cotton layer original image frame to obtain a reconstruction error map; S5, based on the reconstruction error map, performing error-guided segmentation stream decoding on the cotton layer segmentation feature map to obtain a cotton layer multi-channel semantic mask; S6, extracting a seed cotton foreign fiber ROI image from the cotton layer original image frame based on the cotton layer multi-channel semantic mask.
[0025] For example, in step S1, a raw image frame of the cotton layer captured by a camera is acquired. It should be understood that foreign fibers in cotton are a key factor affecting cotton quality, and existing technologies for identifying and cleaning these foreign fibers in the seed cotton process have many shortcomings, especially for effectively detecting small, hidden foreign fibers. By adopting visual imaging technology, the problem of foreign fiber cleaning can be moved to the seed cotton processing stage, achieving accurate identification of various foreign fibers, thereby improving cleaning efficiency, reducing production costs, and ultimately improving cotton product quality.
[0026] In one embodiment, the cotton layer original image frame captured by the camera is obtained, including: first, the seed cotton to be detected is pretreated by an opening and flattening device, so that it can uniformly enter a transparent inspection channel. On both sides or above the inspection channel, multiple high-speed line array cameras are arranged as image acquisition devices. These high-speed cameras can capture cotton layer images at a very high rate, for example, 133 images per second, 1024 pixels per line, ensuring continuous and detailed monitoring of the fast-flowing cotton layer. In order to enhance the visual features of foreign fibers, a multi-spectral light source supplement device is also installed in the inspection channel, which includes infrared, X-ray, ultraviolet, polarized light and other supplementary light sources. According to the principle that different foreign fibers produce different prominent reflection characteristics under specific light sources, these light sources will project inspection light to the cotton layer in the inspection channel in a preset combination. The high-speed camera captures the cotton layer original image frame under the irradiation of the specific light source, and transmits the image data to the computer system in real time for subsequent processing.
[0027] Exemplarily, in step S2, the cotton layer original image frame is subjected to adaptive illumination normalization preprocessing to obtain a cotton layer normalized image. It should be understood that in the actual cotton processing environment, the illumination conditions may be complex and variable, for example, there are problems of uneven illumination, shadows, reflections or color deviation caused by different light source combinations. These inconsistent illumination conditions will cause the brightness, contrast and color distribution of the original image frame to be unstable, thereby seriously interfering with the feature extraction and accuracy of foreign fiber identification of the subsequent visual intelligent model. Through adaptive illumination normalization preprocessing, these external disturbances can be effectively eliminated, ensuring that the images input to the subsequent processing link have stable and consistent visual characteristics, thereby laying a solid foundation for accurate identification of foreign fibers.
[0028] In one embodiment, the cotton layer original image frame is subjected to adaptive illumination normalization preprocessing to obtain a cotton layer normalized image, including: first, the received cotton layer original image frame is sent to a special image color correction device for preprocessing. In this device, the core operation is adaptive illumination normalization. This means that fixed parameters are not used for adjustment, but dynamic optimization is performed according to the specific conditions of each image. Specifically, the process will adjust the brightness and contrast of the image according to the overall brightness distribution of the image, combined with the light source model determined through the construction of the illumination model and the light path analysis optimization. For example, if the image is overall dark, the brightness will be increased; if there is local overexposure, the brightness of the corresponding area will be reduced; if the image contrast is insufficient, the contrast will be enhanced by stretching the pixel intensity range or applying a S-shaped curve, etc. Nonlinear transformation. These adjustment parameters are dynamically calculated to ensure that the brightness mean value and contrast of each image reach the preset standardized level.
[0029] At the same time, in order to eliminate color deviation, color correction is also performed, which includes white balance processing and gamma correction. White balance processing aims to eliminate color deviation caused by different light sources or ambient light, so that white objects in the image appear pure white. The adaptive white balance algorithm includes the grayscale world assumption (assuming that the average value of all colors in the image should be achromatic) or the white point method (finding the brightest pixel area in the image and treating it as white). It will dynamically select and apply the appropriate white balance algorithm based on the color statistical characteristics of the image to ensure the authenticity and consistency of the image color. Gamma correction is a nonlinear operation used to adjust the grayscale response of the image, that is, to change the relationship between the image pixel value and the actual brightness. It is achieved through power function transformation, that is, Where V in is the input pixel value, V out is the output pixel value, A is a constant, and γ is the gamma value. Adaptive gamma correction dynamically selects an optimal γ value based on the brightness histogram distribution of the image to optimize the visual effect and information expression of the image. For example, when the image is overall dark or dark details need to be enhanced, a gamma value less than 1, such as 0.45 or 0.5, will be dynamically selected to improve the brightness response of the image.
[0030] Exemplarily, in step S3, the normalized image of the cotton layer is subjected to parallel dual-stream feature encoding to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map. It should be understood that the identification of foreign fibers requires not only accurate positioning of their position in the image (i.e., segmentation task), but also the ability to identify differences from normal cotton layer textures (i.e., anomaly detection or reconstruction task). Traditional single feature extraction methods are difficult to meet both requirements at the same time, or are not effective when dealing with complex backgrounds and small foreign fibers. By adopting parallel dual-stream feature encoding, different types of features optimized for segmentation tasks and reconstruction tasks can be extracted from the normalized image at the same time, thereby providing rich and complementary information for subsequent accurate identification and error guidance, significantly improving the system's ability to recognize and robustness of foreign fibers.
[0031] In one embodiment, Figure 2 As shown, the cotton layer normalized image is subjected to parallel dual-stream feature encoding to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map, including: S31, inputting the cotton layer normalized image into a shared backbone network; S32, extracting an initial cotton layer segmentation feature map and an initial cotton layer reconstruction feature map from the middle layer of the shared backbone network; S33, inputting the initial cotton layer segmentation feature map into a segmentation branch to obtain the cotton layer segmentation feature map; S34, inputting the initial cotton layer reconstruction feature map into a reconstruction branch to obtain the cotton layer reconstruction feature map.
[0032] Specifically, the normalized cotton layer image, after adaptive illumination normalization, is fed into a shared backbone network, specifically the MobileNetV2 network. MobileNetV2 was chosen as the backbone network due to its high performance on mobile and embedded devices. It significantly reduces model parameters and computational complexity while maintaining high accuracy, which is crucial for seed cotton foreign fiber detection systems that require real-time processing of large numbers of image frames.
[0033] The core design concept of MobileNetV2 is the inverted residual structure and linear bottleneck. The traditional residual block is usually a wide-narrow-wide structure, that is, the dimension is reduced first and then increased, while the inverted residual structure of MobileNetV2 is narrow-wide-narrow, that is, the low-dimensional input features are first expanded to high dimensions (expansion layer) through a 1x1 convolution layer, and then depth-separable convolution is performed in a high-dimensional space (depth-separable convolution layer), and finally the high-dimensional features are projected back to low dimensions through a 1x1 convolution layer (projection layer). This design allows the network to perform richer feature transformations in high-dimensional space, while greatly reducing the amount of computation through depth-separable convolution. Depth-separable convolution decomposes the standard convolution into two independent steps: first, depth-wise convolution, which applies a convolution kernel to each input channel independently without mixing channel information; second, point-by-point convolution, that is, 1x1 convolution, which is used to combine the output channels of depth-wise convolution. This decomposition significantly reduces the computational cost. For example, for an input channel number of C in , the number of output channels is C out , the convolution layer with a convolution kernel size of K×K, the computational complexity of standard convolution is approximately K×K×C in ×C out ×H×W, while the computational cost of depthwise separable convolution is about K×K×C in ×H×W+C in ×C out ×H×W, when K is large, the amount of calculation is reduced by nearly K 2 times. Furthermore, MobileNetV2 introduces a linear bottleneck, eliminating the use of nonlinear activation functions after the projection layer of the inverted residual block and instead directly outputting linear features. This is because in high-dimensional feature spaces, ReLU can potentially destroy feature integrity, while in low-dimensional bottleneck layers, linear activation better preserves information. Through these designs, MobileNetV2 is able to extract high-quality image features while maintaining a lightweight model.
[0034] Then, the initial cotton layer segmentation feature map and the initial cotton layer reconstruction feature map are extracted from an intermediate layer of the shared backbone network, the intermediate layer being a block 13 expand relu layer. The block 13 expand relu layer is a specific intermediate layer in the MobileNetV2 network, which is located in a relatively deep part of the network but not the deepest layer. The selection of this intermediate layer as the feature extraction point is the result of careful deliberation. Features extracted by too shallow layers (such as early layers of the network) are too low-level, mainly containing local information such as edges, textures, etc., lacking sufficient semantic context to distinguish complex fiber types; while features extracted by too deep layers (such as end layers of the network) contain rich semantic information, but their spatial resolution is usually low, and the detail information is lost, which is not conducive to subsequent pixel-level segmentation and accurate reconstruction. The block 13 expand relu layer is just at a balance point, it has extracted relatively abstract and high-level semantic features through multiple layers of convolution and nonlinear transformation, while still retaining sufficient spatial detail information, which is crucial for subsequent pixel-level segmentation and image reconstruction. Specifically, the block 13 expand relu layer is the ReLU activation output after the expand layer of the 13th inverted residual block of the MobileNetV2 network and before the deep convolution layer. At this stage, the input features are first expanded in channels (for example, from low-dimensional to high-dimensional) through a 1x1 convolution, and then a ReLU activation function is applied, thereby generating a high-dimensional feature map. This high-dimensional feature map contains rich, nonlinearly transformed semantic information, which is very suitable as the initial feature for subsequent segmentation and reconstruction tasks. The size and channel number of the feature map extracted from this layer will vary depending on the specific configuration of MobileNetV2, but generally it will be a feature representation of the original input image after multiple downsampling, for example, if the original image is 224x224, the feature map output by this layer may be 7x7 or 14x14, but the channel number will be very large, for example, 960 channels, to encode rich semantic information.
[0035] The feature map extracted from the block 13 expand relu layer will be duplicated into two parts, serving as the initial cotton layer segmentation feature map and the initial cotton layer reconstruction feature map. These two feature maps are then input into two parallel, specially designed lightweight convolutional neural network branches for further feature refinement.
[0036] One of the streams is the segmentation branch, which receives the initial cotton layer segmentation feature map and further processes it to produce the final cotton layer segmentation feature map. This segmentation branch is a lightweight convolutional neural network whose primary task is to extract and refine the most useful features for pixel-level semantic segmentation. It consists of a series of convolutional layers, activation functions (such as ReLU), and optional batch normalization layers. For example, this branch contains 2-4 consecutive 3x3 convolutional layers, each followed by ReLU activation and batch normalization to increase the network's nonlinear expressiveness and stabilize training. These convolutional layers further aggregate local information and extract higher-level semantic features, such as the texture, shape, and color patterns required to distinguish different foreign fiber types, such as cotton fibers, plastic film, hair, and drip irrigation tape. Because its goal is pixel-level classification, this branch focuses on preserving spatial information and avoids significant downsampling. Alternatively, techniques such as dilated convolutions may be used to expand the receptive field without sacrificing resolution. The final cotton layer segmentation feature map output contains rich semantic information, providing accurate pixel-level classification support for the subsequent segmentation decoder.
[0037] The other branch, the reconstruction branch, receives the initial cotton layer reconstruction feature map and further processes it to produce the final cotton layer reconstruction feature map. Similar to the segmentation branch, the reconstruction branch is also a lightweight convolutional neural network, but its design goal is to extract the most useful features for the image reconstruction task. It also consists of a series of convolutional layers, activation functions, and batch normalization layers, for example, 2-4 3x3 convolutional layers. However, unlike the segmentation branch, which focuses on distinguishing different classes, the reconstruction branch focuses more on learning the intrinsic structure, texture, and statistical regularities of the normal cotton layer image. It needs to capture sufficient information to accurately reconstruct the normal cotton layer image during the subsequent decoding process. This means that this branch focuses more on low-level image features (such as edges and texture details) and how they combine to form the overall structure of the cotton layer. By learning the normal pattern, when encountering foreign fibers, since these fibers do not conform to the normal cotton pattern, the model will produce larger errors in reconstruction, thereby highlighting their presence. The final output cotton layer reconstruction feature map will contain key information for accurate image reconstruction.
[0038] Exemplarily, in step S4, the cotton layer reconstruction feature map is decoded and reconstructed to obtain a cotton layer reconstruction image, and the reconstruction error is calculated based on the cotton layer reconstruction image and the cotton layer original image frame to obtain a reconstruction error map. It should be understood that foreign fibers appear abnormal in the cotton layer, and they have significant differences in texture, color, shape and other characteristics from normal cotton fibers. By training the model to learn the inherent laws of the normal cotton layer and attempt to reconstruct the image, any area that does not conform to the normal pattern will produce a large error during reconstruction. This reconstruction error can effectively highlight the presence of foreign fibers and separate them from the complex cotton layer background, thereby providing a strong abnormal signal for subsequent accurate identification.
[0039] In one embodiment, Figure 3 As shown, the cotton layer reconstruction feature map is decoded and reconstructed to obtain a cotton layer reconstructed image, and a reconstruction error is calculated based on the cotton layer reconstructed image and the cotton layer original image frame to obtain a reconstruction error map, including: S41, inputting the cotton layer reconstruction feature map into a reconstruction head, and the reconstruction head upsamples and decodes the cotton layer reconstruction feature map to obtain the cotton layer reconstructed image; S42, calculating the pixel-by-pixel subtraction between the cotton layer reconstructed image and the cotton layer original image frame to obtain an initial reconstruction error map; S43, performing Gaussian blur and normalization processing on the initial reconstruction error map to obtain the reconstruction error map.
[0040] In one embodiment, Figure 4 As shown, the pixel-by-pixel subtraction between the reconstructed image of the cotton layer and the original image frame of the cotton layer is calculated to obtain an initial reconstruction error map, including: S421, calculating the pixel-by-pixel subtraction between the reconstructed image of the cotton layer and the original image frame of the cotton layer to obtain an initial three-channel reconstruction error map; S422, taking the absolute value of the initial three-channel reconstruction error map to obtain an initial three-channel reconstruction error scalar map; S423, channel merging the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map of a single channel.
[0041] In one embodiment, performing channel merging on the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map of a single channel includes: calculating the mean of the reconstruction error values of the three channels in the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map.
[0042] Specifically, first, the cotton layer reconstruction feature map obtained in the step is input into a reconstruction head. The reconstruction head is a decoder part specifically used to restore the abstract feature map to an image. It performs upsampling decoding operations on the cotton layer reconstruction feature map, for example, through a deconvolution layer or bilinear interpolation combined with a convolution layer, its resolution is gradually restored to a size similar to the original image frame, thereby obtaining a cotton layer reconstruction image. This reconstructed image should theoretically be as close as possible to the normal cotton layer part in the original image, while the foreign fiber area may be poorly reconstructed because the model has not learned its normal pattern. Then, in order to quantify the reconstruction difference, a pixel-by-pixel subtraction operation is performed on the cotton layer reconstruction image and the cotton layer original image frame to obtain an initial three-channel reconstruction error map (corresponding to the error of the three RGB channels). This error map directly reflects the difference between the reconstructed image and the original image at each pixel. In order to ensure that the error value is positive and facilitate subsequent processing, the absolute value of each pixel value of the initial three-channel reconstruction error map is taken to obtain an initial three-channel reconstruction error scalar map. Subsequently, to integrate the multi-channel error information into a single anomaly intensity representation, the reconstruction error values of the three channels in the initial three-channel reconstruction error scalar map are averaged and merged into a single-channel initial reconstruction error map. Finally, to smooth the error distribution and reduce the impact of noise on subsequent guidance, the single-channel initial reconstruction error map is Gaussian blurred. The blurred error map is then normalized, for example, by scaling the pixel values to the range of 0-1, to obtain the reconstruction error map used for error guidance.
[0043] Exemplarily, in step S5, based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask. It should be understood that although the cotton layer segmentation feature map contains rich semantic information, for foreign fibers that are small, blurred, or similar in color to the background, it may be difficult to achieve high-precision pixel-level recognition by relying solely on the segmentation feature map. The reconstruction error map can effectively highlight the abnormal areas in the image, that is, the locations of the foreign fibers. By guiding the reconstruction error information into the segmentation stream, the sensitivity of the segmentation model to the foreign fiber area can be enhanced, so that it pays more attention to those areas with large reconstruction errors during the decoding process, thereby significantly improving the segmentation accuracy and robustness of the foreign fibers, and overcoming the defect of insufficient recognition accuracy of traditional segmentation methods under complex backgrounds.
[0044] In one embodiment, Figure 5As shown, based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask, including: S51, copying the reconstruction error map in the channel dimension to obtain a reconstruction error tensor, and the reconstruction error tensor has the same number of channels as the cotton layer segmentation feature map; S52, calculating the element-by-element multiplication between the reconstruction error tensor and the cotton layer segmentation feature map to obtain the cotton layer multi-channel semantic mask.
[0045] Specifically, first, the single-channel reconstruction error map obtained in step 1 is copied in the channel dimension so that its number of channels is the same as the number of channels of the cotton layer segmentation feature map obtained in step 1, thereby obtaining a reconstruction error tensor. This operation is to enable the reconstruction error information to match the dimension of the cotton layer segmentation feature map for subsequent fusion. Next, the element-by-element multiplication between the reconstruction error tensor and the cotton layer segmentation feature map is calculated. This multiplication operation is an effective error-guided fusion mechanism, which enables areas with large reconstruction errors to be enhanced in the cotton layer segmentation feature map, thereby effectively guiding the reconstruction error information into the segmentation task.
[0046] Preferably, instead of directly copying the reconstruction error map in the channel dimension and multiplying the principal elements, a more complex channel relationship modeling can be performed through the error guidance prediction error spatial distribution characteristics of the reconstruction error map in the channel dimension through the cotton layer segmentation feature map, so as to obtain a better error guidance effect.
[0047] In a preferred embodiment, based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask, including: first, calculating the vector bi-norm of each channel dimension vector of the cotton layer segmentation feature map to obtain a spatial distribution matrix, thereby obtaining driving signals of different strengths in error-based channel relationship modeling based on the spatial distribution characteristics. It should be understood that the cotton layer segmentation feature map is a high-dimensional abstract representation extracted from the original image by a deep learning model, and each channel generally encodes a specific visual pattern or semantic information in the image. In the actual scenario of seed cotton foreign fiber identification, different feature channels may be sensitive to background information such as the texture of the cotton itself, cotton seeds, and leaf debris, while other channels may be more sensitive to specific edges, colors, or texture changes of foreign fibers such as plastic, hair, and rope. By calculating the vector bi-norm of each channel dimension vector, the activation strength or information density of the channel across the entire spatial dimension can be quantified, that is, the degree of activity of the channel in the image space. This yields a metric that reflects the spatial distribution characteristics of each channel, enabling the provision of driving signals of varying strengths for different channels in subsequent error-based channel relationship modeling. For example, if a channel is highly activated in the foreign fiber region, its bimodal norm is likely to be large, indicating that this channel has the potential to contribute to foreign fiber identification.
[0048] Then, based on the reconstruction error map, a global adaptive setting matrix of the spatial distribution matrix is constructed, which is expressed as:
[0049]
[0050] Among them, M1 represents the reconstruction error map, M2 represents the spatial distribution matrix, ||·|| F Represents the matrix binorm, ⊙ represents element-by-element multiplication, exp represents the natural exponential function operation, that is, the natural exponential function is calculated for the value of each position in the matrix, and M3 represents the global adaptive setting matrix.
[0051] It should be understood that while the reconstruction error map can effectively indicate areas of foreign fiber, its error values may fluctuate significantly. For example, certain complex textures of cotton or subtle changes in illumination can also produce small reconstruction errors. If these noise errors are directly used for guidance, they may introduce false positives or lead to unreliable guidance. Therefore, a mechanism is needed to dynamically adjust the strength of error guidance to adapt to changes in the error space and suppress error fluctuations that may be caused by factors other than foreign fiber. By using the spatial distribution norm (i.e., spatial distribution matrix) calculated above as a global adaptive dynamic threshold, it is possible to dynamically identify and suppress areas of the error space where excessive variations in the error space may lead to unreliable guidance, thereby achieving channel-adaptive guided contribution of the error. By element-wise multiplying the spatial distribution matrix with the reconstruction error map (it should be understood that the reconstruction error map of a single channel is essentially a matrix that can perform matrix operations), and combining it with the natural exponential function, a global adaptive setting matrix is generated. This matrix can dynamically adjust the guidance contribution of each location based on the error magnitude and the spatial distribution characteristics of the feature. For example, in areas with high error values but corresponding low spatial distribution norm (presumably noise), the guidance contribution is suppressed.
[0052] At the same time, a composite cosine-like correlation is established between the reconstruction error map and the spatial distribution matrix to obtain an error-guided nonlinear correlation enhancement matrix, which is expressed as:
[0053]
[0054] Among them, M1 represents the reconstruction error map, M2 represents the spatial distribution matrix, ||·|| F represents the two-norm of the matrix, represents matrix multiplication, represents matrix addition, and M4 represents the error-guided nonlinear correlation enhancement matrix.
[0055] It should be understood that relying solely on simple dot multiplication or weighted summation may not be able to fully capture the complex nonlinear relationship between the reconstruction error information and the spatial distribution of the segmentation features, especially when the foreign fibers have diverse morphologies and are intertwined with the cotton background. A more refined correlation metric is needed. By constructing a composite cosine-like correlation metric to quantify the similarity or correlation between the reconstruction error map and the spatial distribution matrix, error-guided nonlinear correlation enhancement can be achieved in the channel dimension. This composite correlation can enhance the focus on foreign fiber areas by showing a high correlation between the error and the spatial distribution. For example, if the reconstruction error of a certain area is large and its corresponding segmentation feature channel exhibits a specific distribution pattern related to foreign fibers in space, then this correlation will be enhanced. When calculating the composite correlation product of the matrix, in order to perform scale alignment, both the reconstruction error map and the spatial distribution matrix can be first converted into square matrices for calculation and then restored to ensure the validity of the calculation. Through this nonlinear correlation enhancement, the model can more sensitively capture those foreign fiber areas that produce large errors during reconstruction and have specific distribution patterns in the segmentation feature space, thereby further improving the accuracy of segmentation. In particular, for those foreign fiber types that are difficult to identify by a single feature, this composite association can provide stronger distinguishing capabilities.
[0056] Therefore, after weighted summing the error-guided nonlinear correlation enhancement matrix and the global adaptive setting matrix, a point multiplication correction based on the reconstruction error map is performed to obtain a reconstruction error guidance matrix, which is expressed as:
[0057]
[0058] Wherein, M3 represents the global adaptive setting matrix, M4 represents the error-guided nonlinear correlation enhancement matrix, ω1 represents the first pre-training weight, ω2 represents the second pre-training weight, and the first pre-training weight and the second pre-training weight can be adjusted according to actual conditions, for example, ω1=0.4, ω2=0.6. Of course, this is only an example and is not a specific limitation. ⊙ represents element-by-element multiplication. In the above formula, it means multiplying each value of the matrix by the corresponding weight. Represents matrix addition, M ' 1 represents the reconstruction error guidance matrix.
[0059] It should be understood that by dynamically constructing the inter-channel error-spatial distribution interdependence relationship to model complex channel relationships, the coupling strength of the predetermined channel for the error-guiding behavior is determined at the pixel position corresponding to each cotton layer segmentation feature map involved in the spatial segmentation task. That is, by understanding the key representation of the error-guiding behavior, namely the channel spatial segmentation distribution of the feature map, a reconstruction error guidance with an internal channel coupling structure for the spatial error-guided segmentation task is formed to obtain a more accurate cotton layer multi-channel semantic mask. For example, for a specific pixel position, if its reconstruction error is large and its corresponding segmentation feature channel is highly correlated with foreign fiber in spatial distribution, then the guidance strength of this position will be significantly enhanced.
[0060] Finally, the element-by-element multiplication between the reconstruction error guidance matrix and the local feature matrices of the cotton layer segmentation feature map is calculated to obtain the cotton layer multi-channel semantic mask. It should be understood that the refined and fused reconstruction error guidance information is directly applied to each local feature of the cotton layer segmentation feature map, thereby achieving accurate enhancement and suppression of the foreign fiber area at the pixel level. By performing element-by-element multiplication of the reconstruction error guidance matrix with the local feature matrices of the cotton layer segmentation feature map, dynamic weighting of the segmentation features can be achieved. In the foreign fiber area, due to the large reconstruction error, the value of the guidance matrix will be higher, thereby enhancing the segmentation feature of the corresponding position, making it easier to be identified as foreign fiber in subsequent decoding; while in the normal cotton area, the reconstruction error is small, and the value of the guidance matrix will be lower, thereby suppressing unnecessary activation and reducing false positives. This dot multiplication operation significantly increases the activation intensity of the segmentation feature map in the foreign fiber area, while the activation intensity in the normal cotton area is effectively suppressed, thereby directly generating a cotton layer multi-channel semantic mask that can clearly distinguish different types of foreign fibers.
[0061] For example, in step S6, a seed cotton foreign fiber ROI image is extracted from the original cotton layer image frame based on the multi-channel semantic mask of the cotton layer. It should be understood that while the semantic mask can indicate the foreign fiber area, it is typically a binary or probability map and does not directly contain the rich visual details of the original image. By extracting the foreign fiber region of interest (ROI) from the original image frame, a complete image segment containing the foreign fiber and its surrounding background can be obtained. This is crucial for driving the actuator to accurately remove the foreign fiber, ensuring that only the foreign fiber is removed while minimizing the loss of usable cotton.
[0062] In one embodiment, based on the cotton layer multi-channel semantic mask, the seed cotton foreign fiber ROI image is extracted from the cotton layer original image frame, including: first, receiving the cotton layer multi-channel semantic mask generated in the previous step. This mask is an image with the same resolution as the original image frame, but its pixel values are no longer the original brightness or color information, but the probability of each pixel belonging to a specific foreign fiber category or a direct category label. For example, if designed to identify three foreign fibers of plastic, hair and rope, this semantic mask may contain three channels, each corresponding to a foreign fiber type, and the higher the pixel value in the channel, the greater the probability that the pixel belongs to the corresponding foreign fiber.
[0063] Then, threshold processing and binarization will be performed on this multi-channel semantic mask. For each foreign fiber category corresponding channel, a predefined confidence threshold will be set. For example, if a pixel's probability value in the plastic channel is higher than 0.7, the pixel is determined to belong to the plastic foreign fiber. All pixels above the threshold are marked as foreground (foreign fiber), and pixels below the threshold are marked as background (normal cotton). In this way, each foreign fiber channel is converted into a binary image, where the foreign fiber area is white (or 1), and the background is black (or 0). The setting of this threshold is critical, as it needs to balance the recall rate (find as many foreign fibers as possible) and the precision rate (reduce false positives), and is usually determined through cross-validation and optimization on a large amount of labeled data during the training phase.
[0064] Subsequently, in order to aggregate discrete pixels into complete foreign fiber objects, connected component analysis will be performed on each binarized foreign fiber channel. Connected component analysis is an image processing technique that can identify all connected pixel sets in an image. Through connected component analysis, the system can group all pixels that are determined to be the same type of foreign fiber and are spatially adjacent into an independent connected domain, i.e. a complete foreign fiber instance. This step can effectively filter out isolated noise points (i.e. individual pixels that are incorrectly classified but do not have enough neighbors to support them), and distinguish multiple independent foreign fibers present in the same image frame. For example, if there are two independent plastic films in the image, connected component analysis will identify them as two different connected domains.
[0065] For each identified foreign fiber connected domain, its minimum bounding rectangle will be further calculated. The minimum bounding rectangle is the smallest rectangular area that can completely contain the connected domain. This rectangle is defined by its top-left corner coordinates and bottom-right corner coordinates. The process of calculating the bounding box is efficient and standard, as it directly obtains the maximum and minimum x, y values from the pixel coordinates of the connected domain. Although more accurate contours can be extracted, for industrial rejection applications, the bounding box is usually sufficient to provide accurate location information, and the calculation cost is lower.
[0066] After obtaining the precise bounding box coordinates of each foreign fiber instance, these coordinates are used to accurately crop or extract the corresponding seed cotton foreign fiber ROI image from the originally captured raw image frame of the cotton layer. It is critical to select the original image frame for cropping because the original image frame contains the most complete and realistic visual information, including color, texture and brightness details without any processing. These details are crucial for subsequent visual verification, quality control, and driving physical rejection mechanisms (such as pneumatic nozzles) to perform precise operations. During actual cropping, in order to ensure the integrity of the foreign fiber and provide certain contextual information, a small margin is added to the calculated bounding box. This margin can be a fixed pixel value (for example, adding 10 pixels in each direction) or a percentage of the bounding box size to ensure that even if the foreign fiber edge recognition deviates slightly, the foreign fiber can be fully contained and provide a buffer area for subsequent rejection operations.
[0067] If multiple foreign fiber instances are detected in a frame of the original image, the above process will be repeated for each foreign fiber connected domain to generate multiple independent seed cotton foreign fiber ROI images. These ROI images, or more commonly, their precise bounding box coordinates and category information, are then transmitted to the system's control module. Based on this position information, the control module combines the conveying speed of the cotton flow and the physical position of the removal device to accurately calculate the time and space coordinates of the foreign fiber reaching the removal point. Finally, the control module will issue instructions to the actuator (for example, a pneumatic nozzle array) to activate the corresponding nozzle at the precise time and position where the foreign fiber passes, spraying high-pressure airflow to accurately remove the foreign fiber from the cotton flow.
[0068] In summary, the present application provides a method for accurately identifying foreign fibers in seed cotton based on visual intelligence. The method first uses a camera to capture raw image frames of the cotton layer and performs adaptive illumination normalization preprocessing to eliminate interference from uneven illumination and color deviation, ensuring stable and consistent image quality. Subsequently, a parallel dual-stream feature encoding mechanism is introduced. One stream is used to extract a cotton layer segmentation feature map, aiming to directly identify foreign fiber areas; the other stream is used to extract a cotton layer reconstruction feature map. This is decoded and reconstructed to obtain a reconstructed image of the cotton layer, and the reconstruction error is calculated compared with the original image frame to generate a reconstruction error map. This reconstruction error map effectively characterizes abnormal areas in the cotton layer, i.e., the presence of foreign fibers. Furthermore, the reconstruction error map is used to decode the cotton layer segmentation feature map using an error-guided segmentation stream, enabling the segmentation process to fully utilize abnormal information, significantly improving the accuracy and robustness of identifying small, hidden foreign fibers. Finally, based on the generated multi-channel semantic mask of the cotton layer, a seed cotton foreign fiber ROI image is accurately extracted, providing precise location information for subsequent automated foreign fiber removal. This improves the accuracy and efficiency of foreign fiber detection.
[0069] This application also provides a device for accurately identifying foreign fibers in seed cotton based on visual intelligence, such as Figure 6 As shown, the device 600 for accurately identifying seed cotton foreign fibers based on visual intelligence includes a memory 610, a processor 620, and a computer program 630 stored in the memory and executable on the processor. The device is characterized in that when the processor 620 executes the computer program 630, the steps of the method for accurately identifying seed cotton foreign fibers based on visual intelligence are implemented as described above.
[0070] An embodiment of the present application also provides a computer-readable storage medium, which stores computer program code. When the computer program code is run on a computer, the computer executes the above-mentioned related method steps to implement a method for accurately identifying foreign fibers in seed cotton based on visual intelligence provided by the above embodiment.
[0071] An embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement a method for accurately identifying foreign fibers in seed cotton based on visual intelligence provided by the above embodiment.
[0072] Among them, the system, computer-readable storage medium or computer program product provided in the embodiments of the present application are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0073] It should be noted that the order of the above embodiments of the present application is only for description and does not represent the advantages or disadvantages of the embodiments.
[0074] The processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous. The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referenced to each other. Each embodiment focuses on the differences from other embodiments.
Claims
1. A method for accurately identifying foreign fibers in seed cotton based on visual intelligence, characterized in that: include: Obtaining the original image frame of the cotton layer captured by the camera; Performing adaptive illumination normalization preprocessing on the cotton layer original image frame to obtain a cotton layer normalized image; Performing parallel dual-stream feature encoding on the cotton layer normalized image to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map; Decoding and reconstructing the cotton layer reconstruction feature map to obtain a cotton layer reconstruction image, and calculating a reconstruction error based on the cotton layer reconstruction image and the cotton layer original image frame to obtain a reconstruction error map; Based on the reconstruction error map, performing error-guided segmentation stream decoding on the cotton layer segmentation feature map to obtain a cotton layer multi-channel semantic mask; Based on the cotton layer multi-channel semantic mask, a seed cotton foreign fiber ROI image is extracted from the cotton layer original image frame.
2. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 1, wherein: Performing parallel dual-stream feature encoding on the cotton layer normalized image to obtain a cotton layer segmentation feature map and a cotton layer reconstruction feature map, including: Inputting the cotton layer normalized image into a shared backbone network; Extracting an initial cotton layer segmentation feature map and an initial cotton layer reconstruction feature map from the middle layer of the shared backbone network; Inputting the initial cotton layer segmentation feature map into the segmentation branch to obtain the cotton layer segmentation feature map; The initial cotton layer reconstruction feature map is input into the reconstruction branch to obtain the cotton layer reconstruction feature map.
3. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 2, characterized in that: The shared backbone network is a MobileNetV2 network, and the intermediate layer is a block 13 expand relu layer.
4. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 1, wherein: Decoding and reconstructing the cotton layer reconstruction feature map to obtain a cotton layer reconstruction image, and calculating a reconstruction error based on the cotton layer reconstruction image and the cotton layer original image frame to obtain a reconstruction error map, including: Inputting the cotton layer reconstruction feature map into a reconstruction head, and the reconstruction head upsampling and decoding the cotton layer reconstruction feature map to obtain the cotton layer reconstructed image; Calculating pixel-by-pixel subtraction between the cotton layer reconstructed image and the cotton layer original image frame to obtain an initial reconstruction error map; Gaussian blurring and normalization are performed on the initial reconstruction error map to obtain the reconstruction error map.
5. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 4, characterized in that: Calculating a pixel-by-pixel subtraction between the cotton layer reconstructed image and the cotton layer original image frame to obtain an initial reconstruction error map, comprising: Calculating pixel-by-pixel subtraction between the cotton layer reconstructed image and the cotton layer original image frame to obtain an initial three-channel reconstruction error map; performing absolute value processing on the initial three-channel reconstruction error map to obtain an initial three-channel reconstruction error scalar map; Channel merging is performed on the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map of a single channel.
6. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 5, characterized in that: Channel merging is performed on the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map of a single channel, comprising: calculating a mean of reconstruction error values of three channels in the initial three-channel reconstruction error scalar map to obtain the initial reconstruction error map.
7. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 1, characterized in that: Based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask, including: The reconstruction error map is replicated in the channel dimension to obtain a reconstruction error tensor, wherein the reconstruction error tensor has the same number of channels as the cotton layer segmentation feature map; Calculate the element-by-element multiplication between the reconstruction error tensor and the cotton layer segmentation feature map to obtain the cotton layer multi-channel semantic mask.
8. The method for accurately identifying seed cotton foreign fibers based on visual intelligence according to claim 1, characterized in that: Based on the reconstruction error map, the cotton layer segmentation feature map is subjected to error-guided segmentation stream decoding to obtain a cotton layer multi-channel semantic mask, including: Calculating the vector bi-norm of each channel dimension vector of the cotton layer segmentation feature map to obtain a spatial distribution matrix; constructing a global adaptive setting matrix of the spatial distribution matrix based on the reconstruction error map; Establishing a composite cosine-like correlation between the reconstruction error map and the spatial distribution matrix to obtain an error-guided nonlinear correlation enhancement matrix; After weighted summing the error-guided nonlinear correlation enhancement matrix and the global adaptive setting matrix, performing a point multiplication correction based on the reconstruction error map to obtain a reconstruction error-guided matrix; The element-by-element multiplication between the reconstruction error guidance matrix and each local feature matrix of the cotton layer segmentation feature map is calculated to obtain the cotton layer multi-channel semantic mask.
9. A device for accurately identifying foreign fibers in seed cotton based on visual intelligence, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method for accurately identifying foreign fibers in seed cotton based on visual intelligence are implemented as described in any one of claims 1 to 8.