Animal husbandry image recognition method and device based on deep learning

By improving the lightweight residual structure and loss function of the MobileVit model and combining it with data augmentation technology, the MobileSheepVit model was constructed, which solved the accuracy and robustness problems of animal individual identification in animal husbandry and achieved efficient recognition under conditions of high facial similarity and single color.

CN116452792BActive Publication Date: 2025-09-26NORTHWEST A & F UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310332796.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2025-09-26
Estimated Expiration
2043-03-30

AI Technical Summary

Technical Problem

Existing animal individual identification methods in animal husbandry are prone to loss or harm to animals, and methods based on face recognition have low recognition rates in livestock facial recognition and large number of model parameters, making it difficult to adapt to the needs of smart farming.

Method used

A livestock image recognition method based on deep learning is adopted. Through data enhancement processing, the lightweight residual structure and loss function of the MobileVit model are improved. Combined with the SandGlass structure and reparameterization, the AdaCos loss function is used to construct the MobileSheepVit model to enhance the feature extraction capability, suppress unnecessary features, and improve recognition accuracy.

Benefits of technology

Under conditions of high facial similarity and single color, it can accurately identify the identity of livestock with small size differences. It has better robustness and generalization, and its recognition accuracy is better than traditional methods. It is suitable for common deep learning network models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116452792B_ABST
    Figure CN116452792B_ABST
Patent Text Reader

Abstract

The present application relates to a livestock image recognition method and device based on deep learning. By adopting a data enhancement method, the facial feature areas that the recognition model focuses on during the facial recognition process are effectively understood, which helps focus on important features and suppresses unnecessary features. The MobileSheepVit model constructed by improving the MobileVIT model by utilizing the SandGlass structure, reparameterization and full convolution can effectively increase the feature extraction capability, so that the target can be accurately identified when the facial similarity is high, and the recognition effect is better when the target color is single. It can accurately identify the identity of livestock with small body size differences, has better robustness and generalization, and is superior to the usual facial image recognition method in terms of accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular, to a livestock image recognition method and device based on deep learning. Background Art

[0002] With economic development, people are increasingly concerned about food safety. In livestock farming, identifying and recording individual animals is crucial for precise feeding and food traceability. Simple and convenient animal identification not only significantly reduces labor costs but also enhances farm management, providing a foundation for food safety and the development of modern farms.

[0003] Currently, livestock identification in my country mainly relies on ear tags, radio frequency identification, and original hair markings. These identification methods are often prone to loss or harm to animals. Under the current trend of smart farming, cameras in feeding scenes have become an indispensable infrastructure for modern farming. Livestock facial recognition based on computer vision technology has become an indispensable part of the future smart farming field.

[0004] Scholars have been researching and using animal identification technology based on computer vision. The current mainstream recognition models have large model parameters and low recognition rates. The main methodologies are based on human face recognition to solve animal facial recognition problems. Few methods solve the problem based on the facial characteristics of livestock themselves. Summary of the Invention

[0005] In order to overcome at least one deficiency in the prior art, the present application provides a livestock image recognition method and device based on deep learning.

[0006] In a first aspect, a livestock image recognition method based on deep learning is provided, comprising:

[0007] Performing data enhancement processing on the image to be identified to obtain a processed image; the image to be identified is a facial image of the individual target to be identified;

[0008] Construct an image recognition model; the main network structure of the image recognition model is the MobileVit model. The lightweight residual structure in the MobileVit model is replaced by the SandGlass structure and combined with reparameterization. The average pooling layer in the MobileVit model is replaced by a convolutional layer. The loss function of the image recognition model is the AdaCos loss function.

[0009] The processed image is input into the image recognition model to obtain the recognition result of the individual target to be identified.

[0010] In one embodiment, performing data enhancement processing on the image to be identified to obtain a processed image includes:

[0011] The image to be identified is processed using a piecewise linear function to obtain the processed image; the piecewise linear function f(x) is:

[0012]

[0013] Where x is the image pixel value, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,250].

[0014] In one embodiment, the image recognition model includes a first convolutional layer, three RepMxT modules, a MobileVit module, two RepMxT modules, and a second convolutional layer; each RepMxT module includes a SandGlass structure and a reparameterization module.

