Correction classification method and device based on pork pig image, electronic equipment and storage medium

By using a tampering classification method based on images of dead pigs, and employing text detection and tampering detection models, the method automatically identifies tampering traces in images of dead pigs. This solves the problem of farmers modifying death records, improves the accuracy and efficiency of detection, and ensures the reliability of breeding records.

CN121190809APending Publication Date: 2025-12-23WENS FOODSTUFF GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511125642.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-12
Publication Date
2025-12-23

AI Technical Summary

Technical Problem

In the pig farming industry, due to economic compensation or a lack of awareness of standardized operations, farmers may tamper with images of pig mortality records, affecting disease monitoring and corporate supervision, and potentially causing serious problems.

Method used

This paper utilizes a tampering classification method based on images of dead pigs to automatically analyze images of dead pigs using text detection and tampering detection models. The method identifies and classifies tampering marks, including text detection, convolution processing, and tampering detection, and generates tampering detection results.

Benefits of technology

This improves the accuracy and efficiency of detecting alterations to images of dead pigs, avoids errors caused by manual review, and ensures the reliability and anti-counterfeiting capabilities of breeding records.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121190809A_ABST
    Figure CN121190809A_ABST
Patent Text Reader

Abstract

The invention discloses a correction classification method and device based on a pork pig image, electronic equipment and a storage medium. The method comprises the following steps: acquiring a pork pig death image; performing text detection on the pork pig death image through a text detection model to obtain a text detection result; and performing alteration detection on the text detection result through the alteration detection model to obtain an alteration detection result corresponding to the pork pig death image. By implementing the embodiment of the invention, text detection can be performed on the obtained pork pig death image through the text detection model, and altering detection is performed on the text detection result by improving the detection model, so that the altering detection result is directly obtained, errors caused by manual altering auditing on the pork pig death image are avoided, and meanwhile, the accuracy of the altering detection result is improved. Identification is directly carried out through the text detection model and the altering detection model, altering detection can be rapidly carried out on the pork pig death image, and the accuracy and efficiency of altering detection on the pork pig death image can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, specifically to a method, apparatus, electronic device, and storage medium for classifying altered images of pigs. Background Technology

[0002] Currently, the pig farming industry generally adopts a collaborative production model between enterprises and farmers: farmers undertake daily feeding tasks, while enterprises provide breeding pigs, feed, technical support, and sales channels. To ensure full traceability of pork products, the agreement between the two parties clearly stipulates that farmers must submit complete and accurate reporting materials when pigs die during the breeding process. However, in practice, some farmers, due to concerns about economic compensation or a lack of awareness of standardized operations, often submit incomplete or late reports. Especially when there are signs of tampering with death record photos, it can directly lead to serious problems. For example, concealed true mortality data hinders epidemic monitoring, potentially delaying the detection of major animal diseases and causing the spread of the epidemic within the farming network. Alternatively, if falsified images of pigs are exposed during random inspections by regulatory authorities, enterprises will face administrative penalties for false reporting, and in severe cases, may trigger criminal investigations. Summary of the Invention

[0003] To address at least one of the aforementioned technical problems, the present invention aims to provide a method, apparatus, electronic device, and storage medium for classifying altered images of pigs.

[0004] On one hand, embodiments of the present invention include a method for classifying alterations based on images of hogs, applied to electronic devices, the method comprising: Obtain images of dead pigs; The text detection results were obtained by performing text detection on the images of dead pigs using a text detection model. The text detection results are processed by convolution using the alteration detection model to obtain the processed text detection results. The processed text detection results are classified using a tamper detection model to obtain classification results, and the tamper detection results are determined based on the classification results.

[0005] Furthermore, the text detection of the pig mortality image using a text detection model to obtain the text detection result includes: Multiple feature extractions were performed on the images of dead pigs using a text detection model to obtain multiple pig image features; The features of the multiple images of pigs are fused to obtain a target feature map; Based on the target feature map, at least one bounding box coordinate is predicted, and based on the image of the dead pig and the at least one bounding box coordinate, the text detection result is determined.

