Boar target detection method, system and device
By improving the neck network module of the YOLOv10 model, the feature extraction capability is enhanced, solving the problem of high computational complexity in the boar detection model, and achieving efficient and accurate boar detection, which is suitable for edge computing terminals in pig farms.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIV
- Filing Date
- 2025-01-13
- Publication Date
- 2026-07-14
AI Technical Summary
In pig farms, existing technologies struggle to effectively utilize resources while ensuring the performance of boar testing models, resulting in high computational complexity, increased labor costs, and higher risks of disease transmission.
An improved YOLOv10 model is adopted, which enhances feature extraction capabilities, reduces redundant information, and lowers computational complexity by improving the IUB and C2f-SCConv modules in the neck network.
It improves the efficiency and accuracy of boar detection, reduces the computational complexity and resource consumption of the model, and is suitable for boar detection on edge computing terminals.
Smart Images

Figure CN122392088A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method, system and device for target detection of boars. Background Technology
[0002] Breeding boars play a crucial role in the pig industry. Their superior genes can improve the growth rate, feed conversion rate, reproductive efficiency, and meat quality of offspring, thus promoting overall health management and disease control. Selecting breeding boars with fast growth rates and high lean meat percentages results in offspring with rapid growth and short growth cycles, enhancing market competitiveness and farming profits. Therefore, the rational selection and use of breeding boars is essential for improving the efficiency and sustainable development of pig farms. Existing pig breeding mainly focuses on obtaining economic traits through traditional performance testing methods, which are time- and labor-intensive, and unnecessary human contact can increase the risk of disease transmission.
[0003] Currently, the application of artificial intelligence technology in agriculture is becoming increasingly widespread. Machine vision methods based on deep learning can reduce the labor intensity of manual monitoring, discover details that are easily overlooked during human supervision, and do not interfere with the normal activities of pigs. It is a low-cost, high-yield method for measuring the production performance of boars. However, the edge computing terminals deployed in pig farms place demands on the complexity of the algorithm models. How to balance model performance and resource consumption, and achieve efficient resource utilization while meeting performance requirements, has become a new challenge.
[0004] Therefore, it is necessary to provide a target detection method for boars to solve the above problems. Summary of the Invention
[0005] The purpose of this application is to provide a method, system, and device for detecting boar targets, thereby reducing the computational complexity of the model and improving detection efficiency.
[0006] To achieve the above objectives, this application provides the following solution:
[0007] Firstly, this application provides a method for detecting boar targets, the method comprising:
[0008] Obtain the image containing the target to be detected as the target image;
[0009] The target image is input into the boar target detection model, and the detection result is output. The detection result includes the target category and the target location. The target category is either a boar or a non-boar, and the target location is the location of the bounding rectangle where the target is located. The boar target detection model is obtained by training an improved YOLOv10 model using a training set. The training set includes sample target images and corresponding sample annotation results. The sample target images include images of boars in various body positions under natural conditions.
[0010] The improved YOLOv10 model includes a backbone network module, a neck network module, and a head network module connected in sequence.
[0011] Optionally, the training process of the boar target detection model specifically includes:
[0012] Obtain the original dataset;
[0013] The original dataset is expanded to obtain the expanded dataset;
[0014] The expanded dataset is divided into training, validation, and test sets according to a preset ratio.
[0015] For each training cycle:
[0016] Sample target images are obtained from the training set and input into the improved YOLOv10 model to obtain the corresponding sample detection results;
[0017] A loss function is constructed based on the sample detection results and the corresponding boar labeling results, and the parameters of the improved YOLOv10 model are iteratively optimized based on the loss function.
[0018] At the end of the current training cycle, the boar detection model at the current moment is evaluated using the validation set, and the hyperparameters of the boar detection model at the current moment are adjusted according to the evaluation results until the evaluation results meet the preset conditions, at which point iterative optimization stops, and the boar target detection model is obtained.
[0019] Optionally, the original dataset can be expanded to obtain an expanded dataset, specifically including:
[0020] Rotation operations are performed on each sample target image in the original dataset to obtain multiple rotated sample target images; the rotation operations include clockwise rotation and counterclockwise rotation;
[0021] Cropping is performed on each sample target image in the original dataset to obtain multiple cropped sample target images;
[0022] Randomly crop the target images of each sample in the original dataset within the range of 0 to 10° to obtain multiple cropped target images;
[0023] Random brightness adjustment is performed on each sample target image in the original dataset to obtain multiple brightness-adjusted sample target images;
[0024] The expanded dataset is formed by merging multiple rotated sample target images, cropped sample target images, sheared sample target images, brightness-adjusted sample target images, and the original dataset.
[0025] Optionally, the backbone network module includes a first convolutional layer, a second convolutional layer, a first C2f layer, a third convolutional layer, a second C2f layer, a first SCDown layer, a first C2fCIB layer, a second SCDown layer, a second C2fCIB layer, an SPPF module, and a self-attention mechanism module, which are connected in sequence.
[0026] Optionally, the neck network module includes a first IUB layer, a first Concat layer, a first C2f-SCConv layer, a second IUB layer, a second Concat layer, a second C2f-SCConv layer, a fourth convolutional layer, a third Concat layer, a third C2f-SCConv layer, a third SCDown layer, a fourth Concat layer, and a fourth C2f-SCConv layer connected in sequence.
[0027] Specifically, the first IUB layer is connected to the self-attention mechanism module, the first Concat layer is connected to the first C2fCIB layer, the second Concat layer is connected to the second C2f layer, the third Concat layer is connected to the first C2f-SCConv layer, and the fourth Concat layer is connected to the self-attention mechanism module.
[0028] Optionally, both the first IUB layer and the second IUB layer include an upsampling layer, a fifth convolutional layer, a DWC convolutional layer, a PReLU activation layer, a BN layer, and a sixth convolutional layer connected in sequence.
[0029] Optionally, the first C2f-SCConv layer, the second C2f-SCConv layer, the third C2f-SCConv layer, and the fourth C2f-SCConv layer each include a spatial reconstruction unit and a channel reconstruction unit connected in sequence.
[0030] Optionally, the head network module includes: a first detection head, a second detection head, and a third detection head; the first detection head, the second detection head, and the third detection head each include a first detection layer and a second detection layer connected in parallel;
[0031] The first detection head is connected to the second C2f-SCConv layer, the second detection head is connected to the third C2f-SCConv layer, and the third detection head is connected to the fourth C2f-SCConv layer.
[0032] Secondly, this application provides a boar target detection system, which is used to implement the boar target detection method described above. The boar target detection system includes:
[0033] The target image acquisition unit is used to acquire an image containing the target to be detected as the target image;
[0034] The detection result determination unit is used to input the target image into the boar target detection model and output the detection result; the detection result includes the target category and the target location; the target category is a boar or a non-boar, and the target location is the location of the bounding rectangle where the target is located; the boar target detection model is obtained by training an improved YOLOv10 model using a training set; the training set includes: sample target images and corresponding sample annotation results; the sample target images include images of boars in various body positions under natural conditions;
[0035] The improved YOLOv10 model includes a backbone network module, a neck network module, and a head network module connected in sequence.
[0036] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the boar target detection method described in any of the above claims.
[0037] According to the specific embodiments provided in this application, this application has the following technical effects:
[0038] This application discloses a method, system, and device for boar target detection. A boar target detection model is established based on an improved YOLOv10 model. Specifically, the IUB module and C2f-SCConv module in the neck network module of the YOLOv10 model are improved, which enhances the feature extraction effect of the model, improves the model's ability to adaptively optimize and adjust the spatial structure and channel relationship of feature information, removes redundant information, reduces the number of model parameters and computational complexity, and improves detection efficiency. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of a boar target detection method provided in an embodiment of this application;
[0041] Figure 2 A schematic diagram of an improved YOLOv10 model structure provided in an embodiment of this application;
[0042] Figure 3 This is a schematic diagram of the structure of an IUB layer provided in an embodiment of this application;
[0043] Figure 4 A schematic diagram of an improved C2f structure provided in an embodiment of this application; wherein, (a) is a schematic diagram of the classic C2f structure; and (b) is a schematic diagram of the improved C2f-SCConv structure;
[0044] Figure 5 This is a schematic diagram of the structure of a spatial reconstruction unit provided in an embodiment of this application;
[0045] Figure 6 This is a schematic diagram of the structure of a channel reconstruction unit provided in an embodiment of this application;
[0046] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0048] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0049] In one exemplary embodiment, such as Figure 1 As shown, a method for detecting boar targets is provided, including the following steps: (The steps are not described in the provided text.)
[0050] Step S1: Obtain an image containing the target to be detected as the target image.
[0051] Step S2: Input the target image into the boar target detection model and output the detection result. The detection result includes the target category and the target location; the target category is a boar or a non-boar, and the target location is the location of the bounding box of the target; the boar target detection model is obtained by training an improved YOLOv10 model using a training set; the training set includes: sample target images and corresponding sample annotation results; the sample target images include images of boars in various body positions under natural conditions.
[0052] Among them, such as Figure 2 As shown, the improved YOLOv10 model includes a backbone network module, a neck network module, and a head network module connected in sequence.
[0053] As an optional implementation, step S2, the training process of the boar target detection model, specifically includes:
[0054] Step S21: Obtain the original dataset.
[0055] Step S22: Expand the original dataset to obtain the expanded dataset.
[0056] Step S23: Divide the expanded dataset into a training set, a validation set, and a test set according to a preset ratio.
[0057] For each training cycle:
[0058] Step S24: Obtain sample target images from the training set and input the sample target images into the improved YOLOv10 model to obtain the corresponding sample detection results.
[0059] Step S25: Construct a loss function based on the sample detection results and the corresponding boar labeling results, and iteratively optimize the parameters of the improved YOLOv10 model based on the loss function.
[0060] Step S26: At the end of the current training cycle, the boar detection model at the current moment is evaluated using the validation set, and the hyperparameters of the boar detection model at the current moment are adjusted according to the evaluation results until the evaluation results meet the preset conditions, and the iterative optimization is stopped to obtain the boar target detection model.
[0061] As an optional implementation, step S22 specifically includes:
[0062] Step S221 involves rotating each sample target image in the original dataset to obtain multiple rotated sample target images. The rotation operations include clockwise and counter-clockwise rotation. By adding 90° clockwise or counter-clockwise rotation operations, the network's ability to distinguish targets from different angles is enhanced.
[0063] Step S222 involves cropping each sample target image in the original dataset to obtain multiple cropped sample target images. Cropping increases the variability in positioning and size, thereby expanding the range of image variations.
[0064] Step S223 involves randomly cropping each sample target image in the original dataset within a range of 0 to 10° to obtain multiple cropped sample target images. The random cropping range of 0 to 10° is set to represent the image effects under different camera perspectives.
[0065] Step S224: Randomly adjust the brightness of each sample target image in the original dataset to obtain multiple brightness-adjusted sample target images. The brightness of the images is randomly changed, with the brightness adjustment range from -20% to +20%, to simulate different lighting conditions in a pig farm environment.
[0066] Step S225: Merge multiple rotated sample target images, cropped sample target images, sheared sample target images, brightness-adjusted sample target images, and the original dataset to form an expanded dataset.
[0067] Specifically, the boar image set (i.e., the expanded dataset) was randomly divided into a training set, a validation set, and a test set in an 8:1:1 ratio. The target images were labeled using the labelimg image annotation tool, and the boars were selected and labeled with rectangular boxes.
[0068] During training, the training set and validation set data are input into the improved YOLOv10 model for training and validation. The validation set is used for validation in each training round. After a certain number of training iterations, the model parameters are tested using the test set. If the results do not meet the requirements, the training parameters are further adjusted and the model is retrained until the results meet the standards.
[0069] As an optional implementation method, such as Figure 2 As shown, the backbone network module includes a first convolutional layer, a second convolutional layer, a first C2f layer, a third convolutional layer, a second C2f layer, a first SCDown layer, a first C2fCIB layer, a second SCDown layer, a second C2fCIB layer, an SPPF module, and a self-attention mechanism module, which are connected in sequence.
[0070] Specifically, Figure 2In this diagram, each convolutional layer (Conv) represents a convolutional block with Batch Normalization (BN) and SiLU activation functions; each C2f layer (faster implementation of Cross Stage Partial (CSP) Bottleneck with 2 convolutions) is a feature extraction module that improves the CSP structure; each SCDown layer (downsampling with separable convolutions) is a downsampling module that separates spatial and channel representations; each C2fCIB layer (a convolutional block with C2f and conditional identity block (CIB) modules) is a feature extraction module that combines C2f and CIB modules; SPPF (spatial pyramid pooling-fast layer) is a fast spatial pyramid pooling module; PSA (implementing position-sensitive attention in neural networks) is a self-attention mechanism module; each IUB layer (improved upsample block) is an improved upsampling module; each Concat layer (concatenate) is a connection block; and each C2f-SCConv (a convolutional block with C2f and spatial and channel reconstruction) is a convolutional block. The convolution(SCConv)modules) module is a feature extraction module that combines the C2f and SCConv sub-modules.
[0071] The improved YOLOv10 Backbone network module is the main part of the entire deep neural network, responsible for extracting features from the input data. The input target image is continuously processed through two convolutional layers for feature extraction, then refined through the first C2f layer, followed by a third convolutional layer for feature extraction, and then refined again through the second C2f layer. After that, the first SCDown layer downsamples the feature map, and then the first C2fCIB layer enhances the expressive power of the feature map. This process is repeated with the second SCDown layer and the second C2fCIB layer to further enhance the expressive power of the feature map. The SPPF layer then addresses the limitation of the fixed input size of the network, achieving the fusion of local and global features. Finally, the PSA layer combines channel attention and spatial attention, enabling the network to simultaneously focus on the feature channels and the position in the image space.
[0072] As an optional implementation method, such as Figure 2 As shown, the neck network module includes a first IUB layer, a first Concat layer, a first C2f-SCConv layer, a second IUB layer, a second Concat layer, a second C2f-SCConv layer, a fourth convolutional layer, a third Concat layer, a third C2f-SCConv layer, a third SCDown layer, a fourth Concat layer, and a fourth C2f-SCConv layer connected in sequence.
[0073] Specifically, the first IUB layer is connected to the self-attention mechanism module, the first Concat layer is connected to the first C2fCIB layer, the second Concat layer is connected to the second C2f layer, the third Concat layer is connected to the first C2f-SCConv layer, and the fourth Concat layer is connected to the self-attention mechanism module.
[0074] Specifically, the Neck network module of YOLOv10 further processes and integrates the features extracted from the Backbone. The output of the Backbone network module first passes through an upsampling first IUB layer to enlarge the feature map by a factor of two. Then, it is dynamically weighted and fused with the output of the first C2fCIB layer in the Backbone through a feature weighting first Concat layer. The result is then fed into the first C2f-SCConv layer to refine the features. Next, the feature map is upsampled and enlarged by a factor of two through a second IUB layer. Then, it is weighted and merged with the output features of the second C2f layer in the Backbone through a second Concat layer. After that, the features are refined through the second C2f-SCConv layer. After feature extraction through the fourth convolutional layer, the features are weighted and merged with the output features of the first C2f-SCConv layer through a third Concat layer. The features are then refined through the third C2f-SCConv layer. After downsampling to reduce the size of the feature map through the third SCDown layer, it is dynamically weighted and merged with the output of the PSA layer in the Backbone through a fourth Concat layer. Finally, the features are refined through the fourth C2f-SCConv layer.
[0075] As an optional implementation method, such as Figure 3 As shown, both the first IUB layer and the second IUB layer include an upsampling layer, a fifth convolutional layer, a DWC convolutional layer, a PReLU activation layer, a BN layer, and a sixth convolutional layer connected in sequence.
[0076] Specifically, each IUB (Improved Upsample Block) layer is a new module improved from the Upsample module in YOLOv10. After upsampling by a factor of 2 in the Upsample module (i.e., the upsampling layer), a 1*1 convolution (i.e., the fifth convolutional layer) is used to reduce the dimensionality of the input data channels, thereby reducing the number of model parameters. Then, a 3*3 DWC (depth-wise convolution) layer is used to further extract feature information. Next, a PReLU activation layer is used to introduce non-linear factors into the neurons, increasing the expressive power of the deep neural network. Then, a BN (Batch Normalization) layer is used to perform batch normalization so that the output features are within the same scale range, accelerating training convergence. Finally, a 1*1 convolutional layer (i.e., the sixth convolutional layer) is used to match the number of input channels for the next stage.
[0077] The expression for the IUB layer is:
[0078] IUB(x)=C 1*1 (BN(PReLU(DWC(C 1*1 (Up(x))))))(1)
[0079] Here, x represents the feature value extracted after passing through the preceding neural network.
[0080] The IUB layer can extract and enhance features better without significantly increasing computational overhead, which helps to fuse features between different layers and improves the model's learning ability.
[0081] As an optional implementation method, such as Figure 4 As shown in (b), the first C2f-SCConv layer, the second C2f-SCConv layer, the third C2f-SCConv layer and the fourth C2f-SCConv layer each include a spatial reconstruction unit (SRU) and a channel reconstruction unit (CRU) connected in sequence.
[0082] Specifically, the C2f module in the neck network significantly increases the feature dimension, making the feature representation problem in the feature optimization process more complex. Therefore, the SCConv module is introduced to replace the traditional Bottleneck module in C2f (i.e., Figure 4 As shown in (a), a C2f-SCConv module is created. This module can reduce redundant information, enhance feature representation, and make feature optimization more flexible by adaptively adjusting the spatial structure and channel relationship of features, thereby improving the target detection capability for boars.
[0083] The Spatial Reconstruction Unit (SRU) and the Channel Reconstruction Unit (CRU) are arranged sequentially. The input feature (called X) first passes through the Spatial Reconstruction Unit to obtain the spatially refined feature X. w Then, after passing through the channel reconstruction unit, the channel-refined features (called Y) are obtained as the output.
[0084] in, Figure 5 The diagram shows the structure of the Spatial Reconstruction Unit (SRU). The SRU employs a separation-reconstruction approach. The separation operation aims to distinguish feature maps with different information contents, corresponding to the spatial content. First, a scaling factor based on group normalization is used to evaluate the information content of different feature maps.
[0085]
[0086] Where μ and σ are the mean and standard deviation of the feature X, γ and β are trainable variables, and ε is a minimal constant used to ensure stability. out X is the standardized input feature.
[0087]
[0088] Among them, W γ The relevant weights in the normalization are obtained from formula (3) and are used to express the importance of different feature maps.
[0089] Using formula (4), the W r The reweighted feature maps are mapped to the (0,1) range using the sigmoid function, and W1 and W2 are obtained by thresholding and gate operation.
[0090] W = Gate(Sigmoid(W) r (GN(X))))(4)
[0091] The reconstruction operation adds features with more information to features with less information, generating features with more information and saving space.
[0092]
[0093] in, It is element-wise multiplication. It's element-wise addition, and U is the union operation. Specifically, the input feature X is multiplied by W1 and W2 respectively to obtain the set with higher information content. and less information Will and Divided equally into and X is obtained by merging two different information features after cross-reconstruction and weighting. w1 and X w2 After connecting them, we get the spatially refined feature map X. w .
[0094] After SRU processing, features with high information content are separated, reducing redundant features in the spatial dimension.
[0095] Furthermore, Figure 6 This is a structural diagram of a Channel Reconstruction Unit (CRU), which employs a segmentation-transformation-fusion method. The segmentation operation refines the spatial features X. w The feature is divided into two parts: one part has αC channels, and the other part has (1-α)C channels, where α is a hyperparameter and 0 ≤ α ≤ 1. Then, the channel counts of the two sets of features are compressed using a 1*1 convolution kernel to obtain X. up and X low .
[0096] Transformation operation on input X up Perform group-wise convolution (GWC) and point-wise convolution (PWC) separately, then sum them to obtain the output Y1; for the input X... low Perform PWC, and take the union of the result and the original input to get Y2.
[0097] The fusion operation uses pointwise convolution to merge Y1 and Y2. Specifically, firstly, global average pooling is used to combine global spatial information and channel statistics to obtain pooled S1 and S2. Then, softmax is applied to S1 and S2 to obtain feature weight vectors β1 and β2. Finally, the feature weight vectors are used to obtain the output Y = β1Y1 + β2Y2, where Y is the channel-extracted feature.
[0098] As an optional implementation method, such as Figure 2 As shown, the head network module includes: a first detection head, a second detection head, and a third detection head; the first detection head, the second detection head, and the third detection head all include a first detection layer and a second detection layer connected in parallel, wherein the first detection layer is... Figure 2 The second detection layer in the One-to-one Head is... Figure 2 One-to-many Head in the context of the game.
[0099] The first detection head is connected to the second C2f-SCConv layer, the second detection head is connected to the third C2f-SCConv layer, and the third detection head is connected to the fourth C2f-SCConv layer.
[0100] The beneficial effects of this application are:
[0101] 1) The boar target detection model proposed in this application improves upon the excellent balance between accuracy and efficiency of the YOLOv10 algorithm. Specifically, the IUB and C2f-SCConv modules in the neck network of the YOLOv10 model are improved, which enhances the feature extraction effect, improves the model's ability to adaptively optimize and adjust the spatial structure and channel relationship of feature information, removes redundant information, reduces the number of model parameters and computational complexity, and reduces computational overhead, thus supporting the edge deployment needs in actual production.
[0102] 2) Based on the original YOLOv10, this application replaces the original Bottleneck module with the Spatial and Channel Reconstruction Convolution (SCConv) module. The spatial reconstruction unit uses a separation-reconstruction method to reduce spatial redundancy, while the channel reconstruction unit uses a segmentation-transformation-fusion method to reduce channel redundancy. The two units work together to reduce redundant information in the features of the CNN. An IUB module is proposed and used to enhance feature representation, making feature optimization of the model more flexible and improving the recognition performance of boar images. The boar target detection model proposed in this application can achieve fast and accurate detection with fewer model parameters.
[0103] Based on the same inventive concept, this application also provides a boar target detection system for implementing the boar target detection method described above. The solution provided by this system is similar to the implementation scheme described in the above method; therefore, the specific limitations of one or more boar target detection system embodiments provided below can be found in the limitations of the boar target detection method described above, and will not be repeated here.
[0104] In one exemplary embodiment, a boar target detection system is provided, comprising:
[0105] The target image acquisition unit is used to acquire an image containing the target to be detected as the target image.
[0106] The detection result determination unit is used to input the target image into the boar target detection model and output the detection result; the detection result includes the target category and the target location; the target category is a boar or a non-boar, and the target location is the location of the bounding rectangle where the target is located; the boar target detection model is obtained by training an improved YOLOv10 model using a training set; the training set includes: sample target images and corresponding sample annotation results; the sample target images include images of boars in various body positions under natural conditions.
[0107] The improved YOLOv10 model includes a backbone network module, a neck network module, and a head network module connected in sequence.
[0108] After model training, select appropriate edge devices for deployment, such as the Jetson Orin series edge devices. Once deployed, on the pig farm, cameras capable of uploading target images to the cloud can be used to transmit the collected data to the cloud server in real time. The edge devices can then retrieve the target images from the cloud server in real time. Alternatively, USB cameras connected directly to the edge devices can capture images of boars and transmit them to the edge devices. After preprocessing, the target images are input into the boar target detection model, which identifies the boars in the target images.
[0109] In one exemplary embodiment, a computer device is provided, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a boar target detection method.
[0110] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 7 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media to run. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for detecting boar targets.
[0111] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0112] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0113] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0114] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0115] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0116] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for detecting targets in breeding boars, characterized in that, The target detection method for boars includes: Obtain the image containing the target to be detected as the target image; The target image is input into the boar target detection model, and the detection result is output. The detection result includes the target category and the target location. The target category is either a boar or a non-boar, and the target location is the location of the bounding rectangle where the target is located. The boar target detection model is obtained by training an improved YOLOv10 model using a training set. The training set includes sample target images and corresponding sample annotation results. The sample target images include images of boars in various body positions under natural conditions. The improved YOLOv10 model includes a backbone network module, a neck network module, and a head network module connected in sequence.
2. The boar target detection method according to claim 1, characterized in that, The training process of the boar target detection model specifically includes: Obtain the original dataset; The original dataset is expanded to obtain the expanded dataset; The expanded dataset is divided into training, validation, and test sets according to a preset ratio. For each training cycle: Sample target images are obtained from the training set and input into the improved YOLOv10 model to obtain the corresponding sample detection results; A loss function is constructed based on the sample detection results and the corresponding boar labeling results, and the parameters of the improved YOLOv10 model are iteratively optimized based on the loss function. At the end of the current training cycle, the boar detection model at the current moment is evaluated using the validation set, and the hyperparameters of the boar detection model at the current moment are adjusted according to the evaluation results until the evaluation results meet the preset conditions, at which point iterative optimization stops, and the boar target detection model is obtained.
3. The boar target detection method according to claim 2, characterized in that, The original dataset is augmented to obtain the augmented dataset, which specifically includes: Rotation operations are performed on each sample target image in the original dataset to obtain multiple rotated sample target images; the rotation operations include clockwise rotation and counterclockwise rotation; Cropping is performed on each sample target image in the original dataset to obtain multiple cropped sample target images; Randomly crop the target images of each sample in the original dataset within the range of 0 to 10° to obtain multiple cropped target images; Random brightness adjustment is performed on each sample target image in the original dataset to obtain multiple brightness-adjusted sample target images; The expanded dataset is formed by merging multiple rotated sample target images, cropped sample target images, sheared sample target images, brightness-adjusted sample target images, and the original dataset.
4. The boar target detection method according to claim 1, characterized in that, The backbone network module includes a first convolutional layer, a second convolutional layer, a first C2f layer, a third convolutional layer, a second C2f layer, a first SCDown layer, a first C2fCIB layer, a second SCDown layer, a second C2fCIB layer, an SPPF module, and a self-attention mechanism module, which are connected in sequence.
5. The boar target detection method according to claim 4, characterized in that, The neck network module includes a first IUB layer, a first Concat layer, a first C2f-SCConv layer, a second IUB layer, a second Concat layer, a second C2f-SCConv layer, a fourth convolutional layer, a third Concat layer, a third C2f-SCConv layer, a third SCDown layer, a fourth Concat layer, and a fourth C2f-SCConv layer connected in sequence. Specifically, the first IUB layer is connected to the self-attention mechanism module, the first Concat layer is connected to the first C2fCIB layer, the second Concat layer is connected to the second C2f layer, the third Concat layer is connected to the first C2f-SCConv layer, and the fourth Concat layer is connected to the self-attention mechanism module.
6. The boar target detection method according to claim 5, characterized in that, Both the first IUB layer and the second IUB layer include an upsampling layer, a fifth convolutional layer, a DWC convolutional layer, a PReLU activation layer, a BN layer, and a sixth convolutional layer connected in sequence.
7. The boar target detection method according to claim 6, characterized in that, The first C2f-SCConv layer, the second C2f-SCConv layer, the third C2f-SCConv layer, and the fourth C2f-SCConv layer all include a spatial reconstruction unit and a channel reconstruction unit connected in sequence.
8. The boar target detection method according to claim 7, characterized in that, The head network module includes: a first detection head, a second detection head, and a third detection head; the first detection head, the second detection head, and the third detection head each include a first detection layer and a second detection layer connected in parallel; The first detection head is connected to the second C2f-SCConv layer, the second detection head is connected to the third C2f-SCConv layer, and the third detection head is connected to the fourth C2f-SCConv layer.
9. A boar target detection system, characterized in that, The boar target detection system is used to implement the boar target detection method according to any one of claims 1-8, and the boar target detection system comprises: The target image acquisition unit is used to acquire an image containing the target to be detected as the target image; The detection result determination unit is used to input the target image into the boar target detection model and output the detection result; the detection result includes the target category and the target location; the target category is a boar or a non-boar, and the target location is the location of the bounding rectangle where the target is located; the boar target detection model is obtained by training an improved YOLOv10 model using a training set; the training set includes: sample target images and corresponding sample annotation results; the sample target images include images of boars in various body positions under natural conditions; The improved YOLOv10 model includes a backbone network module, a neck network module, and a head network module connected in sequence.
10. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the boar target detection method according to any one of claims 1-8.