[0015] In one embodiment, building an image recognition model includes:

[0016] Obtain a detection dataset; the detection dataset includes multiple facial images of individual targets of different colors;

[0017] Preprocessing the detection data set to obtain a preprocessed data set;

[0018] Perform data enhancement on the preprocessed data set to obtain a training data set;

[0019] The image recognition model is trained based on the training data set to obtain a trained image recognition model.

[0020] In one embodiment, the preprocessing includes screening facial images in the detection dataset and performing data augmentation on the facial images.

[0021] In a second aspect, a livestock image recognition device based on deep learning is provided, comprising:

[0022] The enhancement processing module is used to perform data enhancement processing on the image to be identified to obtain a processed image; the image to be identified is a facial image of the individual target to be identified;

[0023] The model building module is used to build an image recognition model. The main network structure of the image recognition model is the MobileVit model. The lightweight residual structure in the MobileVit model is replaced by the SandGlass structure and combined with reparameterization. The average pooling layer in the MobileVit model is replaced by a convolutional layer. The loss function of the image recognition model is the AdaCos loss function.

[0024] The recognition module is used to input the processed image into the image recognition model to obtain the recognition result of the individual target to be identified.

[0025] In one embodiment, the enhancement processing module is further configured to:

[0026] The image to be identified is processed using a piecewise linear function to obtain the processed image; the piecewise linear function f(x) is:

[0027]

[0028] Where x is the pixel value of the image, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,250].

[0029] In one embodiment, the image recognition model includes a first convolutional layer, three RepMxT modules, a MobileVit module, two RepMxT modules, and a second convolutional layer; each RepMxT module includes a SandGlass structure and a reparameterization module.

[0030] In one embodiment, the model building module is further configured to:

[0031] Obtain a detection dataset; the detection dataset includes multiple facial images of individual targets of different colors;

[0032] Preprocessing the detection data set to obtain a preprocessed data set;

[0033] Perform data enhancement on the preprocessed data set to obtain a training data set;

[0034] The image recognition model is trained based on the training data set to obtain a trained image recognition model.

[0035] In one embodiment, the preprocessing includes screening facial images in the detection dataset and performing data augmentation on the facial images.

[0036] Compared with the prior art, this application has the following beneficial effects:

[0037] (1) This application uses data enhancement to effectively understand the facial feature areas that the recognition model focuses on during facial recognition, helping to focus on important features and suppress unnecessary features.

[0038] (2) This application uses CAM heat map and histogram statistics to obtain the area that needs to be enhanced in the image, designs a piecewise linear function based on the enhanced area, and designs an enhancement method for livestock facial image data. It has a significant improvement in the accurate recognition of livestock faces and can be widely applied to common deep learning network models.

[0039] (3) The MobileSheepVit model constructed by the present application by utilizing the SandGlass structure, reparameterization and full convolution to improve the MobileVIT model can effectively increase the feature extraction capability, so that the target can be accurately identified when the facial similarity is high, and the recognition effect is better when the target color is single. It can accurately identify the identity of livestock with small body size differences, has better robustness and generalization, and is superior to the usual facial image recognition method in terms of accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The present application may be better understood by referring to the following description in conjunction with the accompanying drawings, which together with the following detailed description are incorporated into and form a part of this specification. In the drawings:

[0041] Figure 1 A flowchart of a livestock image recognition method based on deep learning according to an embodiment of the present application is shown;

[0042] Figure 2 A schematic diagram of an improved image recognition model according to an embodiment of the present application is shown;

[0043] Figure 3 A schematic diagram of the structure of the RepMxt module according to an embodiment of the present application is shown;

[0044] Figure 4 The image effect after data enhancement is shown;

[0045] Figure 5 The CAM heat map of the sheep face is shown;

[0046] Figure 6 shows a basic pixel area distribution diagram of the focus area in the facial image;

[0047] Figure 7 The following is a block diagram of a livestock image recognition device based on deep learning according to an embodiment of the present application;