[0006] Further, the step of predicting at least one bounding box coordinate based on the target feature map, and determining the text detection result based on the image of the dead pig and the at least one bounding box coordinate, includes: The text detection model predicts a text probability map and a binarized threshold map based on the target feature map. The text probability map and the binarized threshold map are compared to determine the coordinates of at least one prediction box; The text detection result is obtained by cropping the image of the dead pig based on the coordinates of the predicted bounding box.

[0007] Furthermore, after performing text detection on the image of the dead pig using a text detection model to obtain the text detection result, the method further includes: The text region is subjected to perspective transformation based on the predicted bounding box coordinate data to obtain the transformed text region. The step of performing alteration detection on the text detection results using an alteration detection model to obtain the alteration detection results corresponding to the image of the dead pig includes: The alteration detection model is used to detect alterations in the transformed text region to obtain the alteration detection result corresponding to the image of the dead pig.

[0008] Further, the step of performing alteration detection on the text detection results using an alteration detection model to obtain the alteration detection result corresponding to the image of the dead pig includes: The text detection results are scanned and feature operations are performed using the convolution kernel in the alteration detection model to obtain the processed text detection results.

[0009] Furthermore, after performing alteration detection on the text detection results using the alteration detection model to obtain the alteration detection result corresponding to the image of the dead pig, the method further includes: Based on the images of dead pigs and the corresponding alteration detection results, a target text detection result set is generated, and the alteration detection model is trained based on the target text detection result set to obtain an updated alteration detection model.

[0010] Furthermore, prior to acquiring the images of dead pigs, the method further includes: Obtain a set of historical text detection results; the set of historical text detection results includes multiple historical text detection results and target alteration detection results corresponding to each historical text detection result. The historical text detection result set is input into the alteration detection model to be trained. The alteration detection model performs alteration detection on each historical text detection result to obtain the initial alteration detection result corresponding to each historical text detection result. Based on the error between the initial alteration detection result corresponding to each historical text detection result and the target alteration detection result corresponding to each historical text detection result, the model parameters of the alteration detection model are adjusted until the error is less than a preset error threshold, and the trained alteration detection model is obtained.

[0011] On the other hand, embodiments of the present invention include a classification device based on images of meat pigs, applied to electronic devices, the device comprising: The image acquisition module is used to acquire images of dead pigs. The text detection module is used to perform text detection on the images of dead pigs using a text detection model, and obtain the text detection results. The alteration detection module is used to perform alteration detection on the text detection results through an alteration detection model to obtain the alteration detection results corresponding to the image of the dead pig. The alteration classification module is used to classify the processed text detection results using an alteration detection model, obtain classification results, and determine the alteration detection results based on the classification results.

[0012] On the other hand, this application discloses an electronic device, including a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor enables the processor to implement any of the alteration and classification methods based on images of meat pigs disclosed in this application.

[0013] On the other hand, embodiments of the present invention also include a storage medium storing a processor-executable program, which, when executed by a processor, is used to perform the alteration classification method based on images of meat pigs in the embodiments.

[0014] Compared with related technologies, the embodiments of this application have the following beneficial effects: This application provides a method, apparatus, electronic device, and storage medium for classifying alterations based on images of dead pigs. The method involves acquiring images of dead pigs; performing text detection on the images using a text detection model to obtain text detection results; performing convolution processing on the text detection results using an alteration detection model to obtain processed text detection results; classifying the processed text detection results using the alteration detection model to obtain classification results; and determining the alteration detection result based on the classification results. Implementing this application allows for text detection on the acquired images of dead pigs using a text detection model, and then performing alteration detection on the text detection results using an enhanced detection model, thereby directly obtaining alteration detection results. This avoids errors caused by manual review of altered images of dead pigs. Furthermore, the direct identification using the text detection model and the alteration detection model enables rapid alteration detection of images of dead pigs, improving the accuracy and efficiency of alteration detection for these images. Attached Figure Description

