Livestock image detection method and device, electronic equipment and storage medium
By extracting the shape and texture features of the cow side face image and using the tampered image detection model for detection, the problem of tampered image detection is solved, and accurate identification and positioning of image tampered image is achieved.
Patent Information
- Application Number
- CN202510129576.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-05
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2045-02-05
AI Technical Summary
The existing technology lacks accurate detection and positioning methods for tampering traces of cow side face images, resulting in the problems of identity information errors, transaction fraud and inaccurate breeding data.
By acquiring the target features of the livestock image to be detected, including shape features and texture features, the preset tampered image detection model determines whether the image is a tampered image, and determines the tampered image area.
Accurate detection of whether livestock images have been tampered with, ensuring the credibility of the data and the normal order of the industry.
Smart Images

Figure CN119992302A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image detection technology, and in particular to a method, device, electronic device and storage medium for detecting livestock images. Background Art
[0002] With the rapid development of digital image technology, images have been widely used in many fields such as agricultural breeding, livestock trading, and food safety traceability. Taking the cattle breeding industry as an example, cattle image information is often used for cattle identification, health monitoring, breed identification, etc. However, image tampering is becoming increasingly rampant. Malicious tampering with cattle side face images may lead to problems such as incorrect cattle identity information, transaction fraud, and inaccurate breeding data, which seriously affects the normal order of related industries and the credibility of data. At present, there is a lack of effective technical means to accurately detect and locate traces of tampering with cattle side face images. Summary of the invention
[0003] The purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for detecting livestock images to solve the above-mentioned technical problems.
[0004] In one aspect, a method for detecting livestock images is provided, comprising: Acquire target features of the livestock image to be detected; the target features include shape features of the livestock extracted from the livestock image to be detected and texture features of the livestock image to be detected; It is determined whether the livestock image to be detected is a tampered image according to the target feature.
[0005] In one embodiment, the shape feature includes at least one of the circumference of the outer contour of the livestock, the area of the area enclosed by the outer contour, the circularity of the outer contour, the Hu invariant moment, the position of the key parts of the livestock in the livestock image to be detected, and the geometric features of the image area corresponding to the key parts; the texture feature includes at least one of contrast, correlation, energy and entropy extracted from the gray level co-occurrence matrix of the livestock image to be detected.
[0006] In one embodiment, the method further comprises: When it is determined that the livestock image to be detected is a tampered image, a tampered image region is determined from the livestock image to be detected.
[0007] In one embodiment, judging whether the livestock image to be detected is a tampered image according to the target feature includes: The target feature is input into a preset tampered image detection model to obtain a detection result of whether the livestock image to be detected is a tampered image; the tampered image detection model is a model trained based on a training data set, and the training data set includes multiple tampered livestock images and a first category label corresponding to each tampered livestock image, as well as normal livestock images and a second category label corresponding to each normal livestock image.
[0008] In one embodiment, when determining that the livestock image to be detected is a tampered image, determining the tampered image area from the livestock image to be detected includes: The tampered image region is determined from the livestock image to be detected by using the intermediate layer feature map and the preset region generation network in the tampered image detection model.
[0009] In one embodiment, judging whether the livestock image to be detected is a tampered image according to the target feature includes: Calculating a shape difference value between the shape feature of the livestock image to be detected and a normal shape feature corresponding to a normal livestock image in a preset feature library, and calculating a texture difference value between the texture feature of the livestock image to be detected and a normal texture feature corresponding to the normal livestock image; Based on the shape difference value and the texture difference value, it is determined whether the livestock image to be detected is a tampered image.
[0010] In one embodiment, when determining that the livestock image to be detected is a tampered image, determining the tampered image area from the livestock image to be detected includes: When the difference value between the target feature of a certain image area in the livestock image to be detected and the corresponding normal feature of the normal livestock image in the preset feature library reaches a preset difference threshold, the image area is used as the target image area; A region expansion process is performed based on the target image region to obtain the tampered image region in the livestock image to be detected.
[0011] Furthermore, a livestock image detection device is provided, comprising: An acquisition module, used for acquiring target features of the livestock image to be detected; the target features include shape features of the livestock extracted from the livestock image to be detected and texture features of the livestock image to be detected; A judgment module is used to judge whether the livestock image to be detected is a tampered image according to the target feature.
[0012] Furthermore, an electronic device is provided, comprising a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to implement any of the above methods.
[0013] Furthermore, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores a computer program, and when the computer program is executed by at least one processor, it implements any of the methods described above.
[0014] The livestock image detection method, device, electronic device and storage medium provided in the present application obtain target features of the livestock image to be detected, wherein the target features include shape features of the livestock extracted from the livestock image to be detected and texture features of the livestock image to be detected, and determine whether the livestock image to be detected is a tampered image based on the target features, thereby realizing the detection of whether the livestock image has been tampered with. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of a flow chart of a method for detecting livestock images provided in an embodiment of the present application; Figure 2 A schematic diagram of the structure of a livestock image detection device provided in an embodiment of the present application; Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0019] This application embodiment provides a method for detecting livestock images, see Figure 1 As shown, including: S101: Acquire target features of the livestock image to be detected; the target features include shape features of the livestock extracted from the livestock image to be detected and texture features of the livestock image to be detected.
[0020] S102: Determine whether the livestock image to be detected is a tampered image according to the target features.
[0021] The shape features in the embodiments of the present application include at least one of the features of the outer contour of the livestock and the features of the key parts, specifically, the outer contour circumference of the livestock, the area of the area enclosed by the outer contour, the circularity of the outer contour, the Hu invariant moment, the position of the key parts of the livestock in the livestock image to be detected, and the geometric features of the image area corresponding to the key parts; the texture features include at least one of contrast, correlation, energy and entropy extracted from the gray level co-occurrence matrix of the livestock image to be detected.
[0022] In the above step S101, the livestock image to be detected may be preprocessed first, and then the target features may be extracted from the preprocessed livestock image to be detected.
[0023] The preprocessing in the embodiment of the present application includes grayscale processing and filtering and denoising processing.
[0024] In the grayscale processing, the weighted average method can be used to convert the color livestock image to be detected into a grayscale image. ,That The values are , , , gray value The calculation formula is This method can better preserve the brightness information of the image, highlight the contour and texture details of the livestock image to be detected, and reduce the amount of data and computational complexity of subsequent processing.
[0025] In the process of filtering and denoising, Gaussian filtering can be used to smooth the grayscale image. The kernel function of Gaussian filtering is ,in is the standard deviation, which determines the degree of filtering. By sliding the kernel function on the image and performing convolution operations with the image pixels, the Gaussian noise in the image can be effectively removed, while the edge information of the image is better preserved, making the contour of the livestock image to be detected clearer, providing a more accurate image basis for subsequent feature extraction.
[0026] The outer contour features of livestock images can be extracted using edge detection algorithms.
[0027] Specifically, the Canny edge detection algorithm can be used. For the preprocessed livestock image to be detected, the gradient amplitude and direction of the image can be calculated, the edge pixels can be determined by non-maximum suppression, and finally the outer contour edge of the livestock can be obtained by using double threshold detection and edge connection. For example, for a resolution of When calculating the gradient amplitude, the gradient value of each pixel is obtained by approximating the partial derivatives in the horizontal and vertical directions. The formula is: ,in and are the gradient components in the horizontal and vertical directions respectively.
[0028] Outer contour perimeter: Traverse the outer contour points obtained by Canny edge detection, calculate the distance between adjacent outer contour points and accumulate them to obtain the perimeter of the livestock outer contour .
[0029] The area enclosed by the outer contour: The area enclosed by the outer contour can be calculated using Green's formula Specifically, for a point on the contour The area calculation formula is .
[0030] Outer contour circularity: The formula can be used The circularity of the outer contour is calculated. The closer the value is to 1, the closer the shape is to a circle. This feature can be used to distinguish the difference between the outer contour of livestock and other irregular shapes.
[0031] It should be noted that the livestock image to be detected in the embodiment of the present application can be a side face image of a cow. The side face image of a cow has a unique shape, texture, and obvious physiological characteristics such as horns, eyes, mouth and nose. These characteristics will show specific change patterns during the tampering process, so it is possible to determine whether the side face image of the cow has been tampered with based on these characteristics.
[0032] Hu invariant moment is a shape descriptor based on image moment, which is invariant to translation, rotation and scaling. ,That The order moment is defined as , central moment ,in , Then the Hu invariant moment is calculated based on the central moment ,in Finally, we get the seven invariants of Hu invariant moments These invariants can effectively characterize the shape characteristics of livestock in the livestock image to be detected, and are not affected by the translation, rotation and scaling of the image. They can be used to compare with the shape feature library of normal livestock images to detect whether the livestock image to be detected has been tampered with.
[0033] The features of the key parts of the livestock in the livestock image to be detected can be obtained based on a pre-trained key parts detection model. The key parts detection model can be used to obtain the position of the key parts in the livestock image to be detected and / or the geometric features of the image area corresponding to the key parts. The geometric features include but are not limited to at least one of the area, perimeter, length, width, circularity and curvature of the image area corresponding to the key parts.
[0034] Here, the livestock image to be detected is a cow's side face image to be detected. The key parts of the cow's side face image to be detected are extracted by the key parts detection model, where the key parts refer to the parts that can distinguish the identity of the cow, including but not limited to at least one of the cow's eyes, nose and horns.
[0035] Here, the training process of the key part detection model is explained. A large number of cow side face images of different breeds, ages, genders and postures can be collected, and the physiological features such as horns, eyes, mouths and noses in the images can be annotated using image annotation tools (such as Label Img). The annotation information includes the location of the features, the coordinates of the bounding box, and the category information, etc., to construct a dataset of annotated physiological features of cow side faces. Then, a deep learning-based target detection model is used for training, such as the Faster R-CNN model. First, the basic network part of Faster R-CNN is initialized on the ImageNet dataset using a pre-trained convolutional neural network (such as VGG16), and then fine-tuned on the constructed dataset of annotated physiological features of cow side faces. During the training process, the stochastic gradient descent (SGD) optimizer is used to set hyperparameters such as the learning rate and momentum, and the parameters of the model are adjusted by minimizing the loss function (such as a multi-task loss function, including classification loss and regression loss), so that the model can accurately detect the location and geometric features of physiological features such as horns, eyes, mouths and noses in the cow side face images.
[0036] The cow's side face image to be detected is input into the key parts detection model, and the model outputs the detection results of physiological characteristics, including the position of the key parts, the corresponding category and the geometric features.
[0037] For example, for a cow's horn, its corresponding position, category label, curvature feature, and length feature can be output. In an embodiment of the present application, the curvature of the horn contour can be calculated to describe its curvature; the corresponding length feature can be obtained by calculating the end point distance of the horn contour. For example, for the eye, its corresponding position, category label, aspect ratio, and roundness can be output. The aspect ratio and roundness of the eye can reflect the shape characteristics of the eye. For example, for the mouth and nose, its corresponding position, category label, mouth and nose circumference, and mouth and nose area can be output.
[0038] In the embodiment of the present application, the positions and geometric features of the above-mentioned key parts can be used to determine whether the livestock image to be detected is a tampered image.
[0039] There are also differences in the texture features of a normal image and a tampered image, so in the embodiment of the present application, the texture features can also be combined to determine whether the livestock image to be detected is a tampered image. The process of extracting texture features is described below.
[0040] In the embodiment of the present application, the grayscale image can be divided into The sub-regions can be divided into The gray-level co-occurrence matrix is calculated in each sub-region. ,in, is the distance between pixel pairs, Direction (usually , , , ).
[0041] The following texture feature parameters are extracted from the gray-level co-occurrence matrix: Contrast ratio: , which reflects the clarity and local variation of the texture in the image. The greater the contrast, the clearer the texture and the more drastic the grayscale value variation in the image.
[0042] Relevance: ,The correlation measures the similarity of the elements in the gray level co-occurrence matrix in the row or column direction. The closer the value is, the stronger the correlation and the more regular the texture.
[0043] energy: ,Energy reflects the uniformity of the grayscale distribution of the image and the coarseness of the texture. The greater the energy, the more uniform the texture and the smoother the image.
[0044] entropy ,Entropy represents the randomness of the texture in the image. The larger the entropy value, the more complex the texture and the higher information content in the image.
[0045] These texture feature parameters of each sub-region can be combined into a texture feature vector to describe the texture features of the entire livestock image to be detected, so as to perform a difference analysis with the texture features of a normal livestock image and detect traces of tampering.
[0046] In the embodiment of the present application, when it is determined that the livestock image to be detected is a tampered image, the tampered image area can be determined from the livestock image to be detected.
[0047] First, the step S102 of determining whether the livestock image to be detected is a tampered image according to the target features is described.
[0048] In an optional embodiment, the target features can be input into a preset tampered image detection model to obtain a detection result of whether the livestock image to be detected is a tampered image; the tampered image detection model is a model trained based on a training data set, and the training data set includes multiple tampered livestock images and a first category label corresponding to each tampered livestock image, as well as normal livestock images and a second category label corresponding to each normal livestock image.
[0049] Specifically, a tampered image detection model can be pre-built, which can be a convolutional neural network model, which includes multiple convolutional layers, pooling layers, and fully connected layers. The convolutional layer is used to extract local features of the image, the pooling layer performs feature dimension reduction, and the fully connected layer integrates and classifies the extracted features. In the convolutional layer, set the appropriate convolution kernel size, step size, and padding method to effectively extract the feature information of the image.
[0050] Then, a training data set is collected for training. The training data set includes multiple tampered livestock images and the first category label corresponding to each tampered livestock image, as well as normal livestock images and the second category label corresponding to each normal livestock image. The images in the training data set are preprocessed and feature extracted as input. The first category label and the second category label can be "tampered" and "normal".
[0051] The cross entropy loss function can be used during model training Training. is the true label, The probability value predicted by the model is trained using an optimizer (such as the Adam optimizer) to adjust the model's weights and biases so that the model can accurately learn the characteristic difference patterns between tampered images and normal images. During the training process, data enhancement techniques such as flipping, rotating, and cropping are used to increase the diversity of training data and improve the generalization ability of the model.
[0052] In this embodiment, the target features of the livestock image to be detected are input into the tampered image detection model, and the model outputs the judgment result of whether the image is "tampered" or "normal". If the model output is "tampered", the tampered area can be further located.
[0053] In another optional embodiment, a shape difference value between the shape features of the livestock image to be detected and a normal shape feature corresponding to a normal livestock image in a preset feature library can be calculated, and a texture difference value between the texture features of the livestock image to be detected and a normal texture feature corresponding to the normal livestock image can be calculated; based on the shape difference value and the texture difference value, it is determined whether the livestock image to be detected is a tampered image.
[0054] It should be noted that the preset feature library may store normal shape features and normal texture features corresponding to multiple normal livestock images. At this time, the target features of the livestock image to be detected may be matched with the normal features corresponding to each normal livestock image, the target normal livestock image closest to the livestock to be detected may be determined, the shape difference value between the shape feature of the livestock image to be detected and the normal shape feature corresponding to the target normal livestock image in the preset feature library may be calculated, and the texture difference value between the texture feature of the livestock image to be detected and the normal texture feature corresponding to the target normal livestock image may be calculated.
[0055] Specifically, calculating the shape difference value between the shape feature of the livestock image to be detected and the normal shape feature corresponding to the target normal livestock image in the preset feature library includes: Acquire the contour feature vector of the livestock image to be detected and the geometric feature vectors corresponding to each key part, calculate the first distance between the contour feature vector and the normal contour feature vector corresponding to the target normal livestock image, use the first distance as the first shape difference value, and respectively calculate the second distance between the geometric feature vector of each key part and the normal geometric feature vector of the corresponding key part in the target normal livestock image, and use each second distance as the second shape difference value.
[0056] Calculating the texture difference value between the texture feature of the livestock image to be detected and the normal texture feature corresponding to the target normal livestock image, comprising: The texture feature vector of the livestock image to be detected is obtained, a third distance between the texture feature vector and a normal texture feature vector corresponding to the target normal livestock image is calculated, and the third distance is used as the texture difference value.
[0057] The step of judging whether the livestock image to be detected is a tampered image based on the shape difference value and the texture difference value comprises: When the first shape difference value, the second shape difference value, and the texture difference value meet a preset condition, it is determined that the livestock image to be detected is a tampered image; otherwise, it is determined that the livestock image to be detected is not a tampered image; the preset condition includes at least one of the following conditions: Condition 1: the first shape difference value is greater than or equal to a preset first shape difference threshold; Condition 2: the sum of the second shape difference values is greater than or equal to the preset second shape difference threshold; or, the number of target key parts is greater than or equal to the preset number threshold, and the target key parts are parts whose corresponding second shape difference values are greater than or equal to the preset third shape difference threshold of the key parts; Condition three: the texture difference value is greater than or equal to a preset texture difference threshold.
[0058] To facilitate understanding, a specific example is provided here for explanation.
[0059] Feature library construction: A large number of real livestock images are collected as normal livestock images, and the above-mentioned shape and texture feature extraction is performed on these images to construct a normal livestock image feature library. The feature library stores the normal shape feature vector and normal texture feature vector of each normal livestock image. The normal shape feature vector here includes the normal contour feature vector of the normal livestock image and the geometric feature vectors corresponding to each key part. Exemplarily, the normal contour feature vector includes but is not limited to the perimeter of the outer contour, the area of the area enclosed by the outer contour, and the circularity of the outer contour. The normal geometric feature vector corresponding to each key part includes but is not limited to the position of the key part and the parameters used to describe the shape. The normal texture feature vector includes but is not limited to the contrast, correlation, energy and entropy of each image sub-region.
[0060] Feature comparison and difference calculation: Compare the target features of the livestock image to be detected with the normal features in the feature library. For shape features, calculate the distance between the shape feature vector of the livestock image to be detected and the normal shape feature vector of the target normal livestock image in the feature library, for example, using the Euclidean distance formula ,in is the first image of the livestock to be detected The shape feature vectors of key parts, is the first target normal livestock image in the feature library The normal shape feature vector of the key parts, when the distance exceeds the set threshold For texture features, the difference between the normal texture feature vector of the target livestock image and the target normal livestock image in the feature library is also calculated. For example, when the texture difference value of N sub-areas exceeds the threshold When the image is abnormal, the texture feature of the image is determined to be abnormal. If any one or more of the shape and texture are abnormal, the image of the livestock to be detected is determined to be tampered with.
[0061] Next, a method of determining a tampered image region from the livestock image to be detected when determining that the livestock image to be detected is a tampered image will be described.
[0062] In an optional implementation, the tampered image region may be determined from the livestock image to be detected using an intermediate layer feature map and a preset region generation network in the tampered image detection model.
[0063] The intermediate feature map of the convolutional neural network model of the tampered image detection model contains rich feature information of the image and has a good response to the tampered area. The intermediate feature map is combined with the regional generation network (RPN) to generate the tampered image area. Specifically, the RPN generates a series of candidate regions (anchor boxes) on the feature map, and classifies the candidate regions (whether they are tampered regions) and regresses (adjusts the position and size of the candidate regions) by calculating the intersection of union (IoU) between the candidate regions and the real tampered regions. The non-maximum suppression (NMS) algorithm is used to remove candidate regions with excessive overlap and retain the most likely tampered regions. According to the position and size information of the candidate regions that are finally retained, the precise position and range of the tampered region are determined on the original livestock image to be detected, and marked, such as framing the tampered region with a red frame, so as to intuitively display it to the user or for subsequent analysis and processing.
[0064] In another optional embodiment, when the difference value between the target feature of a certain image area in the livestock image to be detected and the corresponding normal feature of the normal livestock image in the preset feature library reaches a preset difference threshold, the image area is used as the target image area; and region expansion processing is performed based on the target image area to obtain the tampered image area in the livestock image to be detected.
[0065] Specifically, the livestock image to be detected can be divided into multiple image regions, and the shape difference value between the shape feature vector of each image region and the normal shape feature vector of the target normal livestock image is calculated, and the texture difference value between the texture feature vector of each image region and the normal texture feature vector of the target normal livestock image is calculated. When it is determined based on the shape difference value and the texture difference value that the image region meets the preset condition, the image region is used as the target image region, and the preset condition includes at least one of the following conditions: Condition 1: the shape difference value of the image area of the livestock image to be detected reaches a preset fourth shape difference threshold; Condition 2: The texture difference value of the image area of the livestock image to be detected reaches a preset second texture difference threshold.
[0066] It should be noted that when dividing the livestock image to be detected into multiple image regions, the division can be based on key parts. For example, for each key part, the corresponding image region is determined from the livestock image to be detected. , each sub-region is also the image region.
[0067] When performing region expansion processing based on the target image region, the target image region can be used as the center to expand a certain range of regions as possible tampering regions. Finally, these possible tampering regions are merged and optimized, and some isolated small regions are removed to obtain the final tampered image region.
[0068] Based on the same inventive concept, see Figure 2 As shown, the embodiment of the present application also provides a livestock image detection device, comprising: The acquisition module 201 is used to acquire the target features of the livestock image to be detected; the target features include the shape features of the livestock extracted from the livestock image to be detected and the texture features of the livestock image to be detected; the judgment module 202 is used to judge whether the livestock image to be detected is a tampered image based on the target features.
[0069] It should be understood that for the sake of brevity, the contents described in some embodiments will not be repeated in this embodiment.
[0070] Based on the same inventive concept, see Figure 3 As shown, an embodiment of the present application also provides an electronic device, which includes a processor 301 and a memory 302, in which a computer program is stored. The processor 301 and the memory 302 communicate through a communication bus, and the processor 301 executes the computer program to implement the steps of the method in the above embodiment, which will not be repeated here.
[0071] Understandably, Figure 3 The structure shown is for illustration only. The electronic device may also include Figure 3 More or fewer components as shown, or with Figure 3 Different configurations are shown.
[0072] The processor 301 can be an integrated circuit chip with signal processing capabilities. The above processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. It can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0073] The memory 302 may include, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.
[0074] It should be understood that, although the various steps in the above-mentioned flow chart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the above-mentioned flow chart may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.
[0075] It should be noted that the diagram provided in the present embodiment only illustrates the basic concept of the present invention in a schematic manner, so the diagram only shows the components related to the present invention rather than drawing according to the number, shape and size of the components during actual implementation. The type, quantity and ratio of each component during actual implementation can be a random change, and the component layout type may also be more complicated. The structure, ratio, size, etc. illustrated in the drawings of the present specification are only used to match the content disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the limiting conditions that the present invention can implement, so they have no technical substantive significance. Any modification of the structure, change of the proportional relationship or adjustment of the size should still fall within the scope of the technical content disclosed by the present invention without affecting the effect that the present invention can produce and the purpose that can be achieved. At the same time, the terms such as "upper", "lower", "left", "right", "middle" and "one" quoted in this specification are only for the convenience of narration, and are not used to limit the scope of the present invention. The change or adjustment of its relative relationship should also be regarded as the scope of the present invention without substantially changing the technical content.
[0076] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.
[0077] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for detecting livestock images, characterized in that: include: Acquire target features of the livestock image to be detected; the target features include shape features of the livestock extracted from the livestock image to be detected and texture features of the livestock image to be detected; It is determined whether the livestock image to be detected is a tampered image according to the target feature.
2. The method for detecting livestock images according to claim 1, characterized in that: The shape features include at least one of the circumference of the livestock's outer contour, the area of the area enclosed by the outer contour, the circularity of the outer contour, the Hu invariant moment, the position of the livestock's key parts in the livestock image to be detected, and the geometric features of the image area corresponding to the key parts; the texture features include at least one of contrast, correlation, energy and entropy extracted from the gray level co-occurrence matrix of the livestock image to be detected.
3. The method for detecting livestock images according to claim 1, characterized in that: The method further comprises: When it is determined that the livestock image to be detected is a tampered image, a tampered image region is determined from the livestock image to be detected.
4. The method for detecting livestock images according to claim 3, characterized in that: The step of judging whether the livestock image to be detected is a tampered image according to the target feature includes: The target feature is input into a preset tampered image detection model to obtain a detection result of whether the livestock image to be detected is a tampered image; the tampered image detection model is a model trained based on a training data set, and the training data set includes multiple tampered livestock images and a first category label corresponding to each tampered livestock image, as well as normal livestock images and a second category label corresponding to each normal livestock image.
5. The method for detecting livestock images according to claim 4, characterized in that: When determining that the livestock image to be detected is a tampered image, determining the tampered image area from the livestock image to be detected includes: The tampered image region is determined from the livestock image to be detected by using the intermediate layer feature map and the preset region generation network in the tampered image detection model.
6. The method for detecting livestock images according to claim 3, characterized in that: The step of judging whether the livestock image to be detected is a tampered image according to the target feature includes: Calculating a shape difference value between the shape feature of the livestock image to be detected and a normal shape feature corresponding to a normal livestock image in a preset feature library, and calculating a texture difference value between the texture feature of the livestock image to be detected and a normal texture feature corresponding to the normal livestock image; Based on the shape difference value and the texture difference value, it is determined whether the livestock image to be detected is a tampered image.
7. The method for detecting livestock images according to claim 6, characterized in that: When determining that the livestock image to be detected is a tampered image, determining the tampered image area from the livestock image to be detected includes: When the difference value between the target feature of a certain image area in the livestock image to be detected and the corresponding normal feature of the normal livestock image in the preset feature library reaches a preset difference threshold, the image area is used as the target image area; A region expansion process is performed based on the target image region to obtain the tampered image region in the livestock image to be detected.
8. A livestock image detection device, characterized in that: include: An acquisition module, used for acquiring target features of the livestock image to be detected; the target features include shape features of the livestock extracted from the livestock image to be detected and texture features of the livestock image to be detected; A judgment module is used to judge whether the livestock image to be detected is a tampered image according to the target feature.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by at least one processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Face tampered video detection method and face tampered video detection device
CN112861786A
Image evidence obtaining method and system based on multi-view features
CN113191380A
Picture recognition method and device, electronic equipment and storage medium
CN117911847A
Intelligent picture modification trace identification anti-fraud system and use method thereof
CN118865078A
Operation record generation method and device, equipment and storage medium
CN119201650A