[0048] Figure 8The figure shows the comparison of model recognition accuracy when different models use data enhancement and when not using data enhancement, among which, (a) is the comparison of pattern recognition accuracy when ResNet18 model uses data enhancement and when not using data enhancement, (b) is the comparison of pattern recognition accuracy when MobileNetV1 model uses data enhancement and when not using data enhancement, (c) is the comparison of pattern recognition accuracy when shufferNetV2 model uses data enhancement and when not using data enhancement, (d) is the comparison of pattern recognition accuracy when MobileNetV3 model uses data enhancement and when not using data enhancement, (e) is the comparison of pattern recognition accuracy when MobileNetV2 model uses data enhancement and when not using data enhancement, (f) is the comparison of pattern recognition accuracy when MobileNetViT model uses data enhancement and when not using data enhancement;

[0049] Figure 9 A comparison chart of model recognition accuracy of different models is shown;

[0050] Figure 10 A schematic diagram of the loss value change process of different loss functions is shown. DETAILED DESCRIPTION

[0051] Exemplary embodiments of the present application are described below with reference to the accompanying drawings. For the sake of clarity and conciseness, not all features of actual embodiments are described in this specification. However, it should be understood that in the process of developing any such actual embodiment, many implementation-specific decisions may be made to achieve the developer's specific goals, and these decisions may vary from one implementation to another.

[0052] It is also necessary to explain here that, in order to avoid obscuring the present application due to unnecessary details, the accompanying drawings only show the device structure closely related to the solution according to the present application, while other details that are not closely related to the present application are omitted.

[0053] It should be understood that the present application is not limited to the described embodiments due to the following description with reference to the accompanying drawings. In this document, where feasible, the embodiments may be combined with each other, features between different embodiments may be replaced or borrowed, and one or more features may be omitted in one embodiment.

[0054] The present invention provides a method for animal husbandry image recognition based on deep learning. Figure 1 A flowchart of a method for animal husbandry image recognition based on deep learning according to an embodiment of the present application is shown. Figure 1 , methods include:

[0055] Step S1, performing data enhancement processing on the image to be identified to obtain a processed image; the image to be identified is a facial image of an individual target to be identified; here, the individual to be identified may be a sheep.

[0056] Step S2, constructing an image recognition model; the main network structure of the image recognition model is the MobileVit model, the lightweight residual structure in the MobileVit model is replaced by the SandGlass structure and combined with reparameterization, the average pooling layer in the MobileVit model is replaced by a convolutional layer, and the loss function of the image recognition model is the AdaCos loss function;

[0057] In this step, the MobileVit model is a lightweight universal visual Transformer for mobile devices. Its internal structure includes a lightweight residual structure. Here, the SandGlass structure is used instead of the lightweight residual structure and combined with reparameterization. The loss function uses the AdaCos loss function to obtain an improved image recognition model, which is represented by MobileSheepVIT. Figure 2 FIG2 shows a schematic diagram of an improved image recognition model according to an embodiment of the present application. Figure 2 It includes two parts: the feature extraction backbone and the loss function. The feature extraction body, i.e., the main network structure, includes the first convolutional layer, three RepMxT modules, a MobileVit module, two RepMxT modules, and a second convolutional layer. Each RepMxT module includes a SandGlass structure and a reparameterization module. Here, the step sizes of the three RepMxT modules are 1, 2, and 2, respectively, and the step size of the two RepMxT modules is 2. The MobileVit module is a module in the existing MobileVit model. The RepMxt module is a module formed by replacing the lightweight residual structure with a SandGlass module and combining it with a reparameterization module. The RepMxt module and the MobileVit module are responsible for obtaining local spatial inductive bias and global receptive field information, respectively, to provide more effective features for subsequent tasks. Figure 3 A schematic structural diagram of a RepMxt module according to an embodiment of the present application is shown.

[0058] Here, the SandGlass structure proposed in the MobileNeXT structure replaces the lightweight residual structure in MobileVIT, and the reparameterization idea is used to construct the RepMxT module in parallel with its multiple branches to reduce the information loss and gradient confusion caused by the lightweight residual structure in MobileVIT. It is improved into a 4-parallel reparameterization structure, which makes the model have stronger feature extraction capabilities and finally forms the RepMxT structure to improve the feature acquisition ability of the model and enhance the parameter transfer effect between high-dimensional information and low-dimensionality. At the same time, the reparameterization idea is used to improve the model recognition accuracy without increasing the original parameter amount.