[0015] Figure 1 This is a flowchart illustrating a method for classifying altered images of pigs disclosed in an embodiment of this application. Figure 2 This is a schematic diagram of the DBnet network structure in one embodiment; Figure 3 This is a flowchart illustrating another method for classifying altered images of pigs disclosed in an embodiment of this application. Figure 4 This is a schematic diagram of a text area in one embodiment; Figure 5 This is a schematic diagram of the structure of a closing classification device based on images of meat pigs disclosed in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. Detailed Implementation

[0016] 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.

[0017] It should be noted that the terms "comprising" and "having," and any variations thereof, in the embodiments and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or devices.

[0018] This application discloses a method, apparatus, electronic device, and storage medium for classifying alterations based on images of dead pigs, which can improve the accuracy and efficiency of alteration detection for images of dead pigs. These will be described in detail below.

[0019] Figure 1 This is a flowchart illustrating a method for classifying altered images of pigs disclosed in an embodiment of this application. Wherein, Figure 1 The described alteration classification method based on images of hogs is applicable to electronic devices, including but not limited to mobile phones, tablets, laptops, and PCs (Personal Computers). This application does not limit the scope of the application's embodiments. Figure 1 As shown, the alteration classification method based on images of meat pigs may include the following steps: Step S102: Obtain images of dead pigs.

[0020] In some embodiments, images of dead pigs can be used to record images of dead or culled pigs that need to be reported. "Dead or culled" refers to the death or culling of pigs during the pig farming process due to various reasons. Platform quantity information can describe the number of dead pigs. The electronic device can receive images of dead pigs uploaded by the farmer's device, or a large number of images of dead pigs can be stored in the electronic device in advance, enabling the electronic device to acquire images of dead pigs. Optionally, the electronic device can also receive platform quantity information uploaded by the farmer, thereby enabling the electronic device to acquire platform quantity information.

[0021] Step S102: Perform text detection on the images of dead pigs using a text detection model to obtain the text detection results.

[0022] In some embodiments, electronic devices apply deep learning-based text detection models, such as those based on DBnet (Differentiable Binarization Network) or PSENet architectures, to automatically analyze acquired images of dead pigs. The core processing method of this text detection model involves extracting deep features from the image layer by layer using a convolutional neural network to accurately identify and locate all possible text regions in the image. These text regions can be death record cards, ear tags, date labels, etc., and are not limited thereto. The final output contains the text detection results including the coordinates of these text locations.

[0023] Optionally, the electronic device can perform multiple feature extractions on the image of dead pigs using a text detection model to obtain multiple pig image features; perform feature fusion on the multiple pig image features to obtain a target feature map; predict at least one bounding box coordinate based on the target feature map; and determine the text detection result based on the image of dead pigs and at least one bounding box coordinate.

[0024] Electronic equipment can perform multiple, progressively deeper feature extractions on input images of dead pigs, gradually capturing information at different levels from raw pixels to complex semantics. This results in a series of pig image feature maps representing different levels of image abstraction, thus producing a pig feature image. The electronic equipment can also employ feature fusion techniques such as Feature Pyramid Networks (FPN) to effectively integrate and enhance these pig image feature maps from different levels, fusing their complementary spatial details and semantic information to ultimately generate a target feature map containing comprehensive and robust information—the target feature image. Based on the target feature image and using a specific regression prediction head, the electronic equipment can calculate the coordinates of one or more predicted bounding boxes for potential text regions in the image. This regression prediction head can be an algorithm based on anchor boxes or keypoints. The electronic equipment then accurately delineates the text regions on the original image of dead pigs based on these predicted box coordinates, thereby outputting the text detection result.

