A method and device for detecting mango anthracnose
By constructing a mango anthracnose identification model based on the CBAM attention mechanism and designing a multispectral camera device, the problems of low efficiency and poor accuracy in mango anthracnose detection in existing technologies have been solved, achieving efficient and accurate mango anthracnose detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SANYA INSTITUTE OF NANJING AGRICULTURAL UNIVERSITY
- Filing Date
- 2026-04-10
- Publication Date
- 2026-06-19
AI Technical Summary
There is a lack of efficient and accurate methods for detecting mango anthracnose in the current technology. Manual detection is inefficient, costly and yields unstable results, and existing instruments cannot effectively identify anthracnose.
A mango anthracnose identification model was constructed using a feature extraction subnetwork and a classification subnetwork based on the CBAM attention mechanism. A mango anthracnose detection device was designed, including a multispectral camera, a halogen lamp light source, and an embedded development board, to create a shadowless, uniform lighting environment for image capture.
It achieves efficient, rapid, and accurate identification of mango anthracnose. The device has a compact structure, is easy to use, reduces interference from natural light, and improves detection efficiency and accuracy.
Smart Images

Figure CN121998992B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and apparatus for detecting anthracnose in mangoes, belonging to the technical field of fruit quality testing devices. Background Technology
[0002] Mangoes are an important source of vitamins and dietary fiber. Mango anthracnose is a significant post-harvest disease that severely impacts mango yield and quality. As people's living standards improve, their demands for mango quality are also rising. Therefore, monitoring mango quality is essential. Currently, manual fruit selection and grading remains the mainstream method, which inevitably leads to drawbacks such as being time-consuming, labor-intensive, and having low accuracy.
[0003] Existing fruit testing instruments mainly study the ripeness and internal quality of fruits, such as sugar content and moisture content, but there are no instruments for anthracnose detection. Most existing experiments on anthracnose detection in mangoes are conducted in laboratories or by manual testing. Laboratory testing methods are time-consuming, costly, and have high operational barriers. Manual testing methods are inefficient, subjective, and prone to unstable results due to visual fatigue. Summary of the Invention
[0004] The technical problem to be solved by this invention is to provide a method for detecting mango anthracnose, which uses an innovative network structure design to construct a mango anthracnose identification model and efficiently realize the identification of mango anthracnose.
[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: The present invention designs a method for detecting mango anthracnose, which performs the following steps A to C to obtain a mango anthracnose identification model, and then applies the mango anthracnose identification model to identify the anthracnose disease area in the multispectral image of the target mango.
[0006] Step A. Obtain a preset number of mango multispectral sample images, and each mango multispectral sample image is synthesized from images captured by the corresponding preset channels of the mango. Also, the anthracnose disease area in each mango multispectral sample image is known. Then, a single mango multispectral sample image is used to form a single sample to obtain a sample set, which is then included in Step B.
[0007] Step B. Based on the feature extraction sub-network with the CBAM attention mechanism, connect the classification sub-network to build the network to be trained, and proceed to step C;
[0008] Step C. Based on the sample set, take the mango multispectral sample image in the sample as input and the anthracnose disease area in the mango multispectral sample image as output, train the network to be trained, and obtain the mango anthracnose recognition model.
[0009] In step B, the feature extraction subnetwork that introduces the CBAM attention mechanism includes at least two convolutional processing units connected in series from the input to the output. The input of the first convolutional processing unit constitutes the input of the feature extraction subnetwork, which is the input of the network to be trained. The output of the last convolutional processing unit constitutes the output of the feature extraction subnetwork. The output of the feature extraction subnetwork is connected to the input of the classification subnetwork, and the output of the classification subnetwork constitutes the output of the network to be trained.
[0010] Each convolutional processing unit includes, from input to output, a convolutional layer, a ReLU activation layer, a CBAM attention layer, and a pooling layer connected in series. The input of the convolutional layer constitutes the input of the convolutional processing unit, and the output of the pooling layer constitutes the output of the convolutional processing unit. The pooling layer in the first convolutional processing unit is a max pooling layer, and the pooling layer in the last convolutional processing unit is a global average pooling layer.
[0011] The classification subnetwork consists of a stretching layer, a dropout layer, a fully connected layer, and a softmax layer connected in series from the input to the output. The input of the stretching layer constitutes the input of the classification subnetwork, and the output of the softmax layer constitutes the output of the classification subnetwork, which is the output of the network to be trained.
[0012] As a preferred technical solution of the present invention: In step A, after obtaining each mango multispectral sample image, the pixel values of each pixel position in the mango multispectral sample image are normalized and updated for each mango multispectral sample image, thereby updating each mango multispectral sample image respectively.
[0013] Based on the mango anthracnose identification model, the pixel values at each pixel location in the multispectral image of the target mango are normalized and updated. Then, the mango anthracnose identification model is applied to identify the anthracnose-affected area in the multispectral image of the target mango.
[0014] As a preferred embodiment of the present invention: the CBAM attention layers in each convolutional processing unit have the same structure. Each CBAM attention layer includes a channel attention module, a spatial attention module, a first fusion module, and a second fusion module. In the structure of the CBAM attention layer, the input end of the channel attention module is connected to one of the input ends of the first fusion module, and the connection position constitutes the input end of the CBAM attention layer. The output end of the channel attention module is connected to the other input end of the first fusion module. The output end of the first fusion module is connected to the input end of the spatial attention module and one of the input ends of the second fusion module. The output end of the spatial attention module is connected to the other input end of the second fusion module. The output end of the second fusion module constitutes the output end of the CBAM attention layer.
[0015] The channel attention module includes a global max pooling layer, a global average pooling layer, a shared fully connected layer, a concatenation module, and a sigmoid activation layer. The inputs of the max pooling layer and the average pooling layer are connected, and their connection points constitute the input of the channel attention module. The outputs of the max pooling layer and the average pooling layer are respectively connected to the two inputs of the shared fully connected layer. The two outputs of the shared fully connected layer are respectively connected to the two inputs of the concatenation module. The shared fully connected layer processes the feature maps output by the max pooling layer and the average pooling layer, and outputs the results to the two inputs of the concatenation module. The concatenation module performs addition on the two input results. The output of the concatenation module is connected to the input of the sigmoid activation layer, and the output of the sigmoid activation layer constitutes the output of the channel attention module.
[0016] The spatial attention module includes a max pooling layer, an average pooling layer, a stitching module, a convolutional layer, and a sigmoid activation layer. The inputs of the max pooling layer and the average pooling layer are connected, and the connection point constitutes the input of the spatial attention module. The outputs of the max pooling layer and the average pooling layer are respectively connected to the two inputs of the stitching module. The output of the stitching module is connected to the input of the convolutional layer. The output of the convolutional layer is connected to the input of the sigmoid activation layer, and the output of the sigmoid activation layer constitutes the output of the spatial attention module.
[0017] As a preferred technical solution of the present invention: in step C, during the training process of the network to be trained, the result of the loss function is processed by exponential moving average to achieve smoothing of the loss result, and the training convergence is determined by the smoothing result.
[0018] Corresponding to the above, the technical problem that the present invention also needs to solve is to provide an apparatus for implementing a method for detecting mango anthracnose, which improves the working efficiency of practical applications of mango anthracnose detection by optimizing the architecture design of the multispectral image capturing environment.
[0019] To solve the aforementioned technical problems, this invention adopts the following technical solution: This invention designs a device for detecting mango anthracnose, comprising a housing, a power supply, a buffer pad, a shelf, an embedded development board, a multispectral camera, a door, and at least two halogen lamp light sources; wherein, the shelf is horizontally placed at a predetermined height inside the housing, dividing the housing into upper and lower spaces; the power supply, embedded development board, and multispectral camera are located in the upper space of the housing, and the power supply is connected to the embedded development board and the multispectral camera respectively for power supply; the multispectral camera is connected to the embedded development board; the buffer pad is located on the bottom surface of the lower space of the housing, and the central area of the upper surface of the buffer pad constitutes the mango placement area; each halogen lamp light source is located in the lower space of the housing, directly above the outer periphery of the mango placement area. At a specific height, power is supplied to each of the halogen lamps, which illuminate the mango placement area, providing a shadow-free and uniformly illuminated environment. The lens of the multispectral camera extends vertically downwards through a pre-set through-hole on the shelf and is positioned directly above the mango placement area. An opening, matching the size of the door, is located on the side of the enclosure corresponding to the lower interior space, allowing the door to be opened and closed. With the mangoes placed in the mango placement area, each halogen lamp illuminates the area, and the multispectral camera captures images of the mangoes through pre-set channels. These images are then sent to an embedded development board, which executes the mango anthracnose detection method based on the received images.
[0020] As a preferred technical solution of the present invention: it also includes brackets corresponding to each halogen lamp light source. Each bracket has the same structure, including a vertical pole, a height adjustment component, and a universal joint. In the bracket structure, the vertical pole is vertically set on the bottom of the lower space of the box, corresponding to the outer periphery of the mango placement area. The height adjustment component is provided with through holes penetrating the opposite end faces of each other, and the inner diameter of the through holes is adapted to the outer diameter of the vertical pole. The side of the height adjustment component in the straight line direction of the through holes is provided with mounting holes. The height adjustment component is fitted onto the vertical pole through its through holes and placed at various height positions on the vertical pole. The universal joint includes a base plate and a mounting plate that are hinged to each other and rotate at an angle to each other. The surface of the base plate is provided with mounting holes. The mounting holes on the base plate and the mounting holes on the height adjustment component are aligned and connected by bolts. The surface of the base plate and the side facing the height adjustment component are in parallel contact with each other and rotate at an angle to each other. A light source mounting seat is provided on the surface of the mounting plate facing away from the base plate for mounting the corresponding halogen lamp light source. Based on the mounting of the bracket, the illumination angle of the halogen lamp light source can be adjusted.
[0021] As a preferred embodiment of the present invention, it further includes universal joints and light-shielding covers corresponding to each halogen lamp light source. At least two longitudinal straight grooves penetrating the inner and outer spaces are provided on the side of the housing corresponding to the area of its lower inner space, and the number of grooves is equal to the number of halogen lamp light sources. Each groove, each halogen lamp light source, each universal joint, and each light-shielding cover corresponds one-to-one. Each universal joint is located in the lower inner space of the housing, and each universal joint has the same structure. Each universal joint includes a base plate and a mounting plate that are hinged together and rotate at an angle to each other. In the universal joint structure, the surface of the base plate is provided with… Mounting holes are installed on the substrate and align with corresponding grooves on the side of the enclosure, and are connected by bolts. The surface of the substrate and the area facing the inner side of the enclosure are in parallel contact and rotate at an angle to each other. Universal joints are installed at various height positions and angles along their respective grooves. A light source mounting seat is provided on the surface of the mounting plate facing away from the substrate for mounting the corresponding halogen lamp source. The halogen lamp source illumination angle can be adjusted based on the installation of the universal joints with respect to the corresponding grooves on the side of the enclosure. Each light-shielding cover is installed from the outside of the enclosure to cover the corresponding grooves on the side of the enclosure.
[0022] As a preferred technical solution of the present invention: In the universal joint structure, two side plates extend from two opposite positions on the edge of the substrate in the same direction on the same side of the substrate, and the two side plates are parallel to each other. Two side plates extend from two opposite positions on the edge of the mounting plate in the same direction on the mounting plate, and the two side plates are parallel to each other. The two side plates on the substrate and the two side plates on the mounting plate correspond to each other one-to-one. The two side plates on the substrate and the corresponding side plates on the mounting plate are partially connected in parallel. The line connecting the two movable connection positions between the substrate and the mounting plate is an axis that rotates at an angle to each other.
[0023] As a preferred embodiment of the present invention, the system further includes a display screen and PWM adjustment driver board modules corresponding to each halogen lamp light source. The embedded development board is connected to the corresponding halogen lamp light source through each PWM adjustment driver board module to achieve PWM modulation control of brightness. The display screen is placed on the outer surface of the enclosure and connected to the embedded development board to display the output information of the embedded development board. The power supply includes a main power conditioning module, a first conversion system, and a second conversion system. The main power conditioning module is used to connect to an external 15V power supply and performs filtering and safety protection in sequence to obtain an optimized 15V voltage. The output terminal of the power conditioning module is divided into three terminals. One output terminal is connected to the embedded development board to supply power. The other two output terminals are connected to the input terminals of the first conversion system and the second conversion system, respectively. The first conversion system performs voltage conversion on the received optimized 15V voltage to obtain a corresponding 12V voltage, which is used to supply power to the multispectral camera and the MOS driver transistors in each PWM adjustment driver board module. The second conversion system performs voltage conversion on the received optimized 15V voltage to obtain a corresponding 5V voltage, which is used to supply power to the display screen.
[0024] The mango anthracnose detection method and device of the present invention, compared with the prior art, have the following technical advantages:
[0025] This invention designs a method for detecting mango anthracnose. Taking mango as the analysis object, a training network based on the CBAM attention mechanism is constructed and trained to obtain a mango anthracnose recognition model. Comprehensive detection is performed on multispectral images of mangoes to achieve efficient identification of mango anthracnose. A corresponding device for implementing the detection method is designed. Based on the internal vertical space division of a box, multiple halogen lamps are arranged in the lower space to create a shadow-free and uniformly illuminated environment. A multispectral camera arranged in the upper space captures images of the mangoes below, obtaining images of the mangoes corresponding to preset channels. This minimizes the interference of natural light on image imaging. Furthermore, the layout design of the device structure achieves a small overall size and convenient use, enabling efficient and rapid identification of mango anthracnose with high accuracy, and has broad market application value. Attached Figure Description
[0026] Figure 1 This is a schematic flowchart of the image data preprocessing in the mango anthracnose detection method designed in this invention;
[0027] Figure 2 This is a diagram of the network structure to be trained in the mango anthracnose detection method designed in this invention;
[0028] Figure 3 This is a schematic diagram of the external structure of the device for implementing the mango anthracnose detection method of the present invention;
[0029] Figure 4 This is a schematic diagram of the internal structure of the device for implementing the mango anthracnose detection method of the present invention;
[0030] Figure 5 This is a schematic diagram of the back structure of the device for implementing the mango anthracnose detection method of the present invention;
[0031] Figure 6 This is a schematic diagram of the universal joint structure in the device for implementing the mango anthracnose detection method of the present invention;
[0032] Figure 7 This is a power supply architecture topology diagram of the device for implementing the mango anthracnose detection method of the present invention;
[0033] Figure 8 This is the circuit diagram of the optimized 15V shunt topology in the design of this invention;
[0034] Figure 9 This is a circuit diagram of the topology architecture for converting 12V to current and then shunting it in the design of this invention;
[0035] Figure 10 This is a circuit diagram of the topology architecture for converting to 5V and then shunting in this invention.
[0036] Figure 11 This is a schematic diagram of the human-computer interaction interface for the mango anthracnose detection method and device designed and implemented in this invention;
[0037] Figure 12 This is a schematic diagram of the operation process of the mango anthracnose detection method and device designed and implemented in this invention;
[0038] The components include: 1. Cabinet, 2. Power display screen, 3. Device switch, 4. Power supply, 5. Height adjustment component, 6. Universal joint, 7. Halogen lamp light source, 8. Upright pole, 9. Mango sample to be tested, 10. Pulley, 11. Buffer pad, 12. Lens, 13. Shelf, 14. Embedded development board, 15. Multispectral camera, 16. Cooling fan, 17. Display screen, 18. Pull rod, 19. Handle, 20. Door, 21. Light shield, 22. Lower sealing plate, 23. Upper sealing plate, and 24. Pre-drilled hole cover. Detailed Implementation
[0039] The specific embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0040] This invention designs a method and device for detecting mango anthracnose, which can be applied in practical situations, such as... Figure 3 and Figure 4As shown, the design device includes a housing 1, a power supply 4, a buffer pad 11, a shelf 13, an embedded development board 14, a multispectral camera 15, a door 20, a sealing plate, and at least two halogen lamp light sources 7; wherein, the embedded development board 14 can specifically be a small computer jesonorin. The nano application uses a shelf 13 horizontally placed at a preset height inside the housing 1, dividing the interior of the housing 1 into upper and lower spaces. A power supply 4, an embedded development board 14, and a multispectral camera 15 are located in the upper space of the housing 1, with the power supply 4 connected to both the embedded development board 14 and the multispectral camera 15 for power. The multispectral camera 15 is connected to the embedded development board 14. A through-hole is provided on the side panel of the housing 1 corresponding to the upper space, connecting the inner and outer spaces, and a cooling fan 16 is installed to dissipate heat for the devices in the upper space of the housing 1. A buffer pad 11 is placed on the bottom surface of the lower space inside the housing 1, with the central area of the upper surface of the buffer pad 11 forming a mango placement area. Each halogen lamp light source 7 is located in the lower space inside the housing 1, at a preset height directly above the outer perimeter of the mango placement area. The power supply 4... Each halogen lamp light source 7 is connected to power supply, and each halogen lamp light source 7 illuminates the mango placement area, providing a shadow-free and uniformly illuminated environment for the mango placement area; the lens 12 of the multispectral camera 15 passes vertically downward through the preset through hole on the shelf 13 and is located directly above the mango placement area; the side of the box 1 is provided with an opening of a size that matches the door 20, corresponding to the position of its lower internal space, and the door 20 is used to close and open the opening; the other side of the box 1 is open, forming an upper opening and a lower opening corresponding to the upper and lower spaces inside the box 1, respectively. The sealing plate includes an upper sealing plate 23 and a lower sealing plate 22 corresponding to the upper opening and the lower opening, respectively. The upper sealing plate 23 and the lower sealing plate 22 are detachably set at the upper opening position and the lower opening position, respectively, to achieve closure and opening.
[0041] In practical applications, for the positions of the power supply 4, embedded development board 14, and multispectral camera 15 on the upper surface of the shelf 13, grooves with a depth of 1cm are embedded downwards. The size of the grooves matches the bottom contour of the corresponding devices. Each device is placed in the corresponding groove, and the grooves provide horizontal constraints for the devices. The shelf 13 is specifically a perforated plate, and the connecting parts are wrapped around the holes on the shelf 13 and the corresponding devices to further fix the power supply 4, embedded development board 14, multispectral camera 15 to the upper surface of the perforated plate. The application of the perforated plate facilitates the routing of power supply lines between the power supply 4 and the halogen lamp light sources 7 in the lower space inside the housing 1. At the same time, considering the heat generation of each halogen lamp light source 7, the heat emitted by the halogen lamp light source 7 heats the surrounding air. The heated air rises through the uniform round holes on the shelf 13 to the upper space inside the housing 1, and then the heat is discharged by the cooling fan 16.
[0042] Regarding the application of the upper sealing plate 23 and the lower sealing plate 22 corresponding to the upper and lower openings on the side of the housing 1, in practical applications, such as Figure 3 and Figure 4 As shown, an aluminum edge with a width of 1.5cm extends inward from the inner side of the open edge, and screw holes with built-in threads are evenly arranged on the aluminum edge. These screw holes are matched with the screw holes with built-in threads at corresponding positions around the edge of the side sealing plate. The side sealing plate is connected to the corresponding open edge using countersunk screws. This design considers both appearance and ease of disassembly and maintenance. When it is necessary to remove the power supply 4 or the embedded development board 14 for software and hardware upgrades, simply unscrew the countersunk screws around the side sealing plate.
[0043] In practical applications, housing 1 is designed with light-shielding and light-absorbing properties in mind. The entire housing is black and made of aluminum alloy, which has a density of approximately 2.7 g / cm³ and a thermal conductivity of approximately 160-230 W / (m·K). Aluminum alloy is low in density, high in strength, and can form a dense oxide film on its surface, making it adaptable to different environments and providing excellent heat dissipation. Considering heat dissipation and lightweight design, housing 1 is a crucial part of the shooting environment, providing a light-free environment for image acquisition. This ensures that the information captured by the multispectral camera 15 sensor comes entirely from the light generated by the halogen lamp source 7, reducing interference from natural light and improving the accuracy of result judgment. In terms of the actual design and manufacturing process, housing 1 is modeled using SolidWorks software and manufactured using bending and welding processes. Parts requiring splicing are constructed by externally rounding the corners and internally reinforcing with aluminum welding. After manufacturing, powder coating is applied to enhance the housing's performance.
[0044] In the application, mangoes are placed in a mango placement area, and each halogen lamp light source 7 illuminates the mango placement area. A multispectral camera 15 takes pictures of the mangoes to obtain images of the mangoes corresponding to each preset channel, and sends them to the embedded development board 14. The embedded development board 14 then executes the mango anthracnose detection method based on the received images of the mangoes corresponding to each preset channel.
[0045] Regarding the layout of the halogen lamp light sources 7 in the lower space inside the housing 1, two specific implementation structures were designed in practical applications. Implementation one is as follows: Figure 4As shown, the design also includes brackets corresponding to each halogen lamp light source 7. Each bracket has the same structure, including a vertical rod 8, a height adjustment component 5, and a universal joint 6. In the bracket structure, the vertical rod 8 is vertically installed in the lower part of the box 1, corresponding to the outer periphery of the mango placement area. The height adjustment component 5 has through holes penetrating its opposite end faces, with the inner diameter of the through holes matching the outer diameter of the vertical rod 8. Mounting holes are provided on the side of the height adjustment component 5 in the direction of the through holes. The height adjustment component 5 is fitted onto the vertical rod 8 through its through holes and positioned at various heights on the vertical rod 8. The universal joint 6 includes a base plate and a mounting plate that are hinged to each other and rotate at an angle to each other. The base plate has mounting holes on its surface. The mounting holes on the base plate and the mounting holes on the height adjustment component 5 are aligned with each other and connected by bolts. The surface of the base plate and the side facing the height adjustment component 5 are in parallel contact with each other and rotate at an angle to each other. A light source mounting seat is provided on the surface of the mounting plate facing away from the base plate for mounting the corresponding halogen lamp light source 7. Based on the mounting of the bracket, the illumination angle of the halogen lamp light source 7 can be adjusted. In practical applications, four halogen lamp light sources 7 can be arranged in the four corners of the mango placement area.
[0046] Example 2, as Figure 3 As shown, the design includes universal joints 6 and light-shielding covers 21 corresponding to each halogen lamp light source 7. At least two longitudinal straight grooves penetrating the inner and outer spaces are provided on the side of the housing 1 corresponding to the area of its lower inner space. The number of grooves is equal to the number of halogen lamp light sources 7. In practical applications, the length of the grooves is, for example, 12cm. Each groove, each halogen lamp light source 7, each universal joint 6, and each light-shielding cover 21 corresponds one-to-one. Each universal joint 6 is located in the lower inner space of the housing 1. Each universal joint 6 has the same structure, and each universal joint 6 includes a base plate and a mounting plate that are hinged to each other and rotate at an angle. In the structure of the universal joint 6… Mounting holes are provided on the surface of the substrate. The mounting holes on the substrate are aligned with the corresponding sliding grooves on the side of the housing 1 and are connected by bolts. The surface of the substrate and the area facing the inner side of the housing 1 are in parallel contact with each other and rotate at an angle. The universal joint 6 is set at various height positions along the sliding groove it is connected to and is in various angle postures. A light source mounting seat is provided on the surface of the mounting plate facing away from the substrate for mounting the corresponding halogen lamp light source 7. Based on the installation of the universal joint 6 with the corresponding sliding groove on the side of the housing 1, the illumination angle of the halogen lamp light source 7 can be adjusted. Each light shielding cover 21 is installed from the outside of the housing 1 to cover the corresponding sliding groove on the side of the housing 1.
[0047] In the two embodiments of the above-mentioned layout of each halogen lamp light source 7, the application of the universal joint 6 structure is involved, such as... Figure 6As shown, regarding the design of the substrate and mounting plate structure, in practical applications, two side plates extend from two opposite positions on the edge of the substrate in the same direction, and the two side plates are parallel to each other. Two side plates extend from two opposite positions on the edge of the mounting plate in the same direction, and the two side plates are parallel to each other. The two side plates on the substrate and the two side plates on the mounting plate correspond one-to-one. The two side plates on the substrate and the corresponding side plates on the mounting plate are partially connected in parallel. The line connecting the two relatively movable connection positions between the substrate and the mounting plate is an axis that rotates at an angle to each other.
[0048] Regarding the practical application of the device, a display screen 17 and PWM adjustment drive board modules corresponding to each halogen lamp light source 7 are further designed. The embedded development board 14 is connected to the corresponding halogen lamp light source 7 through each PWM adjustment drive board module to realize PWM modulation control of brightness. The display screen 17 is placed on the outer surface of the housing 1 and is connected to the embedded development board 14 to display the output information of the embedded development board 14.
[0049] Regarding power supply, such as Figure 7 As shown, the power supply 4 in the actual application design includes a main power conditioning module, a first conversion system, and a second conversion system. The main power conditioning module is used to connect to an external 15V power supply and performs filtering and safety protection in sequence to obtain an optimized 15V voltage. The output of the power conditioning module is divided into three terminals. One output terminal is connected to the embedded development board 14 for power supply. The other two output terminals are connected to the input terminals of the first conversion system and the second conversion system, respectively. The first conversion system converts the received optimized 15V voltage to obtain a corresponding 12V voltage, which is used to supply power to the multispectral camera 15 and the MOS driver transistors in each PWM adjustment driver board module. The second conversion system converts the received optimized 15V voltage to obtain a corresponding 5V voltage, which is used to supply power to the display screen 17. In practical applications, the first voltage conversion system for achieving 15V→12V uses the XL4016E1 step-down branch, which is designed to be low-ripple and highly efficient; the second voltage conversion system for achieving 15V→5V uses the LM2596S to build a robust step-down branch; the overall power supply of the device designed in this invention adopts zoned power supply and star grounding, supplemented by surge suppression and EMC control, to achieve highly reliable operation.
[0050] The power supply topology in practical applications is as follows: Using a 15V DC power supply as the input, a series of components are connected in series: an ideal diode reverse connection protection unit consisting of LM74700 and AOD403, a PTC overcurrent protection unit, an SMBJ15CA bidirectional TVS transient suppression unit, and a π-type differential-mode EMI filter unit composed of a 470μF low-ESR electrolytic capacitor, a 22μH shielded power inductor, and a 330μF solid-state capacitor. This forms the main power supply conditioning module, creating a high-purity 15V main bus. Simultaneously, a single-point star grounding point is installed at the power inlet between the system ground and the enclosure ground, with a 2.2nF ohmmeter connected across it. Y2-class safety capacitors discharge high-frequency common-mode noise and effectively suppress radiated emissions. Simultaneously, three different capacitance values (0.1μF, 10μF, and 220μF) are connected in parallel between the power bus and the enclosure ground, forming a multi-scale decoupling network. This network collaboratively constructs a low-impedance power supply path covering a wide frequency band. Specifically, the 220μF electrolytic or solid-state capacitor provides large-capacity energy storage in the low-frequency range (10Hz to 100kHz), effectively suppressing voltage drops caused by load steps. The 10μF X7R multilayer ceramic capacitor (MLCC) exhibits extremely low impedance in the mid-frequency range (100kHz to 10MHz), filtering out mid-frequency ripple components in reverse power supply backflow and conducted interference. The 0.1μF X7R MLCC provides local transient current response in the high-frequency range (10MHz to above 100MHz), eliminating power supply ringing and coupling interference caused by high-speed digital circuit switching noise. The three complement each other through capacitance gradient and parasitic parameters, forming a power integrity guarantee mechanism under continuous spectrum, which significantly improves the power supply stability and anti-interference capability of highly sensitive loads such as the Orin Nano embedded development board under startup, operation and sudden change conditions.
[0051] The Orin Nano embedded development board 14 can be directly powered by a regulated 15V, such as Figure 8 As shown, the carrier board design complies with NVIDIA's official electrical specifications for 15V input compatibility. This direct-connect architecture eliminates the need for intermediate power conversion stages, improving system energy efficiency and reliability.
[0052] The 12V multispectral camera 15 and the four 12V halogen lamp light sources 7 are powered by a 12V bus circuit generated from a pure 15V voltage regulated by an XL4016E1. The switching frequency, compensation network, and output filtering of this step-down circuit need to be optimized in conjunction with the total load dynamic characteristics of the multispectral camera 15 and the four halogen lamp light sources 7. Figure 9 As shown, the output side uses solid capacitors and shielded power inductors to form an LC filter, suppressing the output ripple within the acceptable range for the multispectral camera 15. An output fuse (slow-blow type, rated current slightly higher than the maximum operating current) is also included to prevent overcurrent in the power supply circuit due to short circuits in subsequent stages or component failures.
[0053] The multispectral camera 15 branches are independently equipped with branch slow-blow fuses, local LC filtering (e.g., 10μH + 100μF), and TVS protection (SMAJ12A). Its power lines and data harnesses (e.g., MIPI, USB) are strictly separated in their wiring. Power ground and signal ground are combined at a single point near the connector of the multispectral camera 15 to minimize common impedance coupling and image noise. The four halogen lamp light sources 7 are each controlled by a PWM adjustment driver module. This module receives PWM signals from the embedded development board 14 (Orin Nano) and integrates MOSFET power switches, gate drivers, freewheeling diodes, and basic protection circuitry to achieve efficient dimming of the 12V halogen lamp light sources 7.
[0054] The HDMI interface display 17 uses an LM2596S step-down module as a second voltage converter to transform the regulated pure 15V into 5V output. Figure 10 As shown, a fusible fuse, a transient voltage suppressor diode (TVS), and a two-stage LC filter network are connected in series at the 5V output terminal of the LM2596S module. The TVS is a unidirectional device SMAJ5A, with its cathode connected to the 5V power supply line and its anode connected to system ground, used to clamp power-on surges and overshoot voltages caused by load switching. The two-stage LC filter network consists of a shielded power inductor (10 μH) and a low-ESR electrolytic or solid-state capacitor (100 μF), used to further attenuate the residual differential mode component in the switching noise of the LM2596S. The filtered 5V power supply supplies the display screen 17, which is connected to the embedded development board 14 (Orin) via a standard HDMI interface. Nano) enables high-speed video signal interconnection; the HDMI signal is routed separately away from the LM2596S power loop and LC filtering area, and the power ground and signal ground are connected at a single point near the HDMI connector, thereby blocking the coupling of switching power supply noise to the video signal link through conduction or radiation paths; thus, through the synergistic effect of fuse overcurrent protection, TVS transient suppression and LC filtering unit, the electromagnetic compatibility performance of the system is significantly improved while ensuring power supply reliability.
[0055] For EMC, grounding, and thermal design, power and logic are partitioned and laid out, with switching nodes kept as short as possible and loop area minimized. Enclosure 1 is coupled to system ground via a Y capacitor to reduce common-mode noise. Power traces and harnesses are routed with wire diameter and copper thickness selected based on maximum continuous current and temperature rise. Sufficient copper foil and ventilation holes are provided around the XL4016E1 and LM2596S, and a small-power fan is added for cooling. Port polarity and function are clearly marked to avoid incorrect insertion or reverse connection.
[0056] In practical applications, the display screen 17 is located on the top surface of the housing 1, which is bent at a 45° angle. In addition, to facilitate user operation, a device switch 3 is further arranged on the inclined top surface of the housing 1 to connect to the internal power supply 4. In order to achieve portability, the device is designed to use a lithium battery pack to power the power supply 4. Furthermore, a power display screen 2 is set on the inclined top surface of the housing 1, connected to the lithium battery pack, to display the remaining power of the lithium battery pack.
[0057] In practical applications, regarding the design of the door body 20, the door frame is formed corresponding to the open opening. Considering the light-blocking requirements, both the door frame and the door body 20 have internal groove and bending designs to minimize the entry of external natural light. Also, considering the ease of placing the fruit sample to be tested, a magnetic design is used between the door body 20 and the door frame. Specifically, magnetic patches are placed at the opposite positions of the edges of the door frame and the door body 20, thus achieving a magnetic connection and closure between the door body 20 and the door frame. A 4mm gap is reserved between the opposite positions of the edges of the door body 20 and the door frame, and two magnetic patches, each 2mm thick, are placed on the edges of the door body 20 and the door frame respectively. In their relative positions, the door body 20 and the door frame are magnetically attracted to each other. At the same time, one side of the door body 20 is hinged to the corresponding position of the door frame, so the door body 20 can rotate around the hinge position and connect with the door frame by magnetic attraction. In practical applications, a spring pin structure can be designed to connect the door body 20 and the door frame at the contact and separation positions. That is, two spring pin structures are set on the other side of the door body 20 opposite to the hinge side and at the corresponding edge of the door frame. After the door body 20 is closed to the door frame, the spring pin structure is further used to strengthen the connection between the door body 20 and the door frame.
[0058] In practical applications, the device is further designed with fixing holes for pulleys 10 at the bottom of the housing 1, symmetrically distributed at the four corners. The pulleys 10 are flat casters, with internal threads in the holes at the bottom of the housing 1. Each pulley is fixed with four bolts. Figure 5As shown, the top of the box 1 has two round holes for mounting handles 19 for easy lifting and movement. A slot for a pull rod 18 is designed at the upper rear of the box 1. The pull rod 18 is retractable; pulling it out allows the box 1 to be moved by dragging it. Rollers are used for movement, and feet are used for fixing. When not in use, the pull rod 18 can be retracted into the slot. The recessed slot conceals the top of the pull rod 18. The pull rod 18 is secured with bolts and nuts. The drilling positions on the rear of the box 1 were manually measured based on the actual hole positions of the pull rod 18. To ensure smooth installation, the holes are elliptical, allowing for installation slack. Furthermore, to address the light-blocking issue around the pull rod 18, two sealing plates are designed on the left and right sides, taking into account the installation sequence. A rectangular connecting plate with two threaded holes on the left and right sides connects to the two sealing plates, thus linking the two sealing plates together. The sealing plate is designed with a bend, and the threaded hole is drilled on the short side of the bend. The sealing plate is connected to the housing 1 by screws.
[0059] The upper half of the housing 1 features circular ventilation openings on both the left and right sides. A fan is fixed to the right-side opening to promote airflow within the device. The left side is the air inlet, and the right side is the air outlet. An internal cooling fan 16 accelerates airflow and facilitates the dissipation of heat generated by the embedded development board 14, the multispectral camera 15, and the halogen lamp light source 7. Additionally, a charging port, sized according to the battery charging hole, is designed on the right side of the housing 1 for charging the lithium battery pack. Rectangular holes of 30x40mm are pre-drilled on both sides for future additions and replacements of switches. Switch holes are designed on aluminum sheets; by replacing the aluminum sheets with corresponding sizes for the rectangular holes, changes in the number and shape of switches can be flexibly accommodated without modifying the entire housing.
[0060] Based on the practical application of the aforementioned design device, this invention implements a mango anthracnose detection method using an embedded development board 14 (NVIDIA Jetson Orin Nano). Built using the Python programming language, it integrates multispectral imaging data processing algorithms and convolutional neural network models to achieve real-time detection and classification of mango anthracnose. The software design emphasizes modularity, scalability, and real-time performance, ensuring efficient operation on portable devices. The system utilizes the PyTorch framework to build a deep learning model and combines it with the CBAM module to enhance feature representation capabilities. It also provides interpretable output results such as accuracy and loss curves, as well as confusion matrices, during the training and validation processes.
[0061] To ensure the reliability of experimental data and the stability of the multispectral imaging system, the imaging effect and spectral response accuracy of the multispectral camera 15 were verified before formally constructing the model.
[0062] First, several mango sample images were acquired, along with white board reference images and dark field reference images for subsequent spectral correction. The white board reference images were obtained using a standard polytetrafluoroethylene (PTFE) white board with a reflectance of 99%. The dark field reference images were obtained by completely obscuring the camera lens with an opaque cover to eliminate the influence of ambient light and sensor dark current. The white board was placed in the lower space inside chamber 1, at the same height as the mango samples used in the experiment, to ensure that the lighting conditions were consistent with the actual detection scenario. These steps yielded the original sample images, white reference images, and dark reference images, providing a foundation for subsequent spectral reflectance correction.
[0063] To eliminate the influence of ambient light fluctuations and sensor dark current on image data, white-black reference correction is performed on the acquired images. The correction formula is as follows:
[0064] ;
[0065] This formula converts the original signal into a reflectance value, effectively reducing interference from uneven illumination and equipment dark noise, and improving the physical authenticity and comparability of the data. Represents the pixel values of the original image of the sample; This represents the pixel values of the whiteboard reference image; This represents the pixel values of the dark-field reference image; This represents the corrected reflectance value.
[0066] To verify the response capability of the multispectral system to mango diseases, images of the same mango sample were continuously collected over several days until obvious lesions appeared on its surface.
[0067] The specific steps are as follows:
[0068] 1. When lesions appear on a sample, mark the lesion area in the image using a rectangle of a fixed size;
[0069] 2. Apply bounding boxes of the same size and position back to images at various time points before the onset of the disease to ensure that the spatial area analyzed in each time period is consistent;
[0070] 3. Calculate the average spectral value of all pixels within this region;
[0071] 4. Plot the spectral curves at different time points with the corrected spectral reflectance as the ordinate and the spectral band (unit: nm) as the abscissa.
[0072] By comparing the spectral curves at different time points, the reflectance of diseased samples was generally lower than that of healthy samples across multiple spectral bands. As the disease progressed, the spectral curves showed a significant attenuation trend, indicating that the multispectral camera can effectively capture the physicochemical changes that occur during disease development. This study verified the feasibility and stability of the multispectral imaging system in mango disease detection, demonstrating that the spectral data acquired by the system has good discriminative power, and providing a reliable data foundation for the subsequent establishment of a disease identification model based on multispectral features.
[0073] The mango anthracnose detection method designed in this invention, in practical applications, involves capturing images of the mango corresponding to preset channels and sending them to an embedded development board 14. The embedded development board 14 then processes the received multi-channel images according to... Figure 1 As shown, the method in step A is used to obtain a synthesized mango multispectral sample image, and the mango multispectral sample image in .npy format is obtained by normalization and updating. The designed mango anthracnose detection method is then implemented, including the construction of a sample set of a preset number of mango multispectral sample images, training a mango anthracnose identification model, and the synthesis of images of each preset channel corresponding to the target mango. The mango anthracnose identification model is then applied to identify the anthracnose disease area in the target mango multispectral image.
[0074] In practice, steps A through C are performed to obtain the mango anthracnose identification model.
[0075] Step A. Obtain a preset number of mango multispectral sample images, where each mango multispectral sample image is synthesized from images captured from preset channels of the mango, and the anthracnose disease area in each mango multispectral sample image is known. Then, for each mango multispectral sample image, the pixel values at each pixel position in the mango multispectral sample image are normalized and updated, thereby updating each mango multispectral sample image. Then, a single mango multispectral sample image is used to form a single sample, obtaining a sample set, which is then included in Step B.
[0076] In practical applications, mango samples with known anthrax disease areas are placed in the mango placement area in the lower space of the box 1 in the designed device. Based on the illumination of each halogen lamp light source 7, the multispectral camera 15 takes pictures of each mango sample, obtaining images of each mango sample corresponding to each preset channel, and marking the known anthrax disease areas. Then, the images are uploaded to the embedded development board 14, where the multi-channel images of the same mango sample from the same angle are synthesized and pixel normalization is performed to further construct a sample set.
[0077] Step B. Based on the feature extraction subnetwork with the CBAM attention mechanism, connect the classification subnetwork to build the network to be trained, and proceed to step C.
[0078] In practical applications, a feature extraction sub-network incorporating the CBAM attention mechanism is introduced, such as... Figure 2 As shown, the specific design includes at least two convolutional processing units connected in series from the input to the output. The local texture features and high-level semantic features of the mango's surface are extracted step by step through multiple convolutional processing units. The input of the first convolutional processing unit in sequence constitutes the input of the feature extraction sub-network, which is the input of the network to be trained. The output of the last convolutional processing unit in sequence constitutes the output of the feature extraction sub-network. The output of the feature extraction sub-network is connected to the input of the classification sub-network, and the output of the classification sub-network constitutes the output of the network to be trained.
[0079] Among them, such as Figure 2 As shown, each convolutional processing unit includes a convolutional layer, a ReLU activation layer, a CBAM attention layer, and a pooling layer connected in series from the input to the output. The input of the convolutional layer constitutes the input of the convolutional processing unit, and the output of the pooling layer constitutes the output of the convolutional processing unit. The pooling layer in the first convolutional processing unit is a max pooling layer, and the pooling layer in the last convolutional processing unit is a global average pooling layer.
[0080] The classification subnetwork consists of a stretching layer, a dropout layer, a fully connected layer, and a softmax layer connected in series from the input to the output. The input of the stretching layer constitutes the input of the classification subnetwork, and the output of the softmax layer constitutes the output of the classification subnetwork, which is the output of the network to be trained.
[0081] In each convolutional processing unit, the CBAM attention layer has the same structure, such as... Figure 2 As shown, each CBAM attention layer includes a channel attention module, a spatial attention module, a first fusion module, and a second fusion module. In the structure of the CBAM attention layer, the input end of the channel attention module is connected to one of the input ends of the first fusion module, and the connection position constitutes the input end of the CBAM attention layer. The output end of the channel attention module is connected to the other input end of the first fusion module. The output end of the first fusion module is connected to the input end of the spatial attention module and one of the input ends of the second fusion module. The output end of the spatial attention module is connected to the other input end of the second fusion module. The output end of the second fusion module constitutes the output end of the CBAM attention layer.
[0082] The attention module adaptively adjusts the response intensity of different feature channels and spatial locations through a serial weighting mechanism of the channel attention module and the spatial attention module, thereby automatically suppressing interference information such as fruit stalks, reflective areas and background noise, and guiding the model to focus on texture regions that are highly related to the pathological changes of anthrax.
[0083] like Figure 2 As shown, the channel attention module includes a global max pooling layer, a global average pooling layer, a shared fully connected layer, a concatenation module, and a sigmoid activation layer. The inputs of the max pooling layer and the average pooling layer are connected, and this connection constitutes the input of the channel attention module. The outputs of the max pooling layer and the average pooling layer are respectively connected to the two inputs of the shared fully connected layer. The two outputs of the shared fully connected layer are respectively connected to the two inputs of the concatenation module. The shared fully connected layer processes the feature maps output by the max pooling layer and the average pooling layer, and outputs the results to the two inputs of the concatenation module. The concatenation module performs addition on the two input results. The output of the concatenation module is connected to the input of the sigmoid activation layer, and the output of the sigmoid activation layer constitutes the output of the channel attention module.
[0084] like Figure 2 As shown, the spatial attention module includes a max pooling layer, an average pooling layer, a stitching module, a convolutional layer, and a sigmoid activation layer. The input of the max pooling layer is connected to the input of the average pooling layer, and the connection point constitutes the input of the spatial attention module. The outputs of the max pooling layer and the average pooling layer are respectively connected to the two inputs of the stitching module. The output of the stitching module is connected to the input of the convolutional layer. The output of the convolutional layer is connected to the input of the sigmoid activation layer, and the output of the sigmoid activation layer constitutes the output of the spatial attention module.
[0085] In the specific data processing process, the first step of the CBAM attention mechanism is to input the feature layer. The input is fed into the channel attention module to obtain the corresponding channel attention weights. Then and Multiplying yields the channel attention weighted result. Step 2: The input is fed into the spatial attention module to obtain spatial attention weights. Then and Multiplication yields the output feature layer The specific functions of channel attention and spatial attention mechanisms are as follows:
[0086] The channel attention module maintains the same channel dimension while compressing the spatial dimension. This module focuses on the importance of different channels. The input feature layer passes through two parallel global max pooling layers and a global average pooling layer, with its size ranging from... become The size is then processed through a shared fully connected layer module, where the number of channels is first compressed back to its original size. The channel is expanded to the original number of channels by a factor of (reduction rate), then activated by the ReLU function to obtain two activation results. These two results are then summed element-wise, and finally, the channel attention weights are obtained by applying the Sigmoid activation function. The formula for the channel attention module is shown below:
[0087] ;
[0088] ;
[0089] in, This indicates that the fully connected layer functions are shared. This represents the average pooling function; Represents the max pooling function; This represents the Sigmoid activation function. This represents the input value for the Sigmoid activation function.
[0090] The spatial attention module, in its data processing, maintains the spatial dimension while compressing the channel dimension. This module focuses on the target's location information and weights the channel attention results. Two results are obtained through max pooling and average pooling. The feature maps are then concatenated. Indicates the height of the feature map, The width of the feature map is represented by a 7×7 convolution, which transforms it into a 1-channel feature map. Then, it is passed through a Sigmoid activation function to obtain the spatial attention weights. The formula for the spatial attention module is shown below:
[0091]
[0092] in, This represents a 7×7 convolutional layer function.
[0093] Step C. Based on the sample set, using the mango multispectral sample image in the sample as input and the anthracnose disease area in the mango multispectral sample image as output, train the network to be trained to obtain the mango anthracnose recognition model.
[0094] During the training process of the network to be trained, a cross-entropy loss function based on class weights is introduced. By assigning differentiated weights to samples of different classes, the model's learning ability for samples of the minority classes is enhanced, improving the stability of the overall classification performance. Furthermore, the result of the loss function is processed using Exponential Moving Average (EMA) to smooth the loss result, and the smoothing result is used to determine whether the training has converged. EMA is a commonly used data smoothing method, widely used in signal processing, finance, machine learning, and other fields. Its core idea is to assign higher weights to recent data points, while the weights of historical data gradually decrease over time. In the machine learning training process, EMA is used to smooth the loss function, helping the system to more stably adjust the learning rate and avoid making unreasonable decisions due to short-term fluctuations during training. It suppresses random fluctuations during training, extracts optimization trend signals, and thus provides a stable basis for adaptive adjustment of the learning rate, improving the stability of the training process. The application of EMA brings four specific advantages: 1. Suppressing short-term noise. The loss during training can fluctuate due to batch differences, random augmentation, Dropout, etc. EMA can mitigate the impact of these occasional fluctuations; 2. Extracting long-term trends, the smoothed loss result better reflects whether the model is improving or deteriorating overall; 3. Stabilizing learning rate adjustment, the learning rate is automatically adjusted according to changes in the loss result. If it is not smoothed, the learning rate will rise and fall frequently, which is prone to oscillation. After smoothing, the learning rate changes more continuously and the training is more stable; 4. It can reduce the risk of misjudgment and prevent the model from being mistakenly judged as degrading due to an occasional increase in loss in a certain round.
[0095] Based on the execution of steps A to C above, a mango anthracnose identification model is obtained. Further, in practical applications, for the target mango (i.e., the mango to be analyzed), the target mango is placed in the mango placement area in the lower space of the box, and irradiated by each halogen lamp light source 7, as shown... Figure 1 As shown, the multispectral camera 15 takes pictures of the target mango, obtaining images of the target mango corresponding to each preset channel, and uploads them to the embedded development board 14. The multi-channel images are synthesized on the embedded development board 14 to obtain a multispectral image of the target mango, and the pixels are normalized and updated. Then, the mango anthracnose identification model is applied to identify the anthracnose disease area based on the multispectral image of the target mango.
[0096] In practical applications, the above design method involves directly deploying a human-computer interaction window on the device's display screen 17, such as... Figure 11As shown, the interface design integrates three major functional areas: system status monitoring, hardware control, and result visualization. Users can trigger the "Turn on Light Source," "Image Acquisition," and "Start Detection" commands with a single touch button on the interface. After the system background calls the image processing module, the detection results are displayed on the interface in the intuitive text format of "Healthy" or "Asymptomatic."
[0097] And in practical applications, such as Figure 12 As shown, the following operation process is implemented:
[0098] The operator moves the design device to the testing area by pulling the handle on the top of the box 1 or dragging the lever 18 at the rear of the box 1; turns on the power switch on the front of the box 1 to connect the built-in DC power supply, so that the embedded development board 14 (OrinNano) and each functional module can complete the power-on initialization and display the user interface on the touch screen.
[0099] The operator pulls the front door handle to open the magnetically designed door 20, places the mango sample to be tested on the buffer pad 11 in the lower space inside the box 1, and closes the door 20 to create a sealed, light-proof image acquisition environment.
[0100] After triggering the "image acquisition" command on the user interface, the main control unit synchronously performs the following operations: sends a control signal to the dedicated PWM drive module of the four halogen lamp light source 7 to adjust the light source to the preset brightness, providing uniform and shadow-free illumination for imaging; at the same time, it triggers the multispectral camera 15 to capture images and transmits the raw image data to the embedded development board 14; the embedded development board 14 then performs the operation of step A on the acquired image data to obtain a mango multispectral image, and then calls the mango anthracnose identification model to identify the anthracnose disease area based on the mango multispectral image, including three-directional classification: H-healthy, A-asymptomatic, and S-symptomatic.
[0101] The recognition results, along with the original or processed image information, are displayed on the display screen 17 in real time via the HDMI interface for the operator to interpret intuitively. If the confidence level of the recognition results is lower than the preset threshold, the user will be automatically prompted to re-examine the results on the interface.
[0102] After the test is completed, the operator can open the door 20 again to take out the sample, and the equipment will enter standby mode for the next test.
[0103] The mango anthracnose detection method designed in this invention, during actual testing, collected multispectral images of both sides of 97 small Taiwan mangoes. A spectroscopic camera (FS-3200T-10GE) was used for 9 consecutive days, resulting in 97*2*9=1746 mango images. Each mango image was tagged and categorized into three classes: healthy (0), asymptomatic (1), and diseased (2). Overexposed images were then removed, resulting in 1665 valid images. The images were randomly divided into a training set and a validation set at a 7:3 ratio. The training set was used to train the model, and the validation set was used to validate the trained model. Ultimately, the model achieved an accuracy rate of 89.2% in identifying mango disease conditions.
[0104] The mango anthracnose detection method designed in this invention uses mango as the analysis object, constructs a training network based on the CBAM attention mechanism, and trains it to obtain a mango anthracnose recognition model. It performs comprehensive detection on multispectral images of mangoes, achieving efficient identification of mango anthracnose. A corresponding device for implementing the detection method is designed, based on the internal upper and lower space division of a housing 1. Multiple halogen lamp light sources 7 are arranged in the lower space to create a shadow-free and uniformly illuminated environment. A multispectral camera 15 arranged in the upper space captures images of the mangoes below, obtaining images of the mangoes corresponding to preset channels. This minimizes the interference of natural light on image imaging. Furthermore, the layout design of the device structure achieves a small overall size and convenient use, resulting in efficient and rapid identification of mango anthracnose with high accuracy, and has broad market application value.
[0105] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A method for detecting anthracnose in mangoes, characterized in that: Perform steps A to C to obtain a mango anthracnose identification model, and then apply the mango anthracnose identification model to identify anthracnose-affected areas in the multispectral images of the target mango. Step A. Obtain a preset number of mango multispectral sample images, and each mango multispectral sample image is synthesized from images captured by the corresponding preset channels of the mango. Also, the anthracnose disease area in each mango multispectral sample image is known. Then, a single sample is formed by a single mango multispectral sample image to obtain a sample set, and then proceed to step B. Step B. Based on the feature extraction sub-network with the CBAM attention mechanism, connect the classification sub-network to build the network to be trained, and proceed to step C; Step C. Based on the sample set, take the mango multispectral sample image in the sample as input and the anthracnose disease area in the mango multispectral sample image as output, train the network to be trained, and obtain the mango anthracnose recognition model. In step B, the feature extraction subnetwork that introduces the CBAM attention mechanism includes at least two convolutional processing units connected in series from the input to the output. The input of the first convolutional processing unit constitutes the input of the feature extraction subnetwork, which is the input of the network to be trained. The output of the last convolutional processing unit constitutes the output of the feature extraction subnetwork. The output of the feature extraction subnetwork is connected to the input of the classification subnetwork, and the output of the classification subnetwork constitutes the output of the network to be trained. Each convolutional processing unit includes, from input to output, a convolutional layer, a ReLU activation layer, a CBAM attention layer, and a pooling layer connected in series. The input of the convolutional layer constitutes the input of the convolutional processing unit, and the output of the pooling layer constitutes the output of the convolutional processing unit. The pooling layer in the first convolutional processing unit is a max pooling layer, and the pooling layer in the last convolutional processing unit is a global average pooling layer. The classification subnetwork consists of a stretching layer, a dropout layer, a fully connected layer, and a softmax layer connected in series from the input to the output. The input of the stretching layer constitutes the input of the classification subnetwork, and the output of the softmax layer constitutes the output of the classification subnetwork, which is the output of the network to be trained.
2. The method for detecting mango anthracnose according to claim 1, characterized in that: In step A, after obtaining each mango multispectral sample image, the pixel values at each pixel position in each mango multispectral sample image are normalized and updated, thereby updating each mango multispectral sample image. Based on the mango anthracnose identification model, the pixel values at each pixel location in the multispectral image of the target mango are normalized and updated. Then, the mango anthracnose identification model is applied to identify the anthracnose-affected area in the multispectral image of the target mango.
3. The method for detecting mango anthracnose according to claim 1, characterized in that: The CBAM attention layers in each convolutional processing unit have the same structure. Each CBAM attention layer includes a channel attention module, a spatial attention module, a first fusion module, and a second fusion module. In the structure of the CBAM attention layer, the input end of the channel attention module is connected to one of the input ends of the first fusion module, and the connection position constitutes the input end of the CBAM attention layer. The output end of the channel attention module is connected to the other input end of the first fusion module. The output end of the first fusion module is connected to the input end of the spatial attention module and one of the input ends of the second fusion module. The output end of the spatial attention module is connected to the other input end of the second fusion module. The output end of the second fusion module constitutes the output end of the CBAM attention layer. The channel attention module includes a global max pooling layer, a global average pooling layer, a shared fully connected layer, a concatenation module, and a sigmoid activation layer. The inputs of the max pooling layer and the average pooling layer are connected, and their connection points constitute the input of the channel attention module. The outputs of the max pooling layer and the average pooling layer are respectively connected to the two inputs of the shared fully connected layer. The two outputs of the shared fully connected layer are respectively connected to the two inputs of the concatenation module. The shared fully connected layer processes the feature maps output by the max pooling layer and the average pooling layer, and outputs the results to the two inputs of the concatenation module. The concatenation module performs addition on the two input results. The output of the concatenation module is connected to the input of the sigmoid activation layer, and the output of the sigmoid activation layer constitutes the output of the channel attention module. The spatial attention module includes a max pooling layer, an average pooling layer, a stitching module, a convolutional layer, and a sigmoid activation layer. The inputs of the max pooling layer and the average pooling layer are connected, and the connection point constitutes the input of the spatial attention module. The outputs of the max pooling layer and the average pooling layer are respectively connected to the two inputs of the stitching module. The output of the stitching module is connected to the input of the convolutional layer. The output of the convolutional layer is connected to the input of the sigmoid activation layer, and the output of the sigmoid activation layer constitutes the output of the spatial attention module.
4. The method for detecting mango anthracnose according to claim 1, characterized in that: In step C, during the training process of the network to be trained, the result of the loss function is processed by exponential moving average to smooth the loss result, and the training convergence is determined by the smoothing result.
5. A mango anthracnose detection device, based on the mango anthracnose detection method according to any one of claims 1 to 4, characterized in that: The system includes a housing (1), a power supply (4), a cushioning pad (11), a shelf (13), an embedded development board (14), a multispectral camera (15), a door (20), and at least two halogen lamp light sources (7). The shelf (13) is placed horizontally at a preset height inside the housing (1), dividing the interior of the housing (1) into upper and lower spaces. The power supply (4), the embedded development board (14), and the multispectral camera (15) are located in the upper space inside the housing (1), and the power supply (4) is connected to the embedded development board (14) and the multispectral camera (15) respectively for power supply. The multispectral camera (15) is connected to the embedded development board (14). The cushioning pad (11) is located on the bottom surface of the lower space inside the housing (1), and the central area of the upper surface of the cushioning pad (11) constitutes the mango placement area. Each halogen lamp light source (7) is located in the lower space inside the housing (1), directly above the outer periphery of the mango placement area. At a height position, the power supply (4) is connected to each halogen lamp light source (7) for power supply. Each halogen lamp light source (7) illuminates the mango placement area, providing a shadow-free and uniformly illuminated environment for the mango placement area. The lens (12) of the multispectral camera (15) passes vertically downward through the preset through hole on the shelf (13) and is located directly above the mango placement area. The side of the box (1) is set with an opening of a size that matches the door (20) corresponding to the position of its lower internal space. The door (20) is used to close and open the opening. Based on the mango being placed in the mango placement area, each halogen lamp light source (7) illuminates the mango placement area. The multispectral camera (15) takes pictures of the mango, obtains the images of the mango corresponding to each preset channel, and sends them to the embedded development board (14). The embedded development board (14) executes the mango anthrax detection method based on the received images of the mango corresponding to each preset channel.
6. The mango anthracnose detection device according to claim 5, characterized in that: It also includes brackets corresponding to each halogen lamp light source (7). Each bracket has the same structure and includes a vertical rod (8), a height adjustment component (5), and a universal joint (6). In the bracket structure, the vertical rod (8) is vertically set in the lower part of the box (1) and corresponds to the outer periphery of the mango placement area. The height adjustment component (5) is provided with through holes that penetrate each other's opposite end faces, and the inner diameter of the through holes is adapted to the outer diameter of the vertical rod (8). The height adjustment component (5) is provided with mounting holes on the side of the vertical rod in the straight line direction opposite to the through holes. The height adjustment component (5) is fitted onto the vertical rod with its through holes. (8) and placed on the upright (8) at various height positions; the universal joint (6) includes a base plate and a mounting plate that are hinged to each other and rotate at an angle to each other. The base plate has mounting holes on its surface. The mounting holes on the base plate and the mounting holes on the height adjustment member (5) are aligned with each other and connected by bolts. The base plate and the side facing the height adjustment member (5) are in parallel contact with each other and rotate at an angle to each other. A light source mounting seat is provided on the surface of the mounting plate facing away from the base plate for mounting the corresponding halogen lamp light source (7). Based on the mounting of the bracket, the irradiation angle of the halogen lamp light source (7) can be adjusted.
7. The mango anthracnose detection device according to claim 5, characterized in that: It also includes universal joints (6) and light shields (21) that correspond one-to-one with each halogen lamp light source (7). At least two longitudinal straight grooves that run through the inner and outer spaces are provided on the side of the housing (1) corresponding to the area of its lower inner space. The number of grooves is equal to the number of halogen lamp light sources (7). Each groove, each halogen lamp light source (7), each universal joint (6), and each light shield (21) correspond one-to-one. Each universal joint (6) is located in the lower inner space of the housing (1). Each universal joint (6) has the same structure. Each universal joint (6) includes a base plate and a mounting plate that are hinged to each other and rotate at an angle to each other. In the structure of the universal joint (6), the surface of the base plate is provided with a mounting plate. The mounting holes on the substrate and the corresponding sliding grooves on the side of the box (1) are aligned and connected by bolts. The surface of the substrate and the area facing the inner side of the box (1) are in parallel contact with each other and rotate at an angle. The universal joint (6) is set at various height positions along the sliding groove it is connected to, and is in various angle postures. A light source mounting seat is set on the surface of the mounting plate facing away from the substrate for mounting the corresponding halogen lamp light source (7). Based on the installation of the universal joint (6) with respect to the corresponding sliding groove on the side of the box (1), the irradiation angle of the halogen lamp light source (7) can be adjusted. Each light shielding cover (21) is installed from the outside of the box (1) with respect to the corresponding sliding groove on the side of the box (1).
8. The mango anthracnose detection device according to claim 6 or 7, characterized in that: In the universal joint (6) structure, two side plates extend from two opposite positions on the edge of the substrate to the same side of the substrate, and the two side plates are parallel to each other. Two side plates extend from two opposite positions on the edge of the mounting plate to the same side of the mounting plate, and the two side plates are parallel to each other. The two side plates on the substrate and the two side plates on the mounting plate correspond to each other one-to-one. The two side plates on the substrate and the corresponding side plates on the mounting plate are partially connected in parallel. The line connecting the two movable connection positions between the substrate and the mounting plate is an axis that rotates at an angle to each other.
9. The mango anthracnose detection device according to claim 5, characterized in that: It also includes a display screen (17) and PWM adjustment driver board modules corresponding to each halogen lamp light source (7). The embedded development board (14) is connected to the corresponding halogen lamp light source (7) through each PWM adjustment driver board module to realize PWM modulation control of brightness. The display screen (17) is placed on the outer surface of the housing (1) and connected to the embedded development board (14) to display the output information of the embedded development board (14). The power supply (4) includes a main power conditioning module, a first voltage conversion system, and a second voltage conversion system. The main power conditioning module is used to connect to an external 15V power supply and performs filtering and safety protection in sequence to obtain the desired voltage. After optimization, the 15V voltage is divided into three output terminals. One output terminal is connected to the embedded development board (14) for power supply. The other two output terminals are connected to the input terminals of the first and second voltage conversion systems, respectively. The first voltage conversion system performs voltage conversion on the received optimized 15V voltage to obtain the corresponding 12V voltage, which is used to supply power to the multispectral camera (15) and the MOS driving transistors in each PWM adjustment drive board module. The second voltage conversion system performs voltage conversion on the received optimized 15V voltage to obtain the corresponding 5V voltage, which is used to supply power to the display screen (17).