[0059] In addition, in order to better improve the network recognition accuracy, the average pooling layer in the feature extraction body is replaced by the Conv1*1 convolution layer to change the problem of insufficient information obtained by the network due to the average pooling layer, resulting in a decrease in accuracy.

[0060] AdaCos is used as the loss function for recognition. In order to better solve the problem of small inter-class distance and high intra-class distance difference between sheep faces, the AdaCos loss function can use its adaptive scale parameter to automatically strengthen training supervision during training, improve the model's analysis of inter-class distance, and reduce intra-class distance, thereby better improving model accuracy.

[0061] Step S3: input the processed image into the image recognition model to obtain the recognition result of the individual target to be identified.

[0062] In the above embodiment, data enhancement is used to effectively understand the facial feature areas that the recognition model focuses on during facial recognition, help focus on important features, and suppress unnecessary features. By using the SandGlass structure and convolutional layer to transform the MobileVit model, the feature extraction capability can be effectively increased, so that when the target is recognized, it can be accurately recognized when the facial similarity is high, and the recognition effect is better when the target color is single. It can accurately identify the identity of livestock with small body size differences, has better robustness and generalization, and is superior to the usual facial image recognition method in terms of accuracy.

[0063] In one embodiment, performing data enhancement processing on the image to be identified in step S1 to obtain a processed image includes:

[0064] The image to be identified is processed using a piecewise linear function to obtain the processed image; the piecewise linear function f(x) is:

[0065]

[0066] Where x is the image pixel value, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,250].

[0067] In this embodiment, data enhancement makes the facial main area of ​​individual targets in the image more expressive, increases color expression, and enhances texture information. Taking dairy goats as an example, Figure 4 The figure shows the image effect after data enhancement.

[0068] In one embodiment, in step S2, constructing an image recognition model includes:

[0069] Step S21, obtaining a detection data set; the detection data set includes multiple facial images of individual targets of different colors;

[0070] In this step, the data set is crucial for supervised learning based on deep learning. Therefore, in order to meet the diversity of the data set, this application collects images of individual livestock in indoor living areas and outdoor working areas under different lighting conditions (such as natural light, strong light), perspectives (such as side view, front view) and distances (such as far and near) to establish a data set. All images are in JPG format with a resolution of 1920×1080. The living area is where livestock rest and eat, and the working area is where physical examination tasks such as livestock weight estimation and vaccination are performed. Taking into account the actual situation of livestock activities, this application collects facial images of livestock of different colors, so as to ensure data diversity, enable the model to achieve good recognition effects in all picture-through scenarios, and increase the generalization ability of the model.

[0071] Step S22, preprocessing the detection data set to obtain a preprocessed data set;

[0072] In this step, after the detection dataset is established, it needs to be preprocessed. The preprocessing includes screening the facial images in the detection dataset and performing data expansion on the facial images.

[0073] Specifically, the detection dataset is manually labeled and divided based on the YOLOV7tiny facial detection model. In order to ensure the accuracy of recognition, facial images are screened to eliminate images that do not detect the face, are too blurry, or have less than two-thirds of the face facing forward.

[0074] In order to enrich the dataset, the collected facial images are copied and pasted, randomly scaled, randomly cropped, and randomly flipped in sequence to achieve data expansion. Because the collected data is not all data, data expansion can obtain richer and more diverse data, allowing the model to maintain good performance when processing unconventional images, allowing the model to maintain high accuracy when processing a variety of different images, and better generalization.

[0075] In addition, in order to facilitate experiments at different scales, the recognition image size is made into 256 pixels * 256 pixels.

[0076] Step S23, performing data enhancement processing on the preprocessed data set to obtain a training data set;

[0077] Data enhancement processing uses a piecewise linear function; the piecewise linear function f(x) is:

[0078]

[0079] Where x is the image pixel value, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,250].