[0025] Electronic devices extract features from images of dead pigs multiple times using a text detection model, resulting in multiple pig image features. These features are then fused to obtain a target feature map. Based on the target feature map, at least one bounding box coordinate is predicted. Finally, based on the image of the dead pig and the coordinates of at least one bounding box, the text detection result is determined. This significantly improves the accuracy and coverage of text information recognition, laying a solid data foundation for subsequent pig identification tracing, automatic recording of death events, and precision breeding management.

[0026] Furthermore, the text detection model predicts a text probability map and a binarized threshold map based on the target feature map. The text probability map and the binarized threshold map are compared to determine the coordinates of at least one prediction box. The image of the dead pig is then cropped based on the predicted box coordinates to obtain the text detection result. The text detection module can be built on DBnet (Differentiable Binarization Network). DBnet has significant advantages in text detection, mainly due to its innovative differentiable binarization technology, which adaptively learns the binarization threshold for each pixel, thus significantly improving the accuracy and robustness of text detection. In addition, DBNet simplifies the complex post-processing steps in traditional text detection methods by embedding binarization operations into network training, improving detection efficiency. Therefore, this network structure can accurately identify text regions written on the body of a pig in complex environments.

[0027] Figure 2 A schematic diagram of the DBnet network structure in one embodiment, such as Figure 2 As shown, the DBnet network structure includes a feature pyramid backbone network, a feature fusion network, a probabilistic map and threshold map prediction module, and a differentiable binarization module. The feature pyramid backbone network can use a pre-trained network as the base network to extract multi-scale feature maps through feature pyramid technology. The feature fusion network upsamples feature maps of different scales in the feature pyramid to the same scale and concatenates them to produce a fused feature map. Specifically, after five downsampling operations, the network obtains four feature maps, which are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 the size of the original image. These four feature maps are then upsampled to 1 / 4 size and concatenated to obtain the final feature map. The probabilistic map and threshold map prediction module can predict both the probability map and the adaptive binarized threshold map of the text region based on the fused feature map. The differentiable binarization module integrates the binarization process into the network training, allowing the network to adaptively learn a more suitable binarization threshold. Specifically, the DB module contains two output branches: a probability map and a threshold map. The probability map represents the probability that each pixel belongs to the text region, while the threshold map represents the binarization threshold for each pixel. During the inference phase, the final binarization result can be obtained by comparing the probability map and the threshold map pixel by pixel.

[0028] As an optional implementation, the electronic device can perform perspective transformation on the text region based on the predicted bounding box coordinate data to obtain the transformed text region; and use a tamper detection model to perform tamper detection on the transformed text region to obtain the tamper detection result corresponding to the image of the dead pig.

[0029] The electronic device performs perspective transformation on the located text regions in the image of a dead pig based on the predicted bounding box coordinates output from the text detection stage. This technique calculates the mapping relationship between the four corner points of the source text region and the target rectangular region, and applies the corresponding homography matrix to geometrically correct the image of the dead pig. This effectively eliminates perspective distortion caused by tilted shooting angles or the text plane not being directly facing the lens, resulting in a standardized text region image that appears to be directly facing the camera and is free of distortion. Subsequently, the electronic device inputs the altered text region into the alteration detection model, thereby recognizing the altered image of the dead pig and obtaining the alteration detection result corresponding to the dead pig image.

[0030] The electronic device performs perspective transformation on the text region based on the predicted box coordinate data to obtain the transformed text region. Then, it uses a tamper detection model to detect tampering in the transformed text region, obtaining the tampering detection results corresponding to the pig death image. This can significantly improve the reliability and anti-counterfeiting capabilities of auditing breeding records based on pig death images.

[0031] Step S103: The text detection results are processed by convolution using the alteration detection model to obtain the processed text detection results.

[0032] Step S104: Classify the processed text detection results using the alteration detection model to obtain classification results, and determine the alteration detection results based on the classification results.

