Model training method and detection method for floating residual feed
By optimizing the YOLOv5 network structure and replacing the convolutional module with a ghost convolutional module, a lightweight improved YOLOv5 network was constructed, which solved the problem of slow detection speed of floating residual bait and achieved faster and more accurate detection results.
Patent Information
- Application Number
- CN202311148798.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-06
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2043-09-06
AI Technical Summary
Existing computer vision-based methods for detecting floating residual bait are slow and cannot meet the requirements for efficient and accurate detection.
An improved YOLOv5 network was constructed by replacing the convolutional module with a ghost convolutional module, the CSP module with a C3 ghost module, and the SPPF module with a ghost SPPF module. Combined with 4x downsampling, space-to-depth layers, and data augmentation techniques, the YOLOv5 network structure was optimized to achieve lightweighting.
It improves the detection speed and accuracy of floating residual bait, is suitable for environments with limited resources, and reduces computational resource requirements and model complexity.
Smart Images

Figure CN117274676B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of target detection, and in particular to a model training method and a detection method for floating residual bait. BACKGROUND
[0002] Aquaculture is an important part of fisheries, and feed feeding is a long-term work in aquaculture. The feeding amount is one of the important factors that determine the growth quality of fish, the yield of aquaculture and the production benefit. Because the bait is rich in nitrogen, phosphorus and other elements, excessive bait particles will lead to a large amount of nitrogen and phosphorus dissolved in water or deposited at the bottom of the water body, which will increase the pollution of water and the load of post-processing. In addition, ammonia nitrogen has certain toxicity and can significantly reduce the disease resistance of aquatic products, and is prone to large-scale diseases. Therefore, accurate and timely detection of the problem of floating residual bait in the process of aquaculture can not only reduce the waste of bait particles and reduce the cost of aquaculture, but also more scientifically guide the aquaculture.
[0003] At present, computer vision is considered to be the most practical technology for detecting residual bait particles, which can realize efficient, accurate detection and recognition, and save labor and time cost. However, in the existing residual bait detection based on computer vision, the detection speed still needs to be further improved. SUMMARY
[0004] The present application provides a model training method and a detection method for floating residual bait, which can improve the detection speed of floating residual bait.
[0005] The present application provides a model training method for floating residual bait, comprising:
[0006] Constructing a training set, the training set comprising images of floating residual bait in a fish pond;
[0007] Constructing a YOLOv5 improved network, the YOLOv5 improved network being a network in which the convolution module in the YOLOv5 initial network is replaced by a ghost convolution module, the CSP module in the YOLOv5 initial network is replaced by a C3 ghost module, and the SPPF module in the YOLOv5 initial network is replaced by a ghost SPPF module;
[0008] Inputting the training set into the YOLOv5 improved network to train the YOLOv5 improved network, and obtaining a trained YOLOv5 improved network.
[0009] Optionally, constructing a YOLOv5 improved network further comprises:
[0010] Adding a 4 times down-sampling module to the YOLOv5 initial network, the 4 times down-sampling module being used for 4 times down-sampling of an input image.
[0011] Optionally, the YOLOv5 improved network is constructed, and the YOLOv5 improved network further comprises:
[0012] The 32 times down-sampling module in the YOLOv5 initial network is deleted.
[0013] Optionally, the YOLOv5 improved network is constructed, and the YOLOv5 improved network further comprises:
[0014] The stride convolution layer in the YOLOv5 initial network is replaced by a space_to_depth layer.
[0015] Optionally, the training set is constructed, and specifically comprises:
[0016] A plurality of floating residual bait images of fish tanks are acquired.
[0017] The state of circulating water and an oxygen pump in each of the floating residual bait images is determined, and the state comprises opening and closing.
[0018] The floating residual bait images are classified according to the state of the circulating water and the oxygen pump.
[0019] Each of the floating residual bait images is labeled to obtain a training set.
[0020] Optionally, the plurality of floating residual bait images of fish tanks are acquired, and specifically comprises:
[0021] A plurality of floating residual bait images of fish tanks in different scenes are acquired, and the scenes comprise transparent fish tanks, non-transparent fish tanks and green algae fish tanks.
[0022] The application further provides a detection method of floating residual bait, comprising:
[0023] A fish tank image of floating residual bait to be detected is acquired.
[0024] The fish tank image of the floating residual bait to be detected is input into the trained YOLOv5 improved network to obtain a detection result of the floating residual bait.
[0025] The application further provides a model training system of floating residual bait, comprising:
[0026] A training set construction module is configured to construct a training set, and the training set comprises floating residual bait images of fish tanks.
[0027] An improved network construction module is configured to construct a YOLOv5 improved network, and the YOLOv5 improved network is a YOLOv5 initial network in which a convolution module is replaced by a ghost convolution module, a CSP module is replaced by a C3 ghost module, and an SPPF module is replaced by a ghost SPPF module.
[0028] a training module configured to input the training set into the improved YOLOv5 network to train the improved YOLOv5 network, and obtain a trained improved YOLOv5 network.
[0029] The application further provides a system for detecting floating residual bait, comprising:
[0030] a to-be-detected image acquisition module configured to acquire a fishpond image of to-be-detected floating residual bait;
[0031] a detection module configured to input the fishpond image of to-be-detected floating residual bait into the trained improved YOLOv5 network, and obtain a detection result of floating residual bait.
[0032] The application further provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor implements the model training method of floating residual bait or the detection method of floating residual bait when executing the program.
[0033] The model training method and the detection method of floating residual bait provided by the application, by constructing a training set, the training set comprising fishpond floating residual bait images; constructing an improved YOLOv5 network, the improved YOLOv5 network being an improved network in which a convolution module in an initial YOLOv5 network is replaced by a ghost convolution module, a CSP module in the initial YOLOv5 network is replaced by a C3 ghost module, and an SPPF module in the initial YOLOv5 network is replaced by a ghost SPPF module; inputting the training set into the improved YOLOv5 network to train the improved YOLOv5 network, and obtaining a trained improved YOLOv5 network. That is, by replacing the convolution module in the initial YOLOv5 network with the ghost convolution module, replacing the CSP module in the initial YOLOv5 network with the C3 ghost module, and replacing the SPPF module in the initial YOLOv5 network with the ghost SPPF module, the application simplifies the model structure, reduces the parameter amount, and realizes the lightweight of the improved YOLOv5 network, so that the detection of floating residual bait based on the improved YOLOv5 network can improve the detection speed of floating residual bait. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the application or prior art, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are some embodiments of the application, and for those skilled in the art, other drawings can also be obtained without creative labor.
[0035] Figure 1 is a model training method flow chart of floating residual bait provided by the present application;
[0036] Figure 2 is an architecture diagram of the improved YOLOv5 network provided by the present application;
[0037] Figure 3 is a network architecture diagram of the ghost SPPF module provided by the present application;
[0038] Figure 4 is an architecture diagram of the space_to_depth layer provided by the present application
[0039] Figure 5 is a detection method flow chart of floating residual bait provided by the present application;
[0040] Figure 6 is a model training system module diagram of floating residual bait provided by the present application;
[0041] Figure 7 is a detection system module diagram of floating residual bait provided by the present application;
[0042] Figure 8 is a structural schematic diagram of an electronic device provided by the present application. DETAILED DESCRIPTION
[0043] In order to make the objects, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be described clearly and completely below in combination with the drawings in the present application. Obviously, the described embodiments are some embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0044] The model training method and the detection method of floating residual bait of the present application will be described below in combination with Figures 1-8 the drawings.
[0045] As shown in Figure 1 , a model training method of floating residual bait comprises the following steps.
[0046] Step 101: constructing a training set, wherein the training set comprises images of floating residual bait in a fish pond.
[0047] In one specific embodiment, step 101 specifically comprises the following steps.
[0048] Step 1011: acquiring multiple images of floating residual bait in a fish pond.
[0049] In one specific embodiment, step 1011 specifically comprises the following steps.
[0050] Obtain multiple frames of residual bait images of fish pools in different scenes, including transparent fish pools, non-transparent fish pools and green algae fish pools.
[0051] Among them, the residual bait images of fish pools in different scenes such as transparent fish pools, non-transparent fish pools and green algae fish pools are collected by a camera, and key frames are extracted from the video collected by the camera to obtain multiple frames of residual bait images of fish pools.
[0052] In addition, the scenes in the present application can also include different backgrounds, lighting conditions, fish body quantities and postures, etc.
[0053] By collecting residual bait images in different scenes, the present application can increase the diversity of data, that is, by collecting image data in multiple scenes, a variety of situations can be better covered, so that the model has better generalization ability. By expanding the data set, the model can learn more extensive bait samples. So that the model can better adapt and identify bait when facing new scenes and changes. It helps to improve the robustness of the model, so that it is more reliable and accurate in real-world applications.
[0054] In one specific embodiment, between step 1011 and step 1012, the following steps are further included:
[0055] Preprocess the multiple frames of residual bait images of fish pools.
[0056] Step 1012: Determine the state of the circulating water and the oxygen pump in each frame of the residual bait image, including opening and closing.
[0057] Specifically, the state of the circulating water and the oxygen pump includes four cases: circulating water on, oxygen pump on; circulating water on, oxygen pump off; circulating water off, oxygen pump on; circulating water off, oxygen pump off.
[0058] Step 1013: Classify the residual bait images according to the state of the circulating water and the oxygen pump.
[0059] Specifically, the residual bait images are divided into four categories according to the state of the circulating water and the oxygen pump: circulating water on, oxygen pump on; circulating water on, oxygen pump off; circulating water off, oxygen pump on; circulating water off, oxygen pump off.
[0060] Step 1014: Label each type of residual bait image to obtain a training set.
[0061] Specifically, the labelimg labeling tool is used to label the floating residual bait in each frame of the floating residual bait image in each category, and then an XML file is used to store the target category and bounding box information of each image. Each XML file corresponds to an image, which contains the category label of each target in the image and the coordinates of the bounding box of the target.
[0062] Further, in order to adapt to the training and inference requirements of the YOLO algorithm, it is also necessary to convert the training set data from VOC format to YOLO format according to the Python code.
[0063] According to the above two steps, the data set can be obtained, and then the data of the data set is divided into a training set and a test set in a ratio of 8:2, which are respectively used for training and testing the improved YOLOv5 network.
[0064] In a specific embodiment, after obtaining the data set, the obtained data set can be input into the improved YOLOv5 network or the initial YOLOv5 network, so as to perform data augmentation and adaptive adjustment of prior anchors. Among them, data augmentation and adaptive adjustment of prior anchors are to optimize the data set, increase the diversity of data, and improve the performance and generalization ability of the target detection model. These methods can improve the adaptability of the model to different scenes, occlusion conditions, scale changes and other factors, thereby improving the accuracy and robustness of the target detection task.
[0065] In a specific embodiment, data augmentation adopts the method of randomly scaling, randomly cropping and randomly arranging 4 images for splicing; adaptive adjustment of prior anchors adopts the k-means clustering algorithm to cluster the anchor of the bait detection training data set, and automatically generates the anchor size corresponding to the data set.
[0066] Step 102: constructing an improved YOLOv5 network, wherein the improved YOLOv5 network is constructed by replacing the convolution module in the initial YOLOv5 network with a ghost convolution module, replacing the CSP module in the initial YOLOv5 network with a C3 ghost module, and replacing the SPPF module in the initial YOLOv5 network with a ghost SPPF module.
[0067] The improved YOLOv5 network is as follows: Figure 2As shown in the figure, the ghost convolution module (Ghostconv) effectively reduces the amount of calculation by reducing the number of convolution kernels, that is, the ghost convolution module reduces the amount of calculation for obtaining feature information by discarding part of the ordinary convolution, the ghost convolution module first extracts feature information through part of the conventional convolution to obtain a feature map, then performs a series of simple linear transformations on the features of each channel in the obtained feature map to obtain a Ghost feature map with the same number of channels, and finally splices the two groups of feature maps together to generate the final feature map, thereby realizing the effective reduction of the demand for computing resources while not affecting the performance of the model. That is, the ghost convolution module is a lightweight convolution module that can reduce the parameters and calculation amount of the model, the ghost convolution module provides a lightweight convolution operation for deep learning models by reducing the parameter amount and calculation amount, which reduces the complexity and resource demand of the model while maintaining high performance and accuracy, and is suitable for resource-limited environments or application scenarios that require lightweight models.
[0068] In addition, the ghost bottleneck module (GhostBottleneck), the C3 ghost module (C3Ghost) and the ghost SPPF module (GhostSPPF) are all designed based on the ghost convolution module (Ghostconv) due to the low computational cost of the ghost convolution module. The ghost bottleneck module is designed by using the structure of the ghost convolution module, which maintains good feature representation ability while reducing the computational cost and parameter amount; further, the C3 ghost module is designed according to the ghost bottleneck module. The C3 ghost module combines the C3 module and the ghost convolution module together, which effectively reduces the parameter amount and calculation amount of the model by using the ghost convolution to replace the 3x3 convolution layer in the C3 module. At the same time, the C3 ghost module maintains the characteristics of depth increase and parameter reduction of the C3 module, and can extract more rich features. The C3 ghost module can realize feature extraction, depth increase, parameter reduction, calculation efficiency improvement, feature fusion and multi-scale fusion, etc., which can effectively improve the feature extraction ability and calculation efficiency of the lightweight network while maintaining good model performance and accuracy.
[0069] In addition, the SPPF module refers to the spatial pyramid pooling module, the function of the SPPF module is to extract multi-scale features of the input feature map through the spatial pyramid pooling operation, and fuse these features together to improve the detection ability of the target detection algorithm for targets of different scales. The ghost SPPF module is to make the SPPF module lightweight, and has the same effect, the architecture of the ghost SPPF module in the present application is as shown in the figure. Figure 3 Replacing the SPPF module in the original network model with the ghost SPPF module effectively improves the performance and efficiency of the target detector, and still maintains high detection quality while being lightweight.
[0070] The designs of the above modules are all for reducing the calculation cost and parameter quantity in the improved YOLOv5 network, which reduces redundant calculation, improves calculation efficiency, and saves memory usage to a certain extent through innovative connection mode and convolution design, so that the improved YOLOv5 network has better lightweight deployment capability.
[0071] In one specific embodiment, step 102 further comprises:
[0072] A 4 times down-sampling module is added to the YOLOv5 initial network, and the 4 times down-sampling module is used for 4 times down-sampling of the input image.
[0073] Since a smaller down-sampling multiple can maintain a higher resolution and a smaller receptive field when performing shallow feature extraction, more fine-grained feature information can be utilized, so as to ensure that the network can capture more details. Therefore, the improved YOLOv5 network is more suitable for detecting small size targets and local details by adding a 4 times down-sampling module to the input picture.
[0074] In one specific embodiment, step 102 further comprises:
[0075] The 32 times down-sampling module in the YOLOv5 initial network is deleted.
[0076] That is, the step of 32 times down-sampling is deleted, that is, the input picture is respectively down-sampled by 4 times, 8 times and 16 times, three feature maps of different sizes can be obtained, and then the output size of the detection head is adaptively modified, so that the model is more sensitive to small targets, the detection precision is improved, and the calculation amount required by the model is also effectively reduced.
[0077] By reasonably adjusting the feature extraction multiple of the YOLOv5 initial network, adjusting the number of layers and modifying the output size of the detection head, the calculation resources can be reasonably allocated, the target detection model is more lightweight, the storage space and memory occupation of the model are reduced, the calculation amount and parameter quantity are reduced, and the model can also pay more attention to the detection of water surface floating residual bait.
[0078] In one specific embodiment, step 102 further comprises:
[0079] The cross-step convolution layer in the YOLOv5 initial network is replaced by a space_to_depth layer.
[0080] The architecture of the space_to_depth layer is as follows: Figure 4As shown, the SPD layer downsamples the original feature map without pooling operation or convolution operation, but reduces the size of the feature map through rearrangement and stacking operation. In this way, the details in the input feature map can be preserved while the size is reduced to improve the calculation efficiency, and a series of sub-feature maps are obtained by cutting a certain feature map in proportion, and the intermediate feature map can be obtained by splicing the sub-feature maps in the channel, and the specific way is:
[0081] fm-1,n-1=X[scale-1:m:scale,scale-1:n:scale];
[0082] Wherein, X is the original feature map, the size is m*n, scale is the scaling factor, in addition, the spatial dimension and the channel dimension of the obtained intermediate feature map are related to the size of scale.
[0083] It should be noted that, Figure 4 S represents the height and width of the feature mapping, specifically the size of the feature mapping X in the spatial dimension; C1 represents the number of feature channels or depth of the feature mapping, specifically the number of feature channels in the feature mapping X, also called channel dimension or depth dimension.
[0084] The SPD layer in the application does not have model parameters and does not involve weight learning, and the main purpose of introducing the space_to_depth(SPD) layer to replace the cross-step convolution in the network structure is to reduce the spatial dimension of the feature map while preserving important information, providing more efficient feature input for subsequent processing of floating residual bait.
[0085] That is, the space_to_depth(SPD) layer is used to replace the cross-step convolution in the initial network structure of YOLOv5, which can improve the detection accuracy of the model for bait.
[0086] In summary, the SPD layer in the application divides the spatial dimension in the feature map into smaller blocks, and rearranges and stacks each block to reduce the size of the feature map. For small target bait detection, the SPD layer helps to extract and enhance the local features of the target; the rearranged features make the improved YOLOv5 network pay more attention to the details of a specific area, improve the perception ability of floating bait, and can preserve all information in the channel dimension, so there is no information loss, which can improve the performance of small target bait detection and enhance the perception and recognition ability of the model for bait target. That is, the SPD layer is beneficial to enhance the feature representation ability of floating bait detection, increase the receptive field, suppress the spatial dimension correlation, and improve the target positioning accuracy.
[0087] Step 103: Input the training set into the YOLOv5 improved network to train the YOLOv5 improved network to obtain a trained YOLOv5 improved network.
[0088] Specifically, the training set image dataset is fed into the improved YOLOv5 network for iterative training. The parameters are set as follows: initial learning rate of 0.01, cyclic learning rate of 0.1, learning rate momentum of 0.937, and optimizer weight decay factor of 0.0005. In addition, considering the GPU memory limitation, the batch size can be set to 4 and the number of iterations can be set to 300 during training.
[0089] During the training process, the trained YOLOv5 improved network adopts the FPN+PAN feature fusion network, and performs feature fusion in a top-down and bottom-up manner, and finally obtains two enhanced feature maps of different scales. Then, the YOLOv5 improved network outputs the final pre-selected box through non-maximum suppression and maps it to the original image size, and finally outputs the detection result of the target object. After multiple training iterations, when the accuracy of the detection result meets the requirements, the trained YOLOv5 improved network can be obtained.
[0090] The present invention also provides a method for detecting floating residual bait, such as Figure 5 Shown, including:
[0091] Step 501: Acquire an image of a fish pond containing floating residual bait to be detected.
[0092] Here, an image of the fish pond containing the floating residual bait to be detected is obtained through a camera.
[0093] In a specific embodiment, between step 501 and step 502, the following steps may also be included:
[0094] Preprocess the fish pond image to be detected with floating residual bait.
[0095] Step 502: Input the fish pond image of the floating residual bait to be detected into the trained YOLOv5 improved network to obtain the detection result of the floating residual bait.
[0096] Among them, the trained YOLOv5 improved network has the same structure as the YOLOv5 improved network constructed above, that is, the convolution module in the YOLOv5 initial network is replaced by the ghost convolution module, the CSP module in the YOLOv5 initial network is replaced by the C3 ghost module, and the SPPF module in the YOLOv5 initial network is replaced by the ghost SPPF module.
[0097] YOLOv5 improves the network Figure 2As shown in the figure, the ghost convolution module (Ghostconv) effectively reduces the amount of calculation by reducing the number of convolution kernels, that is, the ghost convolution module reduces the amount of calculation for obtaining feature information by discarding part of the ordinary convolution, the ghost convolution module first extracts feature information through part of the conventional convolution to obtain a feature map, then performs a series of simple linear transformations on the features of each channel in the obtained feature map to obtain a Ghost feature map with the same number of channels, and finally splices the two groups of feature maps together to generate the final feature map, thereby realizing the effective reduction of the demand for computing resources while not affecting the performance of the model. That is, the ghost convolution module is a lightweight convolution module that can reduce the parameters and calculation amount of the model, the ghost convolution module provides a lightweight convolution operation for deep learning models by reducing the parameter amount and calculation amount, which reduces the complexity and resource demand of the model while maintaining high performance and accuracy, and is suitable for resource-limited environments or application scenarios that require lightweight models.
[0098] In addition, the ghost bottleneck module (GhostBottleneck), the C3 ghost module (C3Ghost) and the ghost SPPF module (GhostSPPF) are all designed based on the ghost convolution module (Ghostconv) due to the low calculation cost of the ghost convolution module. The ghost bottleneck module is designed by using the structure of the ghost convolution module, which maintains good feature representation ability while reducing the calculation cost and parameter amount; further, the C3 ghost module is designed according to the ghost bottleneck module. The C3 ghost module combines the C3 module and the ghost convolution module together, which effectively reduces the parameter amount and calculation amount of the model by using the ghost convolution to replace the 3x3 convolution layer in the C3 module. At the same time, the C3 ghost module maintains the characteristics of depth increase and parameter reduction of the C3 module, and can extract more rich features. The C3 ghost module can realize feature extraction, depth increase, parameter reduction, calculation efficiency improvement, feature fusion and multi-scale fusion, etc., which can effectively improve the feature extraction ability and calculation efficiency of the lightweight network while maintaining good model performance and accuracy.
[0099] In addition, the SPPF module refers to the spatial pyramid pooling module, the function of the SPPF module is to extract multi-scale features of the input feature map through the spatial pyramid pooling operation, and fuse these features together to improve the detection ability of the target detection algorithm for targets of different scales. The ghost SPPF module is to make the SPPF module lightweight, and has the same effect, the architecture of the ghost SPPF module in the present application is as shown in the figure. Figure 3 Replacing the SPPF module in the original network model with the ghost SPPF module effectively improves the performance and efficiency of the target detector, and still maintains high detection quality while being lightweight.
[0100] The designs of the above modules are all for reducing the calculation cost and parameter quantity in the improved YOLOv5 network, and they reduce redundant calculation, improve calculation efficiency and save memory usage to a certain extent through innovative connection mode and convolution design, so that the improved YOLOv5 network has better lightweight deployment capability.
[0101] The improved YOLOv5 network is obtained by replacing the convolution module in the initial YOLOv5 network with the ghost convolution module, replacing the CSP module in the initial YOLOv5 network with the C3 ghost module, and replacing the SPPF module in the initial YOLOv5 network with the ghost SPPF module, so that the model structure is simplified, the parameter quantity is reduced, and the lightweight of the improved YOLOv5 network is realized, and therefore the detection of the floating residual bait based on the improved YOLOv5 network can improve the detection speed of the floating residual bait.
[0102] The model training system for the floating residual bait and the detection system for the floating residual bait provided by the present application are described below, and the model training system for the floating residual bait and the detection system for the floating residual bait described below can be correspondingly referred to the model training method for the floating residual bait and the detection method for the floating residual bait described above.
[0103] The present application also provides a model training system for floating residual bait, as shown in Figure 6 The model training system comprises:
[0104] The training set construction module 601 is configured to construct a training set, and the training set comprises floating residual bait images of a fish tank.
[0105] In one specific embodiment, the training set construction module 601 is specifically configured to:
[0106] obtain multiple frames of floating residual bait images of a fish tank;
[0107] determine the state of the circulating water and the oxygen pump in each frame of the floating residual bait image, and the state comprises opening and closing;
[0108] classify the floating residual bait images according to the state of the circulating water and the oxygen pump;
[0109] label each type of the floating residual bait images to obtain a training set.
[0110] In one specific embodiment, the multiple frames of floating residual bait images of a fish tank are obtained, specifically including:
[0111] obtain multiple frames of floating residual bait images of a fish tank under different scenes, and the scenes include transparent fish tanks, non-transparent fish tanks and green algae fish tanks.
[0112] The floating residual bait image of the fish tank is acquired by a camera.
[0113] In addition, the scene in the present application can also include different backgrounds, lighting conditions, fish body quantities and postures, etc.
[0114] That is, the present application can increase the diversity of data by collecting floating residual bait images in different scenes, that is, by collecting image data in multiple scenes, a variety of situations can be better covered, so that the model has better generalization ability. By expanding the data set, the model can learn more extensive bait samples. So that the model can better adapt and identify bait when facing new scenes and changes. It helps to improve the robustness of the model, making it more reliable and accurate in real-world applications.
[0115] The improved network construction module 602 is configured to construct a YOLOv5 improved network, wherein the YOLOv5 improved network is constructed by replacing a convolution module in a YOLOv5 initial network with a ghost convolution module, replacing a CSP module in the YOLOv5 initial network with a C3 ghost module, and replacing a SPPF module in the YOLOv5 initial network with a ghost SPPF module.
[0116] In one specific embodiment, the improved network construction module 602 is further configured to:
[0117] add a 4 times down-sampling module to the YOLOv5 initial network, wherein the 4 times down-sampling module is configured to perform 4 times down-sampling on an input image.
[0118] In one specific embodiment, the improved network construction module 602 is further configured to:
[0119] delete a 32 times down-sampling module in the YOLOv5 initial network.
[0120] In one specific embodiment, the improved network construction module 602 is further configured to:
[0121] replace a stride convolution layer in the YOLOv5 initial network with a space_to_depth layer.
[0122] The training module 603 is configured to input the training set into the YOLOv5 improved network to train the YOLOv5 improved network, and obtain a trained YOLOv5 improved network.
[0123] The present application also provides a detection system for floating residual bait, as shown in Figure 7 The detection system for floating residual bait comprises:
[0124] The fish tank image of the floating residual bait to be detected is acquired by the fish tank image acquisition module 701.
[0125] Specifically, the to-be-detected image acquisition module 701 can be a camera.
[0126] In one specific embodiment, between the to-be-detected image acquisition module 701 and the detection module 702, there can further be included:
[0127] a preprocessing module, configured to pre-process the fishpond image of the to-be-detected floating residual bait.
[0128] the detection module 702, configured to input the fishpond image of the to-be-detected floating residual bait into the trained YOLOv5 improved network to obtain a detection result of the floating residual bait.
[0129] Specifically, the trained YOLOv5 improved network is the same as the YOLOv5 improved network structure constructed above, that is, the convolution module in the YOLOv5 initial network is replaced by the Ghost convolution module, the CSP module in the YOLOv5 initial network is replaced by the C3 Ghost module, and the SPPF module in the YOLOv5 initial network is replaced by the Ghost SPPF module.
[0130] Figure 8 An example of a schematic diagram of the physical structure of an electronic device is shown in Figure 8 The electronic device can include a processor 810, a communications interface 820, a memory 830, and a communications bus 840, wherein the processor 810, the communications interface 820, and the memory 830 communicate with each other through the communications bus 840. The processor 810 can invoke the logical instructions in the memory 830 to execute the model training method for floating residual bait, which includes:
[0131] constructing a training set, the training set including fishpond floating residual bait images.
[0132] constructing a YOLOv5 improved network, the YOLOv5 improved network being a YOLOv5 initial network in which the convolution module is replaced by the Ghost convolution module, the CSP module in the YOLOv5 initial network is replaced by the C3 Ghost module, and the SPPF module in the YOLOv5 initial network is replaced by the Ghost SPPF module.
[0133] inputting the training set into the YOLOv5 improved network to train the YOLOv5 improved network, obtaining a trained YOLOv5 improved network.
[0134] or,
[0135] a detection method for floating residual bait, the method including:
[0136] An image of the fish pond with the floating residual bait to be detected is acquired.
[0137] The image of the fish pond with the floating residual bait to be detected is input into the trained YOLOv5 improved network to obtain a detection result of the floating residual bait.
[0138] In addition, the logical instructions in the memory 830 described above can be implemented in the form of a software function unit and sold or used as an independent product, and can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0139] On the other hand, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program can be executed by a processor to enable a computer to execute a model training method of floating residual bait, the method comprising:
[0140] A training set is constructed, and the training set comprises images of floating residual bait in a fish pond.
[0141] A YOLOv5 improved network is constructed, and the YOLOv5 improved network is constructed by replacing a convolution module in a YOLOv5 initial network with a ghost convolution module, replacing a CSP module in the YOLOv5 initial network with a C3 ghost module, and replacing a SPPF module in the YOLOv5 initial network with a ghost SPPF module.
[0142] The training set is input into the YOLOv5 improved network to train the YOLOv5 improved network, and a trained YOLOv5 improved network is obtained.
[0143] Or,
[0144] A detection method of floating residual bait, the method comprising:
[0145] An image of the fish pond with the floating residual bait to be detected is acquired.
[0146] Input the image of the fish pond to be detected of the floating residual bait into the trained YOLOv5 improved network to obtain a detection result of the floating residual bait.
[0147] In another aspect, the present application also provides a non-transitory computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, implements a model training method for detecting floating residual bait, the method comprising:
[0148] Constructing a training set comprising images of floating residual bait in a fish pond.
[0149] Constructing a YOLOv5 improved network, wherein the YOLOv5 improved network is obtained by replacing the convolution module in the YOLOv5 initial network with a ghost convolution module, replacing the CSP module in the YOLOv5 initial network with a C3 ghost module, and replacing the SPPF module in the YOLOv5 initial network with a ghost SPPF module.
[0150] Inputting the training set into the YOLOv5 improved network to train the YOLOv5 improved network, thereby obtaining a trained YOLOv5 improved network.
[0151] Or,
[0152] A method for detecting floating residual bait, the method comprising:
[0153] Obtaining an image of a fish pond to be detected of floating residual bait.
[0154] Inputting the image of the fish pond to be detected of the floating residual bait into the trained YOLOv5 improved network to obtain a detection result of the floating residual bait.
[0155] The device embodiments described above are merely illustrative, wherein the units illustrated as separate components can or can not be physically separated, and the components illustrated as units can or can not be physical units, i.e., they can be located in one place or distributed on multiple network units. Part or all of the modules can be selected to achieve the purpose of the present embodiment scheme according to actual needs. Those skilled in the art can understand and implement it without creative labor.
[0156] Those skilled in the art can clearly understand the technical solutions of the various embodiments from the above description of the embodiments, and the various embodiments can be implemented by means of software with the necessary general hardware platforms, and of course, can also be implemented by hardware. Based on such understanding, the above technical solutions, essentially or in other words, the part of the prior art that makes a contribution, can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, and the like, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0157] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for some technical features therein; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A model training method for floating residual bait, characterized in that: include: Constructing a training set, wherein the training set includes images of floating residual bait in a fish pond; Constructing a YOLOv5 improved network, wherein the YOLOv5 improved network replaces the convolution module in the YOLOv5 initial network with a ghost convolution module, replaces the CSP module in the YOLOv5 initial network with a C3 ghost module, and replaces the SPPF module in the YOLOv5 initial network with a ghost SPPF module; Inputting the training set into the YOLOv5 improved network to train the YOLOv5 improved network to obtain a trained YOLOv5 improved network; Building a YOLOv5 improved network also includes: Adding a 4x downsampling module to the YOLOv5 initial network, wherein the 4x downsampling module is used to downsample the input image by 4 times; Delete the 32x downsampling module in the YOLOv5 initial network; Replace the strided convolutional layers in the YOLOv5 inception network with spatial_to_depth layers.
2. The model training method for floating residual bait according to claim 1, characterized in that: Construct a training set, including: Acquire multiple frames of floating residual bait images in the fish pond; Determining the status of the circulating water and the oxygenation pump in each frame of the floating residual bait image, wherein the status includes being on and off; Classifying the floating residual bait image according to the status of the circulating water and the aeration pump; Each type of floating residual bait image is labeled to obtain a training set.
3. The model training method for floating residual bait according to claim 2, characterized in that: Acquire multiple frames of floating residual bait images in the fish pond, including: Multiple frames of floating residual bait images of fish ponds in different scenes are acquired, wherein the scenes include a transparent fish pond, a non-transparent fish pond, and a green algae fish pond.
4. A method for detecting floating residual bait, characterized in that: include: Acquire an image of a fish pond containing floating residual bait to be detected; The image of the fish pond with floating residual bait to be detected is input into the trained YOLOv5 improved network obtained in the model training method for floating residual bait as described in any one of claims 1 to 3 to obtain the detection result of the floating residual bait.
5. A model training system for floating residual bait, characterized in that: include: A training set construction module, used to construct a training set, wherein the training set includes images of floating residual bait in the fish pond; An improved network construction module is used to construct a YOLOv5 improved network, wherein the YOLOv5 improved network replaces the convolution module in the YOLOv5 initial network with a ghost convolution module, replaces the CSP module in the YOLOv5 initial network with a C3 ghost module, and replaces the SPPF module in the YOLOv5 initial network with a ghost SPPF module; A training module is used to input the training set into the YOLOv5 improved network to train the YOLOv5 improved network to obtain a trained YOLOv5 improved network; Improved network building blocks, also used for: Adding a 4x downsampling module to the YOLOv5 initial network, wherein the 4x downsampling module is used to downsample the input image by 4 times; Delete the 32x downsampling module in the YOLOv5 initial network; Replace the strided convolutional layers in the YOLOv5 inception network with spatial_to_depth layers.
6. A system for detecting floating residual bait, characterized in that: include: The detection image acquisition module is used to acquire the fish pond image of the floating residual bait to be detected; The detection module is used to input the fish pond image of the floating residual bait to be detected into the trained YOLOv5 improved network obtained in the floating residual bait model training method according to any one of claims 1 to 3 to obtain the detection result of the floating residual bait.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the model training method for floating residual bait according to any one of claims 1 to 3 or the method for detecting floating residual bait according to claim 4 is implemented.
Citation Information
Patent Citations
Improved YOLOv5 lightweight community scene pedestrian detection method
CN115862066A
Bridge underwater image disease intelligent identification method based on convolutional neural network
CN116486246A