[0080] In this step, the pre-processed dataset is subjected to a preliminary experiment through the ResNet50 recognition network. In order to find the hard cases that the recognition model often misidentifies and the attention map of the general model in solving the face recognition problem, the recognition dataset is analyzed in a preliminary experiment. It is found that the hard cases that are misidentified are basically pure white individuals. Therefore, in order to enhance the characteristics of the dataset, the divided dataset is visualized based on the CAM heat map. Figure 5 The CAM heat map of the sheep face is shown to obtain the main focus areas of the recognition model; Figure 6 The basic pixel area distribution diagram of the focus area in the facial image is shown. The basic pixel area of ​​the focus area in the facial image can be basically determined by the histogram. Figure 6 As can be seen, for example, in the dairy goat image, the image data is primarily distributed in the [150, 210] region, while the goat's face is primarily distributed between [170, 220], and the region between [220, 255] is mostly background or other non-essential areas. This embodiment, without destroying the original texture variations of the goat's face, uses a piecewise linear function to enrich the expression of the main areas of the livestock's face in the image, increasing color expression and enhancing texture information.

[0081] Based on the above research, using dairy goats as an example, we set three intervals to be changed: [0, 170], [170, 220], and [220, 255]. By setting the values ​​of f1, f2, and f3, we can represent the extension or compression of different intervals. Combined with the data obtained from the above experimental analysis, we choose to assign f1 a value of 170, f2 a value of 245, and f3 a value of 255. The pixel values ​​in the [0, 170] region remain unchanged, the pixel values ​​in the [170, 220] region are stretched to [170, 245], and the pixel values ​​in the [220, 255] region are compressed to [245, 255]. After processing by the formula, the pixel value distribution in the [170-220] area becomes wider, and the pixel value area [170-220] is linearly expanded to [170-245]. The area of ​​interest is enhanced, the goat face image becomes clearer, and the texture information is richer. The pixel values ​​in the original [220-255] area of ​​no interest are suppressed to [245-255]. The model will better obtain information such as the color and texture of the dairy goat's face.

[0082] Step S24: training the image recognition model based on the training data set to obtain a trained image recognition model.

[0083] Using the same inventive concept as the livestock image recognition method based on deep learning, this embodiment also provides a corresponding livestock image recognition device based on deep learning. Figure 7 The structure block diagram of the livestock image recognition device based on deep learning according to an embodiment of the present application is shown, including:

[0084] The enhancement processing module 71 is used to perform data enhancement processing on the image to be identified to obtain a processed image; the image to be identified is a facial image of the individual target to be identified;

[0085] The model construction module 72 is used to construct an image recognition model; the main network structure of the image recognition model is the MobileVit model, the lightweight residual structure in the MobileVit model is replaced by the SandGlass structure, the average pooling layer in the MobileVit model is replaced by a convolutional layer, and the loss function of the image recognition model is the AdaCos loss function;

[0086] The recognition module 73 is used to input the processed image into the image recognition model to obtain the recognition result of the individual target to be recognized.

[0087] In the above embodiment, data enhancement is used to effectively understand the facial feature areas that the recognition model focuses on during facial recognition, help focus on important features, and suppress unnecessary features. By using the SandGlass module and convolutional layer to transform the MobileVit model, the feature extraction capability can be effectively increased, so that when the target is recognized, it can be accurately recognized when the facial similarity is high, and the recognition effect is better when the target color is single. It can accurately identify the identity of livestock with small body size differences, has better robustness and generalization, and is superior to the usual facial image recognition method in terms of accuracy.

[0088] In one embodiment, the enhancement processing module 71 is further configured to:

[0089] The image to be identified is processed using a piecewise linear function to obtain the processed image; the piecewise linear function f(x) is:

[0090]

[0091] Where x is the image pixel value, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,250].

[0092] In one embodiment, the model building module 72 is further configured to:

[0093] Obtain a detection dataset; the detection dataset includes multiple facial images of individual targets of different colors;

[0094] Preprocessing the detection data set to obtain a preprocessed data set;

[0095] Perform data enhancement on the preprocessed data set to obtain a training data set;

[0096] The image recognition model is trained based on the training data set to obtain a trained image recognition model.

[0097] To further verify the effectiveness of the method and device of this application, this application uses the image recognition method provided in this application to process sheep images from a sheep farm as an example. In this experiment, this application uses four methods to compare the effects, including sheep face data enhancement, different recognition models, different metric functions, and different data sets.