[0033] In one embodiment, the neural network structure of the tamper detection model can be built based on ConvNeXt (Cross Stage Partial Network). The electronic device performs convolution processing on the text detection results to obtain processed text detection results. The processed text detection results are then classified to obtain classification results, and the tamper detection result is determined based on the classification results.

[0034] Furthermore, electronic devices can scan and perform feature calculations on the text detection results using convolutional kernels in the tamper detection model to obtain processed text detection results. These text detection results can be used to locate portions of an image of a dead pig. The electronic device performs convolution processing on the text detection results, which can involve using a specific convolutional kernel to scan and calculate local features of the image, thereby obtaining the processed text detection results. The core purpose is to extract and enhance subtle patterns closely related to tampering traces in the image. The processed text detection results are then classified, with categories including "unaltered," "minorly altered," "severely altered," or specific tampering types.

[0035] Electronic devices utilize depthwise separable convolution in their convolutional blocks using ConvNeXt. This convolutional approach decomposes standard convolution into spatial convolution and pointwise convolution. Spatial convolution performs convolution operations independently on each input channel, while pointwise convolution fuses the results of spatial convolution across channels. This decomposition reduces computation while improving feature extraction capabilities. Furthermore, ConvNeXt introduces large kernel convolutions, such as using 7×7 kernels. Large kernel convolutions expand the model's receptive field, enabling it to capture broader contextual information and better understand global features in images. Subsequently, ConvNeXt uses layer normalization instead of traditional batch normalization. Layer normalization normalizes the features of each sample, helping to stabilize the training process and accelerate convergence. ConvNeXt employs a multilayer perceptron-like structure, containing two fully connected layers with a Gaussian error linear activation function in between. This structure enhances the model's non-linear expressive capabilities, enabling it to learn more complex feature representations. Finally, ConvNeXt adds a separate downsampling layer, using a 2×2 convolutional layer with a stride of 2 for spatial downsampling. This design helps stabilize the training process while progressively reducing the spatial dimension of the feature maps, thus improving the abstraction of the features.

[0036] In this embodiment, an electronic device acquires images of dead pigs; performs text detection on the images using a text detection model to obtain text detection results; and performs alteration detection on the text detection results using an alteration detection model to obtain alteration detection results corresponding to the dead pig images. This allows for text detection on the acquired images of dead pigs using a text detection model, and alteration detection on the text detection results using an alteration detection model, thus directly obtaining alteration detection results. This avoids errors caused by manual alteration review of the images of dead pigs. Furthermore, by directly identifying alterations using both the text detection model and the alteration detection model, alteration detection of images of dead pigs can be quickly performed, improving the accuracy and efficiency of alteration detection for images of dead pigs.

[0037] Figure 3 This is a flowchart illustrating another method for classifying altered images of pigs disclosed in this application. Figure 3 The described alteration classification method based on images of hogs is applicable to the aforementioned electronic devices. For example... Figure 3 As shown, the alteration classification method based on images of meat pigs may further include the following steps: Step S302: Obtain images of dead pigs.

[0038] Step S302: Perform text detection on the images of dead pigs using a text detection model to obtain the text detection results.

[0039] Step S303: The text detection results are processed by convolution using the alteration detection model to obtain the processed text detection results.

[0040] Step S304: Classify the processed text detection results using the alteration detection model to obtain classification results, and determine the alteration detection results based on the classification results.

[0041] The descriptions of steps S301 to S304 can be found in the descriptions of steps S101 to S104 in the above embodiments, and will not be repeated here.

[0042] Step S305: Based on the images of dead pigs and the corresponding alteration detection results, generate a target text detection result set, and train the alteration detection model based on the target text detection result set to obtain the updated alteration detection model.

[0043] In some embodiments, during the training of the text detection model, the electronic device employs a strategy combining active learning and self-supervised learning to rapidly optimize and iterate the model. Specifically, firstly, 20% of the manually labeled dataset is used as the initial training set, and this data is used to train a base model. Subsequently, this base model performs inference predictions on the remaining 80% of unlabeled data, and the correctness of these inference results is manually checked. If the model's inference results are accurate, these predicted boxes are added to the dataset as new labeled data; if the inference results are incorrect, the labels are manually corrected and the data is reinstated. Then, the model is retrained using an updated dataset containing the newly labeled data, and this process is repeated until the model reaches optimal performance and outputs the optimal model weights. The training dataset contains approximately 6000 images, and the validation dataset contains approximately 3000 images. After multiple rounds of iterative optimization using the PaddlePaddle framework, the model achieved an accuracy of 93.18% on the validation set.

[0044] In some embodiments, the electronic device uses the original image of a dead pig and its associated alteration detection results to generate a filtered and enhanced set of target text detection results. The core value of this text detection result set lies in its integration of high-quality labeled data, eliminating the need for manual data annotation. This set includes the location information of text regions and a true label indicating whether the text regions have been manually altered. The electronic device uses the target text detection result set as training samples to iteratively train the alteration detection model. During this training process, the alteration detection model continuously adjusts its internal parameter weights through optimization algorithms such as backpropagation, learning a more accurate and robust mapping relationship from image features to alteration states. Ultimately, it can output an updated alteration detection model with significantly improved recognition accuracy and generalization ability.

[0045] Optionally, the electronic device acquires a historical text detection result set; the historical text detection result set includes multiple historical text detection results and the target alteration detection results corresponding to each historical text detection result; the historical text detection result set is input into the alteration detection model to be trained, and the alteration detection model performs alteration detection on each historical text detection result to obtain the initial alteration detection result corresponding to each historical text detection result; based on the error between the initial alteration detection result corresponding to each historical text detection result and the target alteration detection result corresponding to each historical text detection result, the model parameters of the alteration detection model are adjusted until the error is less than a preset error threshold, and the trained alteration detection model is obtained.

[0046] During the training process of the alteration detection model, the labels of the alteration detection model can be divided into two types: 0 and 1, such as... Figure 4 As shown, Figure 4 This is a schematic diagram of a text region in one embodiment. 1 represents a positive sample, indicating that the text region shows signs of alteration or smearing; 0 represents a text region without obvious alteration. Alteration types include, but are not limited to, the following: font color inconsistent with the background or other font colors; text covered by other text; blurred text; and text with obvious alteration marks (e.g., changing the number "0" to "6"). The historical text detection result set can be divided into a training set and a validation set. The training set contains approximately 16,000 images, and the validation set contains approximately 3,700 images. Among these images, the proportion of text regions with alteration (positive samples) is 59%. To expand the training set, we selected some images from the positive samples and generated additional images through operations such as rotation and scaling. After optimizing and training the model using the PaddlePaddle framework, the final model achieved an accuracy of 88.83% on the validation set.

[0047] In this embodiment, the electronic device generates a target text detection result set based on the image of the dead pig and the corresponding alteration detection result, and trains the alteration detection model based on the target text detection result set to obtain an updated alteration detection model, which can improve the accuracy and efficiency of alteration detection of images of dead pigs.

[0048] Please see Figure 5 , Figure 5 This is a schematic diagram of a classification device based on images of hogs, as disclosed in an embodiment of this application. This device can be applied to the aforementioned electronic equipment. Figure 5 As shown, the alteration classification device 500 based on images of pigs may include: an image acquisition module 501, a text detection module 502, an alteration detection module 503, and an alteration classification module 504.

[0049] Image acquisition module 501 is used to acquire images of dead pigs; The text detection module 502 is used to perform text detection on images of dead pigs using a text detection model, and obtain text detection results. The alteration detection module 503 is used to perform convolution processing on the text detection results through the alteration detection model to obtain the processed text detection results. The alteration classification module 504 is used to classify the processed text detection results through the alteration detection model, obtain the classification results, and determine the alteration detection results based on the classification results.