[0098] In order to verify the extent to which the data enhancement method of this application improves the recognition effect, an experimental analysis was conducted on the sheep face dataset using two different models. Figure 8The figure shows the comparison of model recognition accuracy when different models use data enhancement and when not using data enhancement, among which, (a) is the comparison of pattern recognition accuracy when ResNet18 model uses data enhancement and when not using data enhancement, (b) is the comparison of pattern recognition accuracy when MobileNetV1 model uses data enhancement and when not using data enhancement, (c) is the comparison of pattern recognition accuracy when shufferNetV2 model uses data enhancement and when not using data enhancement, (d) is the comparison of pattern recognition accuracy when MobileNetV3 model uses data enhancement and when not using data enhancement, (e) is the comparison of pattern recognition accuracy when MobileNetV2 model uses data enhancement and when not using data enhancement, (f) is the comparison of pattern recognition accuracy when MobileNetViT model uses data enhancement and when not using data enhancement. Among them, the blue curve represents the recognition accuracy with data enhancement, and the orange curve represents the recognition accuracy without data enhancement. Figure 7 It can be seen that different models have achieved relatively good improvements after enhancing the sheep face data based on the data enhancement method designed in the application. Therefore, the sheep face data enhancement method of this application has a higher degree of breadth and stability improvement for research in the field of traditional sheep face recognition. It is a relatively general method to improve recognition accuracy without model burden.

[0099] In order to verify the degree of improvement of the recognition effect of the recognition model in this application, experimental analysis was carried out on the sheep face dataset using different recognition models. Figure 9 The comparison chart of model recognition accuracy of different models is shown. Figure 9 It can be seen that the recognition model of the present application has relatively good results in terms of both convergence speed and accuracy.

[0100] In order to verify the degree of improvement of recognition effect by different metric functions in this application, experimental analysis was conducted on the sheep face dataset using different loss functions: Tripletloss, Cosface, Arcface, and Adacos. Figure 10 A schematic diagram of the loss value change process of different loss functions is shown, see Figure 10The loss values ​​of the four metric functions gradually decrease as the number of model training iterations increases. Although the triplet-based loss function Tripletloss has a faster convergence speed than the other three loss functions, its loss value stabilizes after dropping to around 10 and no longer decreases. Analysis shows that the reason for this is that Tripletloss uses the Euclidean distance based on triples to calculate the loss value, resulting in a relatively higher loss value compared to the cosine distance-based loss function. The other three loss functions began to converge rapidly in the first 20 iterations, among which Adacos converged slightly faster than Cosface and Arcface. Analysis shows that the model continuously selected the optimal hyperparameters in an adaptive manner during training, resulting in a faster convergence speed. After 20 iterations, the convergence speed began to slow down. After the 60th iteration, the loss value only fluctuated slightly, indicating that the model fitting was complete.

[0101] In summary, this application has the following technical effects:

[0102] (1) Compared with other recognition methods, the present invention has better recognition effect when the sheep's face is pure white, and can accurately detect the facial position information of livestock. It has better robustness and generalization, and is superior to conventional facial recognition methods in terms of accuracy.

[0103] (2) This application uses a series of operations such as pre-experimental identification of focus areas and visualization using CAM heatmaps to design a method for enhancing individual livestock data using piecewise linear functions. This method enriches the expression of the main facial areas of individual livestock, increases color expression, and enhances texture information, thereby improving recognition efficiency. At the same time, a copy-and-paste expansion method is used to enrich the dataset, and random scaling is used on the entire data set to increase the generalization of the dataset.

[0104] (3) This application is based on the MobileVit model and uses the SandGlass structure and reparameterization ideas to construct the RepMxT module, which reduces the information loss and gradient confusion caused by the inverted residual structure in MobileVIT, thereby improving the model's feature acquisition capabilities and enhancing the parameter transfer effect between high-dimensional information and low-dimensionality, while making the model more lightweight. By introducing a deep convolutional layer to replace the average pooling layer, the problem of decreased accuracy caused by the average pooling layer is corrected. Secondly, by introducing AdaCos as the loss function, the problem of small inter-class distances and high intra-class distance differences between sheep faces is better solved, so that the model can automatically strengthen training supervision during training by adaptively adjusting the proportional parameters, improve the model's analysis of inter-class distances, reduce intra-class distances, and better improve model accuracy.

[0105] (4) This application provides technical support for the implementation of deep learning-based intelligent livestock management, alleviates the basic identity recognition work of visual tasks in real livestock environments, and provides a foundation for other livestock-related application methods.

[0106] The above descriptions are merely examples of various embodiments of the present application, but the scope of protection of the present application is not limited thereto. Any modifications or substitutions that can be readily conceived by a person skilled in the art within the technical scope disclosed in the present application should be included within the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.

Claims

1. A livestock image recognition method based on deep learning, characterized in that: include: Perform data enhancement processing on the image to be identified to obtain a processed image; The image to be identified is a facial image of an individual target to be identified; Constructing an image recognition model; the main network structure of the image recognition model is the MobileVit model, the lightweight residual structure in the MobileVit model is replaced by the SandGlass structure and combined with reparameterization, the average pooling layer in the MobileVit model is replaced by a convolutional layer, and the loss function of the image recognition model is the AdaCos loss function; The processed image is input into the image recognition model to obtain a recognition result of the individual target to be recognized.

2. The method according to claim 1, wherein The performing data enhancement processing on the image to be identified to obtain a processed image includes: The image to be identified is processed using a piecewise linear function to obtain the processed image; the piecewise linear function f(x) is: Where x is the image pixel value, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,255].

3. The method according to claim 1, wherein The image recognition model includes a first convolutional layer, three RepMxT modules, a MobileVit module, two RepMxT modules and a second convolutional layer; each of the RepMxT modules includes a SandGlass structure and a reparameterization module.

4. The method according to claim 1, wherein The image recognition model is constructed, comprising: Acquire a detection data set; the detection data set includes multiple facial images of individual targets of different colors; Preprocessing the detection data set to obtain a preprocessed data set; Performing data enhancement processing on the preprocessed data set to obtain a training data set; The image recognition model is trained based on the training data set to obtain a trained image recognition model.

5. The method according to claim 4, wherein The preprocessing includes screening the facial images in the detection data set and performing data expansion on the facial images.

6. A livestock image recognition device based on deep learning, characterized in that: include: An enhancement processing module is used to perform data enhancement processing on the image to be identified to obtain a processed image; The image to be identified is a facial image of an individual target to be identified; A model construction module is used to construct an image recognition model; the main network structure of the image recognition model is the MobileVit model, the lightweight residual structure in the MobileVit model is replaced by the SandGlass structure and combined with reparameterization, the average pooling layer in the MobileVit model is replaced by a convolutional layer, and the loss function of the image recognition model is the AdaCos loss function; The recognition module is used to input the processed image into the image recognition model to obtain the recognition result of the individual target to be identified.

7. The device according to claim 6, characterized in that The enhanced processing module is further configured to: The image to be identified is processed using a piecewise linear function to obtain the processed image; the piecewise linear function f(x) is: Where x is the pixel value of the image, f1 is the critical value of the pixel interval [0,170], f2 is the critical value of the pixel interval [170,220], and f3 is the critical value of the pixel interval [220,255].

8. The device according to claim 6, wherein The image recognition model includes a first convolutional layer, three RepMxT modules, a Mobi leVit module, two RepMxT modules and a second convolutional layer; each of the RepMxT modules includes a SandGlass structure and a reparameterization module.

9. The device according to claim 6, wherein The model building module is also used to: Acquire a detection data set; the detection data set includes multiple facial images of individual targets of different colors; Preprocessing the detection data set to obtain a preprocessed data set; Performing data enhancement processing on the preprocessed data set to obtain a training data set; The image recognition model is trained based on the training data set to obtain a trained image recognition model.

10. The device according to claim 9, wherein The preprocessing includes screening the facial images in the detection data set and performing data expansion on the facial images.

Citation Information

Patent Citations

  • Coal mine underground pedestrian detection method based on image fusion and feature enhancement

    CN115311241A

  • Livestock face recognition method and device

    CN115578747A