[0050] In one embodiment, the text detection module 502 further includes: The feature extraction unit is used to perform multiple feature extractions on images of dead pigs using a text detection model to obtain multiple pig image features. The feature fusion unit is used to fuse features from multiple images of pigs to obtain a target feature map; The coordinate prediction unit is used to predict the coordinates of at least one bounding box based on the target feature map, and to determine the text detection result based on the image of dead pigs and the coordinates of at least one bounding box.

[0051] In one embodiment, the coordinate prediction unit is further configured to predict a text probability map and a binarized threshold map based on the target feature map using a text detection model; compare the text probability map and the binarized threshold map to determine at least one prediction box coordinate; and crop the image of dead pigs based on the prediction box coordinates to obtain the text detection result.

[0052] In some embodiments, the alteration classification device 500 based on images of meat pigs further includes a perspective transformation module: The perspective transformation module is used to perform perspective transformation on the text region based on the coordinate data of the prediction box, so as to obtain the transformed text region. The alteration detection module 503 is also used to perform alteration detection on the transformed text region through the alteration detection model to obtain the alteration detection result corresponding to the image of dead pigs.

[0053] In some embodiments, the alteration detection module 503 is further configured to scan and perform feature operations on the text detection results using the convolution kernel in the alteration detection model to obtain the processed text detection results.

[0054] In some embodiments, the alteration classification device 500 based on images of meat pigs further includes an alteration update module: The alteration update module is used to generate a target text detection result set based on the image of dead pigs and the corresponding alteration detection results, and to train the alteration detection model based on the target text detection result set to obtain the updated alteration detection model.

[0055] In some embodiments, the alteration classification device 500 based on images of hogs further includes a history acquisition module and a model training module: The history acquisition module is used to acquire historical text detection result sets; the historical text detection result sets include multiple historical text detection results and the target alteration detection results corresponding to each historical text detection result; The model training module is used to input the historical text detection result set into the alteration detection model to be trained, and to perform alteration detection on each historical text detection result through the alteration detection model to obtain the initial alteration detection result corresponding to each historical text detection result. Based on the error between the initial alteration detection result corresponding to each historical text detection result and the target alteration detection result corresponding to each historical text detection result, the model parameters of the alteration detection model are adjusted until the error is less than the preset error threshold, and the trained alteration detection model is obtained.

[0056] Please see Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. For example... Figure 6 As shown, the electronic device 600 may include: Memory 601 storing executable program code; Processor 602 coupled to memory 601; The processor 602 calls the executable program code stored in the memory 601 to execute any of the alteration classification methods based on images of meat pigs disclosed in the embodiments of this application.

[0057] This application discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by the processor, the processor enables the processor to implement any of the alteration and classification methods based on images of meat pigs disclosed in this application.

[0058] This application discloses a computer program product, including a computer program, which, when executed by a processor, implements the methods described in the above embodiments.

[0059] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Those skilled in the art should also recognize that the embodiments described in the specification are optional embodiments, and the actions and modules involved are not necessarily essential to this application.

[0060] In the various embodiments of this application, it should be understood that the sequence number of each process does not necessarily imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0061] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; they can be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0062] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0063] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-accessible memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several requests to cause a computer device (which can be a personal computer, server, or network device, specifically a processor in the computer device) to execute some or all of the steps of the methods described in the various embodiments of this application.

[0064] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, including read-only memory (ROM), random access memory (RAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), one-time programmable read-only memory (OTPROM), electrically-Erasable Programmable Read-Only Memory (EEPROM), compactdisc read-only memory (CD-ROM) or other optical disc storage, disk storage, magnetic tape storage, or any other computer-readable medium capable of carrying or storing data.

[0065] The foregoing has provided a detailed description of a method, apparatus, electronic device, and storage medium for classifying altered images of pigs based on embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. 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 classifying alterations based on images of meat pigs, characterized in that, Applied to electronic devices, the method includes: Obtain images of dead pigs; The text detection results were obtained by performing text detection on the images of dead pigs using a text detection model. The text detection results are processed by convolution using the alteration detection model to obtain the processed text detection results. The processed text detection results are classified using a tamper detection model to obtain classification results, and the tamper detection results are determined based on the classification results.

2. The method for classifying altered images of pigs according to claim 1, characterized in that, The text detection of the images of dead pigs using a text detection model to obtain text detection results includes: Multiple feature extractions were performed on the images of dead pigs using a text detection model to obtain multiple pig image features; The features of the multiple images of pigs are fused to obtain a target feature map; Based on the target feature map, at least one bounding box coordinate is predicted, and based on the image of the dead pig and the at least one bounding box coordinate, the text detection result is determined.

3. The method for classifying altered images of pigs according to claim 2, characterized in that, The step of predicting at least one bounding box coordinate based on the target feature map, and determining the text detection result based on the image of the dead pig and the at least one bounding box coordinate, includes: The text detection model predicts a text probability map and a binarized threshold map based on the target feature map. The text probability map and the binarized threshold map are compared to determine the coordinates of at least one prediction box; The text detection result is obtained by cropping the image of the dead pig based on the coordinates of the predicted bounding box.

4. The method for classifying altered images of pigs according to claim 1, characterized in that, After performing text detection on the image of the dead pig using a text detection model to obtain the text detection result, the method further includes: The text region is subjected to perspective transformation based on the predicted bounding box coordinate data to obtain the transformed text region. The step of performing alteration detection on the text detection results using an alteration detection model to obtain the alteration detection results corresponding to the image of the dead pig includes: The alteration detection model is used to detect alterations in the transformed text region to obtain the alteration detection result corresponding to the image of the dead pig.

5. The method for classifying altered images of pigs according to claim 1, characterized in that, The text detection results are processed by convolution using the alteration detection model to obtain the processed text detection results, including: The text detection results are scanned and feature operations are performed using the convolution kernel in the alteration detection model to obtain the processed text detection results.

6. The method for classifying altered images of pigs according to claim 1, characterized in that, After performing alteration detection on the text detection results using the alteration detection model to obtain the alteration detection result corresponding to the image of the dead pig, the method further includes: Based on the images of dead pigs and the corresponding alteration detection results, a target text detection result set is generated, and the alteration detection model is trained based on the target text detection result set to obtain an updated alteration detection model.

7. The method for classifying altered images of pigs according to claim 1, characterized in that, Prior to acquiring the images of dead pigs, the method further includes: Obtain a set of historical text detection results; the set of historical text detection results includes multiple historical text detection results and target alteration detection results corresponding to each historical text detection result. The historical text detection result set is input into the alteration detection model to be trained. The alteration detection model performs alteration detection on each historical text detection result to obtain the initial alteration detection result corresponding to each historical text detection result. Based on the error between the initial alteration detection result corresponding to each historical text detection result and the target alteration detection result corresponding to each historical text detection result, the model parameters of the alteration detection model are adjusted until the error is less than a preset error threshold, and the trained alteration detection model is obtained.

8. A classification device based on images of meat pigs, characterized in that, Applied to electronic devices, the device includes: The image acquisition module is used to acquire images of dead pigs. The text detection module is used to perform text detection on the images of dead pigs using a text detection model, and obtain the text detection results. The alteration detection module is used to perform alteration detection on the text detection results through an alteration detection model to obtain the alteration detection results corresponding to the image of the dead pig. The alteration classification module is used to classify the processed text detection results using an alteration detection model, obtain classification results, and determine the alteration detection results based on the classification results.

9. An electronic device, characterized in that, The system includes a memory and a processor. The memory stores a computer program, which, when executed by the processor, causes the processor to implement the alteration classification method based on images of meat pigs as described in any one of claims 1 to 7.

10. A storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to perform the alteration classification method based on images of meat pigs as described in any one of claims 1-7.