Image recognition method and device, computer device, storage medium and program product

By extracting image features and locating the edge contours of target areas, the problem of decreased detection capability of deepfake technology detection models under new forgery methods is solved, achieving higher accuracy in forged image detection and recognition, and enhancing image information security.

CN122454375APending Publication Date: 2026-07-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2025-01-24
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing deepfake detection models have reduced detection capabilities when faced with new forgery methods, resulting in inaccurate forgery image recognition. Traditional methods neglect the judgment of image contours.

Method used

By extracting image features and locating the target edge contour of the target area, forgery recognition is performed based on the contour, eliminating the dependence on other feature information. This is achieved by using a contour-based image recognition method and model training technique.

Benefits of technology

It achieves higher precision and accuracy in detecting and recognizing forged images, improves the security of personal image information, and enhances the ability to identify forged images.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122454375A_ABST
    Figure CN122454375A_ABST
Patent Text Reader

Abstract

The application relates to an image recognition method and device, computer equipment, a storage medium and a program product. The method comprises the following steps: acquiring an image of an object to be recognized, and extracting an image feature of the image of the object to be recognized; extracting a target edge contour of a target part based on the image feature; and performing forgery identification on the target part in the image of the object to be recognized based on the target edge contour, so as to obtain an identification result. The method can improve the accuracy of forgery image identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to an image recognition method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology

[0002] Deepfake technology refers to an artificial intelligence technique that uses generative adversarial networks (GANs) as machine learning models to merge and overlay images or videos onto source images or videos. By leveraging neural network technology and learning from large datasets, it synthesizes fake content by splicing together a person's voice, facial expressions, and body movements. Common deepfake techniques include face-swapping, voice simulation, face synthesis, and video generation.

[0003] Currently, as this technology matures, those in the black market are using it to forge increasingly realistic human images, posing a significant risk to cybersecurity. To mitigate the risks posed by deepfake technology, traditional solutions use deep learning models to detect image forgery based on subtle features such as lighting, texture, and facial details.

[0004] However, the capabilities of deep learning models are highly dependent on the training images used during training. For the latest forgery methods that the model has not seen during training, its detection capability will drop significantly, resulting in inaccurate detection of forged images. Summary of the Invention

[0005] Therefore, it is necessary to provide an image recognition method, apparatus, computer device, computer-readable storage medium, and computer program product that can accurately identify forged images in response to the above-mentioned technical problems.

[0006] On one hand, this application provides an image recognition method. The method includes:

[0007] Acquire an image of the object to be identified, and extract the image features of the object to be identified;

[0008] Based on the image features, the target edge contour of the target part in the image of the object to be identified is extracted;

[0009] Based on the target edge contour, forgery detection is performed on the target part in the image of the object to be identified, and the identification result is obtained.

[0010] On the other hand, this application also provides an image recognition device. The device includes:

[0011] The acquisition module is used to acquire an image of the object to be identified and extract the image features of the object to be identified;

[0012] The extraction module is used to extract the target edge contour of the target part in the image of the object to be identified based on the image features;

[0013] The recognition module is used to perform forgery recognition on the target part in the image of the object to be recognized based on the target edge contour, and obtain the recognition result.

[0014] On the other hand, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0015] A forgery detection method is used to obtain an image of an object to be identified and to extract the image features of the object to be identified. Based on the image features, the target edge contour of the target part in the image of the object to be identified is extracted. Based on the target edge contour, the forgery detection of the target part in the image of the object to be identified is performed to obtain the detection result.

[0016] On the other hand, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0017] A forgery detection method is used to obtain an image of an object to be identified and to extract the image features of the object to be identified. Based on the image features, the target edge contour of the target part in the image of the object to be identified is extracted. Based on the target edge contour, the forgery detection of the target part in the image of the object to be identified is performed to obtain the detection result.

[0018] On the other hand, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0019] A forgery detection method is used to obtain an image of an object to be identified and to extract the image features of the object to be identified. Based on the image features, the target edge contour of the target part in the image of the object to be identified is extracted. Based on the target edge contour, the forgery detection of the target part in the image of the object to be identified is performed to obtain the detection result.

[0020] Any alteration to any part of an image will change its contour; however, traditional image recognition algorithms generally ignore contour assessment. Therefore, this invention proposes a contour-based image recognition method. This method acquires an image of the object to be identified, extracts its image features, and locates the target edge contour of the target part within the image based on these features. This target edge contour reflects information such as the shape and size of the target part. Since the same part can vary in shape and size across different objects, forgery detection is performed on the target part in the image based on the target edge contour, enabling accurate identification of whether a target part has been forged. Furthermore, this method eliminates strong reliance on other feature information of the target part, achieving higher accuracy in forged image detection and improving the security of personal image information during the recognition process.

[0021] On one hand, this application provides an image recognition model processing method. The method includes:

[0022] Obtain a sample object image and extract sample image features from the sample object image;

[0023] Based on the features of the sample image, extract the predicted edge contour of the sample part in the sample object image;

[0024] Based on the predicted edge contour, forgery detection is performed on the sample part in the sample object image to obtain the predicted recognition result;

[0025] Obtain the expected recognition result corresponding to the sample object image, and train the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

[0026] On the other hand, this application also provides an image recognition model processing apparatus. The apparatus includes:

[0027] The sample acquisition module is used to acquire sample object images and extract sample image features from the sample object images;

[0028] The sample extraction module is used to extract the predicted edge contour of the sample part in the sample object image based on the features of the sample image;

[0029] The sample recognition module is used to perform forgery recognition on the sample part in the sample object image based on the predicted edge contour, and obtain the predicted recognition result;

[0030] The training module is used to obtain the expected recognition result corresponding to the sample object image, and to train the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

[0031] On the other hand, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0032] Acquire a sample object image and extract sample image features from the sample object image; extract predicted edge contours of sample parts in the sample object image based on the sample image features; perform forgery detection on the sample parts in the sample object image based on the predicted edge contours to obtain a predicted recognition result; obtain the expected recognition result corresponding to the sample object image, and train a model based on the difference between the predicted recognition result and the expected recognition result to obtain an image recognition model.

[0033] On the other hand, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0034] Acquire a sample object image and extract sample image features from the sample object image; extract predicted edge contours of sample parts in the sample object image based on the sample image features; perform forgery detection on the sample parts in the sample object image based on the predicted edge contours to obtain a predicted recognition result; obtain the expected recognition result corresponding to the sample object image, and train a model based on the difference between the predicted recognition result and the expected recognition result to obtain an image recognition model.

[0035] On the other hand, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0036] Acquire a sample object image and extract sample image features from the sample object image; extract predicted edge contours of sample parts in the sample object image based on the sample image features; perform forgery detection on the sample parts in the sample object image based on the predicted edge contours to obtain a predicted recognition result; obtain the expected recognition result corresponding to the sample object image, and train a model based on the difference between the predicted recognition result and the expected recognition result to obtain an image recognition model.

[0037] Modifying any part of an image will alter its contour; however, traditional image recognition algorithms generally neglect contour assessment. Therefore, this invention proposes a contour-based image recognition model processing method. By acquiring a sample object image and extracting its image features, predicted edge contours of the sample parts are extracted based on these features. Edge contours reflect information such as the shape and size of the sample parts. Since the same part on different objects can vary in shape and size, the predicted edge contours are used to perform forgery detection on sample parts in the sample object image, effectively predicting whether a sample part has been forged. Furthermore, using only edge contours for recognition eliminates the need for feature information of the sample parts, thus reducing reliance on these features and achieving higher accuracy in forged image detection. It also improves the security of personal image information during the recognition process. The desired recognition result corresponding to the sample object image is obtained. The model is trained based on the difference between the predicted and desired recognition results, enabling the trained image recognition model to accurately identify whether a part has been forged based solely on its edge contours. Moreover, using an image recognition model to identify forged images effectively improves the accuracy and efficiency of image recognition. Attached Figure Description

[0038] Figure 1 This is an application environment diagram of the image recognition method and image recognition model processing method in one embodiment;

[0039] Figure 2 This is a flowchart illustrating an image recognition method in one embodiment;

[0040] Figure 3 This is a schematic diagram of the process for obtaining a mask image corresponding to a target region in an image of an object to be identified, as shown in one embodiment.

[0041] Figure 4 This is a schematic diagram illustrating the process of forgery identification of a target part in an image of an object to be identified based on the image features and edge contour regions of the target part in another embodiment.

[0042] Figure 5 This is a schematic diagram of a process for obtaining the outer edge contour and edge contour region by expanding outward in one embodiment;

[0043] Figure 6 This is a schematic diagram of the process for obtaining the inner edge contour and edge contour region by shrinking inward in another embodiment;

[0044] Figure 7 This is a flowchart illustrating the process of determining the regional similarity between a preset contour region and an edge contour region in another embodiment.

[0045] Figure 8 This is a schematic diagram illustrating that the target area includes the eyes, nose, mouth, and eyebrows in another embodiment;

[0046] Figure 9 This is a flowchart illustrating the image recognition model processing method in another embodiment;

[0047] Figure 10 This is a schematic diagram of an interface for a face recognition scenario in another embodiment;

[0048] Figure 11 This is a schematic diagram of the interface of the recognition result in a face recognition scenario in one embodiment;

[0049] Figure 12 This is a schematic diagram comparing the interception rates of an image recognition method and a traditional face recognition method in one embodiment;

[0050] Figure 13 This is a structural block diagram of an image recognition device in one embodiment;

[0051] Figure 14 This is a structural block diagram of an image recognition model processing device in one embodiment;

[0052] Figure 15 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0053] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0054] The image recognition method provided in this application embodiment can be applied to, for example... Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be integrated on server 104 or placed in the cloud or on another server. Both terminal 102 and server 104 can independently execute the image recognition method provided in this embodiment. Terminal 102 and server 104 can also work together to execute the image recognition method provided in this embodiment. When terminal 102 and server 104 work together to execute the image recognition method provided in this embodiment, terminal 102 acquires an image of the object to be recognized and sends it to server 104. Server 104 extracts image features from the image of the object to be recognized, extracts the target edge contour of the target part in the image of the object to be recognized, and performs forgery recognition on the target part in the image of the object to be recognized based on the target edge contour to obtain the recognition result. Server 104 returns the recognition result to terminal 102.

[0055] Terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle devices. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms.

[0056] In one embodiment, an image recognition model processing method is also provided, which can be applied to, for example... Figure 1In the application environment shown, both terminal 102 and server 104 can independently execute the image recognition model processing method provided in this embodiment. Terminal 102 and server 104 can also work together to execute the image recognition model processing method provided in this embodiment. When terminal 102 and server 104 work together to execute the image recognition model processing method provided in this embodiment, terminal 102 obtains a sample object image from server 104 and extracts sample image features from the sample object image. Terminal 102 extracts the predicted edge contours of sample parts in the sample object image based on the sample image features. Based on the predicted edge contours, it performs forgery detection on the sample parts in the sample object image to obtain a predicted recognition result. Terminal 102 obtains the expected recognition result corresponding to the sample object image, and performs model training based on the difference between the predicted recognition result and the expected recognition result to obtain an image recognition model. The image recognition model can be deployed on terminal 102 or server 104.

[0057] In one embodiment, such as Figure 2 As shown, an image recognition method is provided, which is applied to computer devices (such as computer devices). Figure 1 Taking the terminal or server shown as an example, the following steps are included:

[0058] Step S202: Obtain the image of the object to be identified and extract the image features of the image of the object to be identified.

[0059] The image to be identified is an image that includes the target object to be identified. The target object in the image includes target parts, which are the parts that need to be identified as to whether they have been forged. Target objects can be, for example, people, animals, 3D models, robots, etc.

[0060] The target part may include at least one part of the target object, such as the head, face, limbs, etc., but is not limited thereto.

[0061] The image to be identified can be of any format, such as RGB (Red, Green, Blue) images, grayscale images, depth images, or images corresponding to the Y component of YUV images, but not limited to these. In YUV images, "Y" represents luminance (or Luma), which is the grayscale value, while "U" and "V" represent chrominance (or Chroma), which describe the color and saturation of the image and are used to specify the color of a pixel.

[0062] Image features of the image of the object to be identified include each pixel of the target object and its position in the image. For example, it includes the pixels of each part of the target object and their positions in the image.

[0063] Specifically, computer equipment acquires an image of the object to be identified and extracts its image features. Based on these features, subject detection is performed on the image to detect the target parts of the object. Subject detection refers to automatically processing the region of interest (ROI) while selectively ignoring regions of non-interest when faced with a scene. The ROI is called the subject region.

[0064] In this embodiment, the main area can be the area where the target object is located or the area where the target part of the target object is located.

[0065] Computer equipment extracts features from an image of the object to be recognized to obtain image features. Furthermore, the computer equipment can perform multi-scale feature extraction based on the image of the object to be recognized, obtaining feature maps at multiple scales. These feature maps are then fused to obtain the final image features. The feature map at a later scale is obtained by extracting features from the feature map at a previous scale.

[0066] Step S204: Based on image features, extract the target edge contour of the target part in the image of the object to be identified.

[0067] Specifically, computer equipment detects the target part in the image of the object to be identified based on image features, locates the position of the target part in the image of the object to be identified, and thus determines the target edge contour of the target part.

[0068] In one embodiment, the target edge contour of the target part in the image of the object to be identified is extracted based on image features, including: performing mask segmentation on the image of the object to be identified according to image features to obtain a mask image corresponding to the target part in the image of the object to be identified; and extracting the target edge contour of the target part in the image of the object to be identified based on the mask image.

[0069] Among them, the mask image is an image filter template used to detect the target part in the image of the object to be identified. It can block other parts of the image of the object to be identified and filter out the target part in the image.

[0070] Mask segmentation can separate the target part in the image of the object to be identified and generate a corresponding binary map to represent the position and shape of the target part.

[0071] Specifically, the computer device locates the position of the target region within the image of the object to be identified based on image features, that is, identifies which part of the image is the target region. The pixel values ​​of the target region in the image are set to 1, and the pixel values ​​of other areas in the image are set to 0, thus obtaining a mask image corresponding to the target region. Based on the mask image, the computer device can extract the target edge contour from the image of the object to be identified.

[0072] In one embodiment, such as Figure 3 As shown, an image of the object to be identified with dimensions H×W×C is obtained. Here, H is the image height, W is the image width, and C is the number of channels (e.g., for an RGB image, C=3). Multiple convolutional and pooling layers are used to extract feature maps at multiple scales. The feature extraction process can be represented as follows:

[0073]

[0074] Where I is the image of the object to be identified, and F is the extracted feature map.

[0075] Skip connections are used to fuse feature maps of different scales to preserve detail. The fusion process can be represented as:

[0076]

[0077] in, and These are high-scale feature maps and low-scale feature maps, respectively.

[0078] Generating a mask image based on image features can be represented as:

[0079]

[0080] Where M is the output mask image, This is the weight matrix, and b is the bias term. It is an activation function. Activation functions include, for example, Sigmoid or Softmax.

[0081] The mask image M has a size of H×W×1, representing the probability that each pixel belongs to the target area.

[0082] In this embodiment, the image of the object to be identified is segmented by mask according to the image features to obtain the mask image corresponding to the target part in the image of the object to be identified, so as to locate the position of the target part in the image, and thus accurately extract the target edge contour of the target part based on the mask image.

[0083] Step S206: Based on the target edge contour, perform forgery recognition on the target part in the image of the object to be recognized, and obtain the recognition result.

[0084] The identification result refers to the result indicating whether the target part is a fake part or a non-fake part.

[0085] In one embodiment, the identification result can be characterized by an identification probability, which refers to the probability that the target part is forged.

[0086] Specifically, the computer device determines whether a target part in the image of the object to be identified is a fake part based on the target edge contour, and obtains the identification result of the target part.

[0087] In one embodiment, a computer device acquires a pre-stored object image, which is an image including a target portion of the target object. The computer device can extract image features from the pre-stored object image and extract the original edge contour of the target portion based on the image features. Based on the original edge contour and the target edge contour, the computer device performs forgery detection on the target portion in the image of the object to be identified, and obtains the identification result.

[0088] In this embodiment, the pre-stored object image is segmented by mask according to image features to obtain the mask image corresponding to the target part in the pre-stored object image, and the original edge contour of the target part is extracted based on the mask image.

[0089] Furthermore, the computer device can calculate the target contour similarity between the original edge contour and the target edge contour, and perform forgery recognition on the target part in the image of the object to be recognized based on the similarity to obtain the recognition result.

[0090] For example, it can be determined whether the similarity of the target contour reaches a similarity threshold. If it does, it means that the target part in the image of the object to be identified is not fake; if it does not reach the similarity threshold, it means that the target part in the image of the object to be identified is fake.

[0091] In this embodiment, when the target region is a forged region, it indicates that the image of the object to be identified is a forged image. When the target region is not a forged region, it indicates that the image of the object to be identified is not a forged image.

[0092] In one embodiment, a computer device acquires an image of an object to be identified and inputs the image into an image recognition model. The image recognition model extracts image features from the image of the object to be identified, and extracts the target edge contour of the target region based on the image features. Based on the target edge contour, the image recognition model performs forgery detection on the target region in the image of the object to be identified, and obtains the recognition result.

[0093] In one embodiment, the image recognition model is obtained through training. The training steps of the image recognition model are as follows: acquiring a sample object image and extracting sample image features from the sample object image; extracting the predicted edge contours of the sample parts in the sample object image based on the sample image features; performing forgery recognition on the sample parts in the sample object image based on the predicted edge contours to obtain the predicted recognition result; obtaining the expected recognition result corresponding to the sample object image, and training the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

[0094] Any alteration to any part of an image will change its contour; however, traditional image recognition algorithms generally ignore contour assessment. Therefore, the image recognition method proposed in this embodiment extracts image features from the image of the object to be identified, accurately locating the target edge contour based on these features. The target edge contour reflects information such as the shape and size of the target part. Since the same part can vary in shape and size across different objects, forgery detection is performed on the target part in the image of the object to be identified based on the target edge contour, thus accurately identifying whether the target part has been forged. Furthermore, this method eliminates strong reliance on other feature information of the target part, achieving higher accuracy in forged image detection and improving the security of personal image information during the recognition process.

[0095] In one embodiment, based on the target edge contour, forgery detection is performed on the target region in the image of the object to be identified to obtain the recognition result, including:

[0096] Based on the target edge contour, determine the edge contour region corresponding to the target part in the image of the object to be identified; based on the edge contour region, perform forgery identification on the target part in the image of the object to be identified to obtain the identification result.

[0097] Among them, region segmentation processing refers to the process of segmenting the edge contour region, including the target part, from the image of the object to be identified.

[0098] Specifically, the computer device performs region segmentation processing on the image of the object to be identified based on the target edge contour to obtain the edge contour region corresponding to the target part in the image of the object to be identified.

[0099] In this embodiment, the edge contour region does not include the target part. For example, the parts include a person's eyes, eyebrows, etc. If the target part is the eye, then the segmented edge contour region corresponding to the eye can be the edge region of the eye, that is, the region does not include the eye.

[0100] In one embodiment, the edge contour region includes the target edge contour.

[0101] In one embodiment, the edge contour region may also include a portion of the target region.

[0102] In this embodiment, the computer device performs forgery detection on target parts in the image of the object to be identified based on edge contour regions, and obtains the identification result. Specifically, the computer device extracts features from the edge contour regions to obtain contour region features. Based on the contour region features, forgery detection is performed on the target parts in the image of the object to be identified to determine whether the target parts have been forged, and the identification result of the target parts is obtained.

[0103] Furthermore, multi-scale contour region features can be extracted from the edge contour region, and based on the multi-scale contour region features, forgery identification of the target part can be performed.

[0104] In one embodiment, the contour region features may include at least one of texture features and color features. A computer device may extract the texture and color features of the edge contour region and perform forgery detection based on the texture and color features.

[0105] In one embodiment, based on the edge contour region, forgery detection is performed on the target part in the image of the object to be identified to obtain the recognition result, including:

[0106] Based on image features and edge contour regions, forgery detection is performed on target parts in the image of the object to be identified, and the identification result is obtained.

[0107] In this embodiment, as Figure 4 As shown, based on the image features and edge contour regions of the target area, forgery detection is performed on the target area in the image of the object to be identified, and the recognition result is obtained, including:

[0108] Obtain the preset image features and preset contour regions corresponding to the pre-stored object image; determine the feature similarity between preset image features and image features, and determine the target similarity between preset contour regions and edge contour regions; based on feature similarity and target similarity, perform forgery recognition on the target parts in the object image to be recognized, and obtain the recognition result.

[0109] In this embodiment, the preset image features include features of the target region, and the image features of the object image to be identified also include features of the target region. The feature similarity between the features of the target region in the pre-stored object image and the features of the target region in the object image to be identified is determined. Based on the feature similarity and target similarity, forgery detection is performed on the target region in the object image to be identified, and the identification result is obtained.

[0110] Because the contour region of the target area in an image directly borders the background region, modifying the contour of the target area requires simultaneous modification of the background region, making face-swapping more difficult. Therefore, when forging target areas in an image, changes to the contour are generally ignored. Furthermore, the edge contour region is where the texture and color information changes most significantly when the target area is forged. In this embodiment, region segmentation is performed based on the target edge contour to obtain the edge contour region corresponding to the target area in the image to be identified, thereby obtaining a contour region containing the edge contour of the target area. Based on the edge contour region, forgery detection is performed on the target area in the image to be identified, thus accurately identifying whether the target area has been forged. Moreover, it avoids directly using the feature information of the target area, improving the security of personal image information during the recognition process.

[0111] In face-swapping scenarios, the target area can be a human face. Since the facial contour is directly adjacent to the background, modifying the facial contour requires simultaneous modification of the background area, increasing the difficulty of face-swapping. Therefore, traditional face-swapping algorithms generally ignore changes to the facial contour during face editing. Based on this, to address the broader issue of face-swapping image detection, this embodiment proposes an image recognition method that can identify whether a face is fake based on its contour region. This method eliminates the strong reliance on information such as facial features and hairstyle, thereby achieving higher accuracy in face-swapping image detection.

[0112] In one embodiment, determining the edge contour region corresponding to the target part in the image of the object to be identified based on the target edge contour includes:

[0113] The target edge contour of the target part is scaled to obtain the scaled edge contour. The scaling operation includes at least one of the following operations: shrinking towards the interior of the target part or enlarging away from the interior of the target part. Based on the scaled edge contour, the edge contour region corresponding to the target part is segmented from the image of the object to be identified.

[0114] The scaling operation includes at least one of the following operations: shrinking towards the interior of the target part, or zooming away from the interior of the target part.

[0115] Specifically, the computer device reduces the target edge contour of the target region in the image of the object to be identified by shrinking it towards the interior of the target region to obtain a scaled edge contour. Alternatively, it enlarges the target edge contour by enlarging it away from the interior of the target region to obtain a scaled edge contour. Or, it performs both shrinking and enlarging operations on the target edge contour separately to obtain a scaled edge contour.

[0116] Furthermore, the target edge contour is formed by connecting each pixel. The computer device can obtain preset scaling parameters and the position of each pixel in the target edge contour. The position of each pixel is then scaled according to the preset scaling parameters to obtain the scaled positions in the image of the object to be recognized. In the image of the object to be recognized, the scaled positions are connected to obtain the scaled edge contour.

[0117] For example, if the position is a coordinate, the coordinates of each pixel are multiplied by a preset scaling parameter to obtain the scaled coordinates.

[0118] The computer device segments the region that includes the target edge contour and the scaled edge contour from the image of the object to be identified based on the scaled edge contour, and obtains the edge contour region corresponding to the target part.

[0119] In this embodiment, the computer device can segment the region between the scaled edge contour and the target edge contour from the image of the object to be identified, and use it as the edge contour region corresponding to the target part.

[0120] In this embodiment, the target edge contour of the target part is scaled to obtain the scaled edge contour. Based on the scaled edge contour, the area with the most obvious difference when the target part is forged is segmented from the image of the object to be identified as the edge contour area, so that the edge contour area can be used to accurately identify whether the target part has been forged.

[0121] In one embodiment, the scaled edge contour includes at least one of the inner edge contour or the outer edge contour of the target region, and the edge contour region includes at least one of the following regions: the region between the target edge contour and the inner edge contour, the region between the target edge contour and the outer edge contour, and the region between the inner edge contour and the outer edge contour.

[0122] The inner edge contour is obtained by shrinking the target edge contour towards the interior of the target area. The outer edge contour is obtained by enlarging the target edge contour towards the exterior of the target area. The direction away from the interior of the target area is the direction of the exterior of the target area.

[0123] In one embodiment, the computer device narrows down the target edge contour towards the interior of the target region in the image of the object to be identified, thereby obtaining the inner edge contour of the target region. The area between the target edge contour and the inner edge contour is defined as the edge contour region.

[0124] In one embodiment, the computer device magnifies the target edge contour in a direction away from the interior of the target area to obtain the outer edge contour of the target area. The region between the target edge contour and the outer edge contour is defined as the edge contour region.

[0125] In one embodiment, the computer device may use the region between the inner edge contour and the outer edge contour as the edge contour region.

[0126] In one embodiment, the preset scaling parameter may include at least one of a shrinking parameter or a magnifying parameter. The shrinking parameter is multiplied by the position of each pixel of the target edge contour to obtain the shrunken positions. The shrunken positions are then concatenated to obtain the inner edge contour. The magnifying parameter is multiplied by the position of each pixel of the target edge contour to obtain the magnified positions. The magnified positions are then concatenated to obtain the outer edge contour.

[0127] like Figure 5 As shown, the target edge contour A1 is enlarged in a direction away from the interior of the target area to obtain the outer edge contour A2. The area between A1 and A2 is the edge contour region.

[0128] Or, such as Figure 6 As shown, the target edge contour A1 is reduced towards the interior of the target area to obtain the inner edge contour A3. The area between A1 and A3 is the edge contour region.

[0129] Alternatively, the area between A2 and A3 can be used as the edge contour area.

[0130] In this embodiment, shrinking the target edge contour inwards towards the target area yields the inner edge contour, while magnifying it outwards yields the outer edge contour. Using at least one of the following regions—the area between the shrunk and magnified edges, the area between the magnified and enlarged edges, or the area between the inner and outer edge contours—as the edge contour region improves the segmentation of various contour regions. Furthermore, the edge contour region is the area where the target area changes most significantly when forged; using the edge contour region allows for accurate identification of whether the target area has been forged. Moreover, using only the edge contour region for identification avoids directly using the feature information of the target area, improving the security of user image information during the identification process.

[0131] In one embodiment, scaling the target edge contour of the target region to obtain the scaled edge contour includes:

[0132] Determine the position of each pixel of the target edge contour in the image of the object to be identified; move the position of each pixel toward the interior of the target part in the image of the object to be identified by a first preset distance to obtain the inner edge contour of the target part; move the position of each pixel toward the interior of the target part in the image of the object to be identified by a second preset distance to obtain the outer edge contour of the target part.

[0133] Based on the scaled edge contours, the edge contour regions corresponding to the target parts are segmented from the image of the object to be identified, including:

[0134] From the image of the object to be identified, the region between the inner edge contour and the outer edge contour is segmented as the edge contour region.

[0135] The first preset distance and the second preset distance may be the same or different.

[0136] Specifically, the computer device can determine each pixel that forms the edge contour of the target and determine the position of each pixel in the image of the object to be identified. The computer device can move each position inward by a first preset distance into the target area in the image of the object to be identified to obtain the moved positions. By connecting the moved positions, the inner edge contour of the target area can be obtained.

[0137] The computer device can move each position separately by a second preset distance in a direction away from the interior of the target part, obtaining the moved positions. By connecting the moved positions, the outer edge contour of the target part can be obtained. That is, each position is moved separately outward from the target part by a second preset distance to obtain the moved positions.

[0138] In one embodiment, based on the scaled edge contour, the edge contour region corresponding to the target part is segmented from the image of the object to be identified, including: moving each pixel of the target edge contour a first number of pixels toward the interior of the target part in the image of the object to be identified to obtain an inner edge contour; moving each pixel of the target edge contour a second number of pixels away from the interior of the target part in the image of the object to be identified to obtain an outer edge contour; and using the region between the inner and outer edge contours in the image of the object to be identified as the edge contour region.

[0139] The first quantity and the second quantity can be the same or different.

[0140] For example, the target edge contour A1 is expanded outward to obtain the outer edge contour A2. The target edge contour A1 is expanded inward to obtain the inner edge contour A3. The area between A2 and A3 is taken as the edge contour region.

[0141] In this embodiment, the positions of each pixel of the target edge contour in the image of the object to be identified are determined, thereby determining the overall position of the target edge contour in the image. The positions of each pixel are moved a first preset distance inward toward the target area in the image of the object to be identified, thus shrinking the overall target edge contour inward toward the target area to obtain a shrunken inner edge contour. The positions of each pixel are then moved a second preset distance away from the target area in the image of the object to be identified, thus magnifying the overall target edge contour outward toward the target area to obtain a magnified outer edge contour. The edge contour region between the inner and outer edge contours is the area where the target area changes most significantly when forged, thus enabling accurate identification of whether the target area has been forged using the edge contour region. Furthermore, it avoids directly using the feature information of the target area, improving the security of information use during the identification process.

[0142] In one embodiment, based on edge contour regions, forgery detection is performed on target areas in the image of the object to be identified to obtain recognition results, including:

[0143] Obtain the preset contour region corresponding to the target part in the pre-stored object image; determine the target similarity between the preset contour region and the edge contour region, the target similarity including at least one of the boundary similarity between the preset contour region and the edge contour region, or the region similarity between the preset contour region and the edge contour region; based on the target similarity, perform forgery recognition on the target part in the object image to be recognized, and obtain the recognition result.

[0144] In this embodiment, a preset contour region corresponding to the target part in a pre-stored object image is obtained. The boundary similarity between the preset contour region and the edge contour region is determined, and the regional similarity between the preset contour region and the edge contour region is determined. Based on at least one of the boundary similarity or regional similarity, forgery detection is performed on the target part in the object image to be identified, and a recognition result is obtained.

[0145] In this embodiment, boundary similarity includes at least one of target contour similarity, inner contour similarity, or outer contour similarity. The original edge contour, preset inner edge contour, and preset outer edge contour of the target region in the pre-stored object image are obtained, as well as the preset contour region between the preset inner and preset outer edge contours. The target contour similarity between the original edge contour and the target edge contour is determined; the inner contour similarity between the preset inner edge contours is determined; the outer contour similarity between the preset outer edge contours is determined; and the region similarity between the preset contour region and the edge contour region is determined.

[0146] Based on at least one of target contour similarity, inner contour similarity, outer contour similarity, or region similarity, forgery detection can be performed on the target part in the image of the object to be identified, and the identification result can be obtained.

[0147] Specifically, the computer device can pre-store an image including the target part of the target object, i.e., a pre-stored object image. The computer device can shrink the original edge contour of the pre-stored object image towards the interior of the target part in the pre-stored object image to obtain a preset inner edge contour corresponding to the target part. Then, the original edge contour is expanded away from the interior of the target part in the pre-stored object image to obtain a preset outer edge contour corresponding to the target part. The area between the preset inner edge contour and the preset outer edge contour is defined as a preset contour region. The computer device can pre-store the original edge contour, the preset inner edge contour, the preset outer edge contour, and the preset contour region.

[0148] The computer device can calculate the similarity between two preset inner edge contours and the similarity between two preset outer edge contours. The computer device determines the region similarity between the preset contour region and the edge contour region, and fuses the inner contour similarity, outer contour similarity, and region similarity to obtain the target similarity. When the target similarity reaches the preset similarity, the target part in the image to be identified is determined to be genuine. When the target similarity does not reach the preset similarity, the target part in the image to be identified is determined to be genuine.

[0149] In this embodiment, the weights of target contour similarity, inner contour similarity, outer contour similarity and region similarity can be determined, and the target contour similarity, inner contour similarity, outer contour similarity and region similarity can be fused according to the weights to obtain the target similarity.

[0150] In one embodiment, determining the regional similarity between the preset contour region and the edge contour region includes: extracting multi-scale first contour region features from the edge contour region and extracting multi-scale second contour region features from the preset contour region; determining the feature similarity between the first contour region features and the second contour region features for each scale in the multi-scale; and fusing the feature similarity of each scale to obtain the regional similarity between the preset contour region and the edge contour region.

[0151] In this embodiment, at least one of the boundary similarity or region similarity in the image of the object to be identified and the pre-stored object image is calculated respectively. By calculating the similarity using at least one contour-related information, multiple image recognition schemes can be provided to adapt to various recognition scenarios. Furthermore, combining multiple contour-related information makes the calculated similarity more accurate, thereby enabling more accurate identification of whether the target part is forged.

[0152] In one embodiment, region similarity includes at least one of texture similarity or color similarity, wherein texture similarity characterizes the similarity between a first texture feature of an edge contour region and a second texture feature of a preset contour region, and color similarity characterizes the similarity between a first color feature of an edge contour region and a second color feature of a preset contour region.

[0153] In this embodiment, region similarity includes texture similarity. The computer device extracts a first texture feature of the edge contour region and extracts a second texture feature of the preset contour region. The computer device determines the texture similarity between the first texture feature and the second texture feature.

[0154] In this embodiment, region similarity includes color similarity. The computer device extracts a first color feature of the edge contour region and extracts a second color feature of the preset contour region. The computer device determines the color similarity between the first color feature and the second color feature.

[0155] In this embodiment, region similarity includes texture similarity or color similarity. The computer device extracts first texture features and first color features from the edge contour region, and extracts second texture features and second color features from the preset contour region. The computer device determines the texture similarity between the first texture features and the second texture features, and determines the color similarity between the first color features and the second color features; the texture similarity and color similarity are used as the region similarity between the preset contour region and the edge contour region. Alternatively, texture similarity and color similarity are fused to obtain the region similarity between the preset contour region and the edge contour region.

[0156] like Figure 7 As shown, the computer device can extract texture features and color features from an edge contour region to obtain first texture features and first color features of the edge contour region. The computer device can also extract texture features and color features from a preset contour region to obtain second texture features and second color features of the preset contour region.

[0157] The computer device can determine the texture similarity between a first texture feature and a second texture feature, and determine the color similarity between a first color feature and a second color feature. The texture similarity and color similarity are then fused to obtain the region similarity between a preset contour region and an edge contour region.

[0158] Furthermore, the weights corresponding to texture similarity and color similarity can be determined, and the texture similarity and color similarity can be fused according to the weights to obtain the region similarity.

[0159] In this embodiment, the first texture feature and the first color feature of the edge contour region are extracted, and the second texture feature and the second color feature of the preset contour region are extracted. Texture features can reflect the texture of the target part. The texture of a forged image is often relatively coarse, while the texture of a non-forged image is relatively smooth and natural. Therefore, by calculating the texture similarity between the first texture feature of the object image to be identified and the second texture feature of the pre-stored object image, it is possible to determine whether the texture of the target part in the object image to be identified is sufficiently similar to the texture of the target part in the pre-stored object image.

[0160] Color features can reveal the color of the target area. The colors in a forged image are not harmonious enough, while the colors in a genuine image are more harmonious and natural. Therefore, by using the color similarity between the first and second color features, it is possible to determine whether the color of the target area in the image to be identified is sufficiently similar to the color of the target area in the pre-stored image. By fusing texture similarity and color similarity, the regional similarity between the preset contour region and the edge contour region is obtained. This allows both texture and color factors to be considered, thus enabling a more accurate determination of whether the target area in the image to be identified is forged.

[0161] This embodiment provides multiple recognition schemes, such as determining whether a target part is forged based on texture similarity, color similarity, or a combination of both, which can be adapted to various image recognition scenarios.

[0162] In one embodiment, based on edge contour regions, forgery detection is performed on target areas in the image of the object to be identified to obtain recognition results, including:

[0163] Extract multi-scale first contour region features from the edge contour region; obtain the preset contour region of the target part in the pre-stored object image, and extract multi-scale second contour region features from the preset contour region;

[0164] For each scale in the multi-scale, the feature similarity between the first contour region feature and the second contour region feature of the target scale is determined; based on the feature similarity of each scale, the target part in the image of the object to be identified is forged to obtain the recognition result.

[0165] The large-scale first contour region features contain rich low-level feature information. The small-scale first contour region features are deep feature maps that can reflect high-level feature information. Similarly, the large-scale second contour region features contain rich low-level feature information. The small-scale second contour region features are deep feature maps that can reflect high-level feature information.

[0166] Specifically, the computer device performs multi-scale feature extraction on the edge contour region to obtain multi-scale first contour region features. The computer device acquires a pre-stored object image and determines a preset contour region of the target part in the pre-stored object image, and extracts multi-scale features from the preset contour region to obtain multi-scale second contour region features.

[0167] For each scale in the multi-scale, the computer device calculates the feature similarity between the first contour region feature and the second contour region feature for the target scale to obtain the feature similarity between the first contour region feature and the second contour region feature for each scale.

[0168] Computer equipment can perform forgery detection on target parts in the image of the object to be identified based on the feature similarity at each scale, and obtain the recognition result.

[0169] In this embodiment, the computer device can fuse feature similarity at each scale to obtain target similarity. Based on the target similarity, forgery detection is performed on the target part in the image of the object to be identified, and the identification result is obtained. For example, it is determined whether the target similarity reaches a similarity threshold. If it does, it means that the target part in the image of the object to be identified is not forged; if it does not reach the similarity threshold, it means that the target part is forged.

[0170] In this embodiment, the computer device can use the feature similarity at each scale to perform forgery detection on the target part in the image of the object to be identified, and obtain the scale recognition result corresponding to the feature similarity at each scale. Based on the scale recognition result at each scale, the recognition result of the target part in the image of the object to be identified is determined. For example, it is determined whether each feature similarity reaches a similarity threshold, and the number of feature similarities that reach the similarity threshold is determined. If the number reaches a preset number, it means that the target part in the image of the object to be identified is not forged; if the number does not reach the preset number, it means that the target part is forged.

[0171] In this embodiment, multi-scale features are extracted from the features of the first contour region and the features of the second contour region. Large-scale features contain rich low-level information, while small-scale features are deep features that can reflect high-level semantic information. The similarity between features of the same scale is calculated separately, so that the similarity between low-level features and the similarity between high-level features can be calculated separately. This allows for the determination of whether an image is fake based on the similarity between different levels of semantic information, which helps to improve the accuracy of recognition.

[0172] In one embodiment, the first contour region feature at one scale may include a first texture feature and a first color feature. The second contour region feature at one scale may include a second texture feature and a second color feature. That is: multi-scale texture feature extraction and color feature extraction are performed on the edge contour region to obtain first texture features and first color features at multiple scales; multi-scale texture feature extraction and color feature extraction are performed on the preset contour region to obtain second texture features and second color features at multiple scales; for each scale, the texture similarity between the first texture feature and the second texture feature at the target scale is determined, and the color similarity between the first color feature and the second color feature at the target scale is determined; the texture similarity and color similarity at the target scale are fused to obtain the feature similarity at the target scale.

[0173] The differences between color features and texture features vary at different scales. The larger the scale, the more obvious the differences may be. By comparing the similarity between texture features and color features at different scales, we can more accurately determine the similarity between the target part in the image to be identified and the pre-stored image, and thus more accurately determine whether the target part in the image to be identified is forged.

[0174] In one embodiment, based on the feature similarity at each scale, forgery detection is performed on the target region in the image of the object to be identified to obtain the recognition result, including:

[0175] Based on the feature similarity of the target scale, forgery detection is performed on the target part in the image of the object to be identified, and the scale recognition result of the target scale is obtained; the scale recognition results of multiple scales are fused to obtain the recognition result of the target part in the image of the object to be identified.

[0176] Specifically, the computer device performs forgery detection on target parts in the image of the object to be identified based on feature similarity at the target scale, thereby obtaining the scale recognition result at the target scale, and thus obtaining the scale recognition result corresponding to the feature similarity at each scale. The computer device can fuse or weightedly fuse the scale recognition results of multiple scales to obtain the recognition result of the target parts in the image of the object to be identified.

[0177] In this embodiment, based on the feature similarity of the target scale, forgery detection is performed on the target part in the image of the object to be identified, and the scale recognition result of the target scale is obtained. The scale recognition results of multiple scales are fused to make the recognition result of the target part in the image of the object to be identified more accurate.

[0178] In one embodiment, based on the target edge contour, forgery detection is performed on the target region in the image of the object to be identified to obtain the recognition result, including:

[0179] Based on the features of the target area and the target edge contour, forgery detection is performed on the target area in the image of the object to be identified, and the recognition result is obtained.

[0180] Specifically, the computer device can acquire preset image features and original edge contours corresponding to a pre-stored object image. The preset image features include features of the target region in the pre-stored object image. The feature similarity between the features of the target region in the pre-stored object image and the features of the target region itself is determined, and the target contour similarity between the target edge contour and the original edge contour is determined. Based on the feature similarity and target contour similarity, forgery detection is performed on the target region in the image to be identified, and the identification result is obtained.

[0181] In this embodiment, the edge contour and the image features of the target area are fused together, thereby using the image features of the target area as an auxiliary means to further improve the recognition accuracy.

[0182] In one embodiment, the image of the object to be identified includes the target object to be identified, the target part includes multiple parts of the target object, the target edge contour includes the edge contour of each of the multiple parts, the edge contour region includes the contour region of each of the multiple parts, and the recognition result includes the recognition result of each of the multiple parts.

[0183] Specifically, the image of the object to be identified includes the target object to be identified, and the target part may include one or more parts of the target object.

[0184] When the target area includes multiple parts of the target object, the computer device extracts image features from the image of the object to be identified. Based on these features, it performs mask segmentation on the image of the object to be identified, obtaining a mask image corresponding to each part in the image of the object to be identified. Based on the mask image of each part, the target edge contour of each part is extracted from the image of the object to be identified. For each part, contour enhancement processing is performed on the edge contour of the targeted part to obtain the part contour region of the targeted part. Based on the part contour region of each targeted part, it is determined whether the targeted part is forged, and the part identification result of the targeted part is obtained, thus obtaining the part identification result for each part.

[0185] Furthermore, the computer equipment can determine whether the image of the object to be identified is a forged image based on the part recognition results of each part.

[0186] like Figure 8 As shown, the target object is the human face, including features such as the eyes, nose, mouth, and eyebrows. Computer equipment extracts features from the eyes, nose, mouth, and eyebrows. For example, an eye mask image is segmented based on eye features, the eye edge contour is identified based on the eye mask image, and contour enhancement processing is performed on the eye edge contour to obtain the eye contour region. The authenticity of the eyes is then determined based on the eye contour region. Using the same processing, the authenticity of the nose, mouth, eyebrows, etc., can be identified.

[0187] In this embodiment, the image of the object to be identified includes the target object to be identified, the target part includes multiple parts of the target object, the target edge contour includes the edge contour of each of the multiple parts, the edge contour region includes the contour region of each of the multiple parts, and the identification result includes the identification result of each of the multiple parts, thereby enabling the identification of whether each part is forged, effectively improving the accuracy of image recognition.

[0188] In one embodiment, such as Figure 9 As shown, an image recognition model processing method is provided, which is applied to computer devices (such as computer devices) Figure 1 Taking the terminal or server shown as an example, the following steps are included:

[0189] Step S902: Obtain the sample object image and extract the sample image features of the sample object image.

[0190] Specifically, the computer device acquires an image of the sample object and extracts its features. Based on these features, subject detection is performed on the image to identify the sample parts of the sample object within it.

[0191] Furthermore, the computer device can perform multi-scale feature extraction based on the sample object image to obtain sample feature maps at multiple scales. These multi-scale sample feature maps are then fused to obtain the sample image features. The sample feature map at a later scale is obtained by extracting features from the sample feature map at a previous scale.

[0192] Step S904: Based on the features of the sample image, extract the predicted edge contour of the sample part in the sample object image.

[0193] In this embodiment, the sample object image is segmented by mask according to the features of the sample image to obtain the predicted mask image corresponding to the sample part in the sample object image; the predicted edge contour of the sample part is extracted based on the predicted mask image.

[0194] Specifically, the computer device performs mask segmentation on the sample object image based on the features of the sample image to obtain a predicted mask image corresponding to the sample region in the sample object image. Based on the predicted mask image, the computer device extracts the predicted edge contour of the sample region from the sample object image.

[0195] Step S908: Based on the predicted edge contour, perform forgery recognition on the sample parts in the sample object image to obtain the predicted recognition result.

[0196] In this embodiment, based on the predicted edge contour, forgery detection is performed on sample parts in the sample object image to obtain the predicted detection result, including:

[0197] Region segmentation is performed based on the predicted edge contour to obtain the predicted edge contour region corresponding to the sample part in the sample object image; based on the predicted edge contour region, forgery detection is performed on the sample part in the sample object image to obtain the predicted detection result.

[0198] In this embodiment, region segmentation processing is performed based on the predicted edge contour to obtain the predicted edge contour region corresponding to the sample part in the sample object image. This includes: scaling the predicted edge contour of the sample part to obtain the scaled predicted edge contour. The scaling operation includes at least one of the following operations: shrinking towards the interior of the sample part or enlarging away from the interior of the sample part; and segmenting the predicted edge contour region corresponding to the sample part from the sample object image based on the scaled predicted edge contour.

[0199] In this embodiment, the scaled predicted edge contour includes at least one of the predicted inner edge contour or the predicted outer edge contour of the sample location, and the predicted edge contour region includes at least one of the following regions: the region between the predicted edge contour and the predicted inner edge contour, the region between the predicted edge contour and the predicted outer edge contour, and the region between the predicted inner edge contour and the predicted outer edge contour.

[0200] The inner edge contour is predicted by shrinking the predicted edge contour towards the interior of the sample area. The outer edge contour is predicted by enlarging the predicted edge contour towards the interior of the sample area.

[0201] Specifically, the predicted edge contour is scaled towards the interior of the sample part in the sample object image to obtain the predicted inner edge contour corresponding to the sample part. The predicted edge contour is then magnified towards the interior of the sample part in the sample object image to obtain the predicted outer edge contour corresponding to the sample part. The area between the predicted inner edge contour and the predicted outer edge contour is taken as the predicted edge contour area.

[0202] In this embodiment, the expected inner edge contour and expected outer edge contour of the sample part in the expected object image are obtained, as well as the expected contour region between the expected inner edge contour and the expected outer edge contour. The inner contour similarity between the expected inner edge contour and the predicted inner edge contour is determined, and the outer contour similarity between the expected outer edge contour and the predicted edge contour is determined. The region similarity between the expected contour region and the predicted edge contour region is determined. Based on the inner contour similarity, outer contour similarity, and region similarity, forgery detection is performed on the sample part in the sample object image to obtain the predicted detection result.

[0203] In this embodiment, determining the regional similarity between the desired contour region and the predicted edge contour region includes:

[0204] Extract the first sample texture features and the first sample color features of the predicted edge contour region, and extract the second sample texture features and the second sample color features of the expected contour region; determine the texture similarity between the first sample texture features and the second sample texture features, and determine the color similarity between the first sample color features and the second sample color features; fuse the texture similarity and color similarity to obtain the region similarity between the expected contour region and the predicted edge contour region.

[0205] In one embodiment, based on the predicted edge contour region, forgery detection is performed on sample parts in the sample object image to obtain a predicted detection result, including: extracting multi-scale first sample contour region features from the predicted edge contour region; obtaining the expected contour region of the sample part in the expected object image, and extracting multi-scale second sample contour region features from the expected contour region; determining the feature similarity between the first sample contour region features and the second sample contour region features for each scale in the multi-scale; and performing forgery detection on the sample parts in the sample object image based on the feature similarity at each scale to obtain a predicted detection result.

[0206] In this embodiment, based on the feature similarity at each scale, forgery detection is performed on sample parts in the sample object image to obtain sample recognition results, including:

[0207] Based on the feature similarity of the target scale, forgery detection is performed on sample parts in the sample object image to obtain the scale recognition result of the target scale; the scale recognition results of multiple scales are fused to obtain the predicted recognition result of sample parts in the sample object image.

[0208] Step S910: Obtain the expected recognition result corresponding to the sample object image, and train the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

[0209] The expected recognition result corresponding to the sample object image refers to the actual recognition result of the sample part in the sample object image, which is also the recognition result that the expected model can output.

[0210] The difference between the predicted recognition result and the expected recognition result refers to the difference between the recognition result predicted by the model and the actual recognition result.

[0211] Specifically, the computer device acquires the expected recognition result corresponding to the sample object image and calculates the difference between the predicted recognition result and the expected recognition result. Based on this difference, the model is trained, and when the training stopping condition is met, the image recognition model is obtained.

[0212] Specifically, the training stopping condition can be that the number of training iterations reaches a preset number, or the difference is less than a difference threshold.

[0213] In this embodiment, the predicted recognition result is represented by the predicted recognition probability, and the expected recognition result is represented by the expected recognition probability. The difference between the predicted recognition result and the expected recognition result can specifically be the difference or ratio between the predicted recognition probability and the expected recognition probability.

[0214] In one embodiment, the image recognition model is a contour recognition model, in which sample object images are input into the model in batches to obtain loss, and the weights of the model are updated using the loss values ​​until convergence.

[0215] Recognition loss is the fundamental loss during the training of the recognition model. It guides the model to obtain the most similar feature representations for faces with the same identity, while amplifying the feature differences between faces with different identities. In this embodiment, ArcFace Loss is used. Specifically, for a batch of input face images, the model first extracts image features. ,in Refers to the real identity. Then calculate. Recognition heads corresponding to each identity category cosine similarity Finally, the recognition loss generated by this image is calculated:

[0216]

[0217] Where N represents the number of images in the current batch, and n represents the total number of facial identities. Refers to his true identity; m is a hyperparameter set to further reduce the feature differences between faces with the same identity; s is a hyperparameter set to further increase the feature differences between faces with different identities. yes With its true category identification head The included angle.

[0218] Compared to traditional face recognition models, the contour recognition model in this embodiment only adds a very small segmentation sub-model, resulting in minimal increase in storage and time consumption, which is virtually imperceptible to the user.

[0219] In this embodiment, by acquiring a sample object image, extracting sample image features from the sample object image, and accurately extracting the predicted edge contours of the sample parts based on the sample image features, contour enhancement processing is performed based on the predicted edge contours to obtain the predicted edge contour regions corresponding to the sample parts in the sample object image, thereby obtaining a contour region containing the edge contours of the sample parts. Based on the predicted edge contour regions, forgery detection is performed on the sample parts in the sample object image to obtain predicted detection results, thus enabling the prediction of whether a sample part has been forged using the edge contour regions. The expected detection result corresponding to the sample object image is obtained, and the model is trained based on the difference between the predicted detection result and the expected detection result, so that the trained image recognition model can accurately identify whether a part has been forged based on the edge contour regions of a certain part. Furthermore, identifying whether an image is forged through an image recognition model can effectively improve the accuracy and efficiency of image recognition.

[0220] In one embodiment, an image recognition model is obtained by training a model based on the difference between the predicted recognition result and the expected recognition result, including:

[0221] Obtain the expected edge contour corresponding to the sample object image, determine the contour difference between the predicted edge contour and the expected edge contour; determine the recognition difference between the predicted recognition result and the expected recognition result; train the model based on the contour difference and the recognition difference to obtain the image recognition model.

[0222] In one embodiment, the desired edge contour region corresponding to the sample object image is obtained, and the contour region difference between the predicted edge contour region and the desired edge contour region is determined; the recognition difference between the predicted recognition result and the desired recognition result is determined; and the model is trained based on the contour region difference and the recognition difference to obtain an image recognition model.

[0223] In one embodiment, an image recognition model is obtained by training a model based on contour differences, contour region differences, and recognition differences.

[0224] The expected edge contour region is the real edge contour region corresponding to the sample object image, while the predicted edge contour region is the edge contour region determined by the model during training.

[0225] Contour region difference represents the difference between the edge contour regions predicted by the model during training and the actual edge contour regions.

[0226] In this embodiment, the sample object image may include a positive sample image and a negative sample image. The expected edge contour region of the positive sample image is the real edge contour region of the sample part in the positive sample image. The negative sample image is obtained by forging the positive sample image, and the expected edge contour region corresponding to the negative sample image is the real edge contour region of the sample part in the negative sample image.

[0227] Specifically, the computer device can acquire the expected edge contour region corresponding to the sample object image, and calculate the contour region difference between the predicted edge contour region and the expected edge contour region. The computer device can determine the recognition difference between the predicted recognition result and the expected recognition result, calculate the target loss based on the contour region difference and the recognition difference, and train the model based on the target loss to obtain an image recognition model.

[0228] In this embodiment, the contour region difference and the recognition difference can be weighted and fused to obtain the target loss. When the target loss is less than or equal to the loss threshold, training stops, and the image recognition model is obtained. When the target loss is greater than the loss threshold, the next iteration of training is performed until the target loss is less than or equal to the loss threshold, at which point the image recognition model is obtained.

[0229] In this embodiment, determining the contour difference between the predicted edge contour and the expected edge contour can determine the similarity between the edge shapes of the sample parts. The recognition difference between the predicted recognition result and the expected recognition result represents the difference between the recognition result output by the expected model and the recognition result output by the model during training. Model training is performed based on the contour difference and the recognition difference, so that the model gradually improves the accuracy of edge contour localization and the accuracy of identifying whether the sample parts are forged during the training process.

[0230] In this embodiment, the desired edge contour region corresponding to the sample object image is obtained, the contour region difference between the predicted edge contour region and the desired edge contour region is determined, the recognition difference between the predicted recognition result and the desired recognition result is determined, and the model is trained based on the contour region difference and the recognition difference, so that the model gradually improves the segmentation accuracy of the edge contour region and the recognition accuracy of whether the sample part is forged during the training process.

[0231] In one embodiment, an image recognition method is provided, applied to a computer device, including a training process and an application process, wherein...

[0232] Training process:

[0233] Acquire the sample object image and extract the sample image features from the sample object image;

[0234] Based on the features of the sample image, perform mask segmentation on the sample object image to obtain the predicted mask image corresponding to the sample part in the sample object image;

[0235] Predicted edge contours of sample locations are extracted from the predicted mask image; region segmentation is performed based on the predicted edge contours to obtain the predicted edge contour regions corresponding to the sample locations in the sample object image.

[0236] Based on the predicted edge contour region, forgery detection is performed on sample parts in the sample object image to obtain the predicted recognition result;

[0237] Obtain the expected recognition result corresponding to the sample object image, obtain the expected edge contour region corresponding to the sample object image, and determine the contour region difference between the predicted edge contour region and the expected edge contour region.

[0238] Determine the recognition difference between the predicted recognition result and the expected recognition result; train the model based on the contour region difference and the recognition difference to obtain the image recognition model.

[0239] The application process is implemented through an image recognition model:

[0240] Acquire the image of the object to be identified and input the image of the object to be identified into the image recognition model;

[0241] Image features of the object to be identified are extracted using an image recognition model;

[0242] Using an image recognition model, the image of the object to be recognized is segmented by mask based on image features to obtain the mask image corresponding to the target part in the image of the object to be recognized; using the image recognition model, the target edge contour of the target part is extracted based on the mask image.

[0243] Using an image recognition model, the target edge contour is reduced in the direction closer to the interior of the target part in the image to be recognized, to obtain the inner edge contour corresponding to the target part; the target edge contour is expanded in the direction further away from the interior of the target part in the image to be recognized, to obtain the outer edge contour corresponding to the target part; the area between the inner edge contour and the outer edge contour is taken as the edge contour region.

[0244] Obtain the preset inner edge contour and preset outer edge contour of the target part in the pre-stored object image, as well as the preset contour region between the preset inner edge contour and the preset outer edge contour;

[0245] Determine the similarity between the preset inner edge contour and the inner edge contour, and determine the similarity between the preset outer edge contour and the outer edge contour;

[0246] Multi-scale texture and color feature extraction is performed on the edge contour region to obtain first texture features and first color features at multiple scales. Multi-scale texture and color feature extraction is also performed on the preset contour region to obtain second texture and second color features at multiple scales. For each scale, the texture similarity between the first and second texture features at the target scale is determined, and the color similarity between the first and second color features at the target scale is also determined. The texture similarity and color similarity at the target scale are fused to obtain the feature similarity at the target scale. Finally, the feature similarity at each scale is fused to obtain the region similarity between the preset contour region and the edge contour region.

[0247] Based on the similarity of the inner contour, the similarity of the outer contour, and the similarity of the regions, forgery detection is performed on the target parts in the image of the object to be identified, and the recognition result is obtained.

[0248] In one embodiment, the image recognition method can be applied to any scenario that requires determining whether an image is forged, such as smart retail, smart communities, smart buildings, online identity authentication, etc.

[0249] In one embodiment, an application scenario for an image recognition method is provided, specifically applicable to face recognition scenarios within identity authentication scenarios.

[0250] In facial recognition scenarios, users capture facial images through a terminal and store these images in a computer device. This computer device can be either a terminal or a server.

[0251] like Figure 10 When user authentication is required, the user can upload a face image to be identified via the terminal. This image can be captured by camera or selected from a local image. An image of the object to be identified with dimensions H×W×C is obtained, where H is the image height, W is the image width, and C is the number of channels (e.g., for an RGB image, C=3). Multiple convolutional and pooling layers are used to extract feature maps at multiple scales. The feature extraction process can be represented as follows:

[0252]

[0253] Where I is the face image to be identified, and F is the extracted feature map.

[0254] Skip connections are used to fuse feature maps of different scales to preserve detail. The fusion process can be represented as:

[0255]

[0256] in, and These are high-scale feature maps and low-scale feature maps, respectively.

[0257] The generation of a face mask image based on image features can be represented as:

[0258]

[0259] Where M is the output face mask image, This is the weight matrix, and b is the bias term. It is an activation function. Activation functions include, for example, Sigmoid or Softmax.

[0260] The mask image M has a size of H×W×1, representing the probability that each pixel belongs to the target area.

[0261] Region segmentation processing: Based on the face mask image, the edge contour of the face region is obtained. First, the edge contour is scaled inward by x pixels to obtain the inner edge contour. Then, the edge contour is expanded outward by x pixels to obtain the outer edge contour. The area between the inner and outer edge contours is the edge contour region of the face. This edge contour region removes information such as facial features, skin, and hair color, effectively filtering out the influence of high-quality edited images on facial features and skin, thus achieving the effect of intercepting edited images.

[0262] Similarly, by performing the same processing on a pre-stored face image, the original edge contour region in the pre-stored face image can be obtained.

[0263] Extract the first texture feature and the first color feature of the edge contour region, and extract the second texture feature and the second color feature of the preset contour region. Determine the texture similarity between the first texture feature and the second texture feature, and determine the color similarity between the first color feature and the second color feature.

[0264] By fusing texture similarity and color similarity, the region similarity between the preset contour region and the edge contour region is obtained.

[0265] When the region similarity reaches the similarity threshold, it indicates that the face image is not a face-swapped image, meaning it is not a fake image. When the region similarity does not reach the similarity threshold, it indicates that the face image is a face-swapped image, meaning it is a fake image, and the terminal interface will display as follows. Figure 11 The recognition result shown indicates that the face image is a face-swapped image.

[0266] This embodiment proposes an image recognition method that can identify whether a face is forged based on its contour region. It eliminates the strong reliance on information such as facial features and hairstyles, thus achieving higher accuracy in detecting face-swapped images. It can effectively intercept face images where key information such as facial features and skin has been edited, thereby significantly reducing the security risks posed by the black market to finance, information, and public opinion. Compared to traditional face recognition methods, this embodiment maintains essentially the same processing time but significantly improves the interception effect against face-swapped algorithms, demonstrating significant research and application value.

[0267] To demonstrate that the method of this embodiment can effectively intercept face-swapped images, such as facial images edited by the black market, tests were conducted using real faces and edited facial images. The effectiveness of traditional face recognition methods and the contour-based image recognition method of this embodiment in intercepting face-swapped images was compared. Figure 12 As shown, the image recognition method based on contours in this embodiment achieves a significantly higher edit image interception rate compared to traditional face recognition methods.

[0268] In this embodiment, facial information can be discarded to avoid the impact of face-swapping algorithms on recognition. Alternatively, methods such as cross-attention can be used to fuse contour and facial information, using facial information as an auxiliary means to further improve the interception rate.

[0269] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0270] Based on the same inventive concept, this application also provides an image recognition device for implementing the image recognition method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more image recognition device embodiments provided below can be found in the limitations of the image recognition method described above, and will not be repeated here.

[0271] In one embodiment, such as Figure 13As shown, an image recognition device 1300 is provided, including: an acquisition module 1302, an extraction module 1304, and a recognition module 1306, wherein:

[0272] The acquisition module 1302 is used to acquire the image of the object to be identified and extract the image features of the image of the object to be identified.

[0273] The extraction module 1304 is used to extract the target edge contour of the target part in the image of the object to be identified based on image features.

[0274] The recognition module 1306 is used to perform forgery recognition on the target part in the image of the object to be recognized based on the target edge contour, and obtain the recognition result.

[0275] In this embodiment, by acquiring an image of the object to be identified and extracting its image features, the target edge contour of the target region can be accurately located based on these features. The target edge contour reflects information such as the shape and size of the target region. Since the same region on different objects can vary in shape and size, forgery detection can be performed on the target region in the image of the object to be identified based on the target edge contour. This allows for accurate identification of whether a target region has been forged. Furthermore, it avoids directly using the feature information of the target region, improving the security of personal image information during the identification process.

[0276] In one embodiment, the device further includes:

[0277] The mask segmentation module is used to perform mask segmentation on the image of the object to be identified based on image features, and obtain the mask image corresponding to the target part in the image of the object to be identified.

[0278] The extraction module 1304 is also used to extract the target edge contour of the target region based on the mask image.

[0279] In one embodiment, the device further includes:

[0280] The region segmentation module is used to perform region segmentation processing based on the target edge contour to obtain the edge contour region corresponding to the target part in the image of the object to be identified.

[0281] The recognition module 1306 is also used to perform forgery recognition on target parts in the image of the object to be recognized based on edge contour regions, and obtain recognition results.

[0282] In one embodiment, the edge contour region contains the target edge contour.

[0283] In one embodiment, the region segmentation module is further configured to scale the target edge contour of the target part to obtain the scaled edge contour. The scaling operation includes at least one of the following operations: a shrinking operation in the direction closer to the interior of the target part, or a magnification operation in the direction farther away from the interior of the target part; based on the scaled edge contour, the edge contour region corresponding to the target part is segmented from the image of the object to be identified.

[0284] In one embodiment, the scaled edge contour includes at least one of the inner edge contour or the outer edge contour of the target region, and the edge contour region includes at least one of the following regions: the region between the target edge contour and the inner edge contour, the region between the target edge contour and the outer edge contour, and the region between the inner edge contour and the outer edge contour.

[0285] The inner edge contour is obtained by shrinking the target edge contour towards the interior of the target area, while the outer edge contour is obtained by enlarging the target edge contour towards the exterior of the target area.

[0286] In one embodiment, the region segmentation module is further configured to determine the position of each pixel of the target edge contour in the image of the object to be identified; move the position of each pixel toward the interior of the target part in the image of the object to be identified by a first preset distance to obtain the inner edge contour of the target part; move the position of each pixel toward the interior of the target part in the image of the object to be identified by a second preset distance to obtain the outer edge contour of the target part; and segment the region between the inner edge contour and the outer edge contour from the image of the object to be identified to obtain the edge contour region corresponding to the target part.

[0287] In one embodiment, the recognition module 1306 is further configured to: acquire a preset contour region corresponding to the target part in a pre-stored object image; determine the target similarity between the preset contour region and the edge contour region, wherein the target similarity includes at least one of the boundary similarity between the preset contour region and the edge contour region, or the region similarity between the preset contour region and the edge contour region; and perform forgery recognition on the target part in the object image to be recognized based on the target similarity to obtain a recognition result.

[0288] In one embodiment, region similarity includes at least one of texture similarity or color similarity, wherein texture similarity characterizes the similarity between a first texture feature of an edge contour region and a second texture feature of a preset contour region, and color similarity characterizes the similarity between a first color feature of an edge contour region and a second color feature of a preset contour region.

[0289] In this embodiment, the first texture feature and the first color feature of the edge contour region are extracted, and the second texture feature and the second color feature of the preset contour region are extracted. Texture features can reflect the texture of the target part. The texture of a forged image is often relatively coarse, while the texture of a non-forged image is relatively smooth and natural. Therefore, by calculating the texture similarity between the first texture feature of the object image to be identified and the second texture feature of the pre-stored object image, it is possible to determine whether the texture of the target part in the object image to be identified is sufficiently similar to the texture of the target part in the pre-stored object image.

[0290] Color features can reveal the color of the target area. The colors in a forged image are not harmonious enough, while the colors in a genuine image are more harmonious and natural. Therefore, by using the color similarity between the first and second color features, it is possible to determine whether the color of the target area in the image to be identified is sufficiently similar to the color of the target area in the pre-stored image. By fusing texture similarity and color similarity, the regional similarity between the preset contour region and the edge contour region is obtained. This allows both texture and color factors to be considered, thus enabling a more accurate determination of whether the target area in the image to be identified is forged.

[0291] In one embodiment, the recognition module 1306 is further configured to extract multi-scale first contour region features from the edge contour region; obtain a preset contour region of the target part in the pre-stored object image, and extract multi-scale second contour region features from the preset contour region; determine the feature similarity between the first contour region features and the second contour region features for each scale in the multi-scale; and perform forgery recognition on the target part in the object image to be recognized based on the feature similarity of each scale to obtain the recognition result.

[0292] In this embodiment, the differences between color features and texture features at different scales are different. The larger the scale, the more obvious the differences may be. By comparing the similarity between texture features at different scales and the similarity between color features at different scales, the similarity between the target parts in the image to be identified and the pre-stored image can be determined more accurately, thereby determining more accurately whether the target parts in the image to be identified are forged.

[0293] In one embodiment, the recognition module 1306 is further configured to perform forgery recognition on the target part in the image of the object to be recognized based on the feature similarity of the target scale, and obtain the scale recognition result of the target scale.

[0294] By fusing scale recognition results from multiple scales, the recognition results of the target parts in the image of the object to be recognized are obtained.

[0295] In one embodiment, the recognition module 1306 is further configured to perform forgery recognition on the target part in the image of the object to be recognized based on the image features of the target part and the target edge contour, and obtain the recognition result.

[0296] In one embodiment, the recognition module 1306 is further configured to perform forgery recognition on the target part in the image of the object to be recognized based on the image features and edge contour regions of the target part, and obtain the recognition result.

[0297] In one embodiment, the recognition module 1306 is further configured to acquire preset image features and preset contour regions corresponding to the pre-stored object image, wherein the preset image features include image features of the target part in the pre-stored object image; determine a first similarity between the preset image features and the image features, and determine a second similarity between the preset contour region and the target edge contour region; and perform forgery recognition on the target part in the object image to be recognized based on the first similarity and the second similarity to obtain the recognition result.

[0298] In one embodiment, the image of the object to be identified includes the target object to be identified, the target part includes multiple parts of the target object, the target edge contour includes the edge contour of each of the multiple parts, the edge contour region includes the contour region of each of the multiple parts, and the recognition result includes the recognition result of each of the multiple parts.

[0299] Based on the same inventive concept, this application also provides an image recognition model processing apparatus for implementing the image recognition model processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more image recognition model processing apparatus embodiments provided below can be found in the limitations of the image recognition model processing method described above, and will not be repeated here.

[0300] In one embodiment, such as Figure 14 As shown, an image recognition model processing device 1400 is provided, including: a sample acquisition module 1402, a sample extraction module 1404, a sample recognition module 1406, and a training module 1408, wherein:

[0301] The sample acquisition module 1402 is used to acquire sample object images and extract sample image features from the sample object images.

[0302] The sample extraction module 1404 is used to extract the predicted edge contour of the sample part in the sample object image based on the features of the sample image.

[0303] The sample recognition module 1406 is used to perform forgery recognition on sample parts in the sample object image based on the predicted edge contour, and obtain the predicted recognition result.

[0304] The training module 1408 is used to obtain the expected recognition result corresponding to the sample object image, and to train the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

[0305] In this embodiment, by acquiring a sample object image, extracting sample image features from the sample object image, and accurately extracting the predicted edge contours of sample parts in the sample object image based on the sample image features. Edge contours reflect information such as the shape and size of the sample part. Since the same part of different objects can vary in shape and size, forgery detection is performed on sample parts in the sample image based on the predicted edge contours. This allows for the effective prediction of whether a sample part has been forged. Furthermore, using only edge contours for identification, without needing to use the feature information of the sample part, improves the security of personal image information during the identification process. The desired recognition result corresponding to the sample object image is obtained. The model is trained based on the difference between the predicted recognition result and the desired recognition result output by the model. This allows the trained image recognition model to accurately identify whether a part has been forged based on its edge contours. Moreover, identifying forged images through an image recognition model effectively improves the accuracy and efficiency of image recognition.

[0306] In one embodiment, the device further includes:

[0307] The sample mask segmentation module is used to perform mask segmentation on the sample object image based on the features of the sample image, and obtain the predicted mask image corresponding to the sample part in the sample object image.

[0308] The sample extraction module 1404 is also used to extract the predicted edge contour of the sample region based on the predicted mask image.

[0309] In one embodiment, the training module 1408 is further configured to acquire the expected edge contour corresponding to the sample object image, determine the contour difference between the predicted edge contour and the expected edge contour, determine the recognition difference between the predicted recognition result and the expected recognition result, and train the model based on the contour difference and the recognition difference to obtain an image recognition model.

[0310] In one embodiment, the training module 1408 is further configured to obtain the expected edge contour region corresponding to the sample object image and determine the contour region difference between the predicted edge contour region and the expected edge contour region.

[0311] Determine the recognition difference between the predicted recognition result and the expected recognition result; train the model based on the contour region difference and the recognition difference to obtain the image recognition model.

[0312] In this embodiment, the desired edge contour region corresponding to the sample object image is obtained, the contour region difference between the predicted edge contour region and the desired edge contour region is determined, the recognition difference between the predicted recognition result and the desired recognition result is determined, and the model is trained based on the contour region difference and the recognition difference, so that the model gradually improves the segmentation accuracy of edge contour region recognition and the recognition accuracy of whether the sample part is forged during the training process.

[0313] Each module in the aforementioned image recognition device and image recognition model processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0314] In one embodiment, a computer device is provided, which may be a terminal or a server. Taking a terminal as an example, its internal structure diagram can be as follows: Figure 15 As shown, the computer device includes a processor, memory, input / output interface, communication interface, display unit, and input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interface. The processor provides computational and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage medium. The input / output interface is used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements an image recognition method and an image recognition model processing method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0315] Those skilled in the art will understand that Figure 15The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0316] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0317] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0318] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0319] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0320] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0321] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0322] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. An image recognition method, characterized in that, The method includes: Acquire an image of the object to be identified, and extract the image features of the object to be identified; Based on the image features, the target edge contour of the target part in the image of the object to be identified is extracted; Based on the target edge contour, forgery detection is performed on the target part in the image of the object to be identified, and the identification result is obtained.

2. The method according to claim 1, characterized in that, The step of performing forgery detection on the target region in the image of the object to be identified based on the target edge contour, and obtaining the identification result, includes: Based on the target edge contour, determine the edge contour region corresponding to the target part in the image of the object to be identified; Based on the edge contour region, forgery detection is performed on the target part in the image of the object to be identified, and the identification result is obtained.

3. The method according to claim 2, characterized in that, The target edge contour is contained within the edge contour region.

4. The method according to claim 2 or 3, characterized in that, The step of determining the edge contour region corresponding to the target part in the image of the object to be identified based on the target edge contour includes: The target edge contour of the target part is scaled to obtain the scaled edge contour. The scaling operation includes at least one of the following operations: shrinking operation towards the interior of the target part, or enlarging operation towards the exterior of the target part. Based on the scaled edge contour, the edge contour region corresponding to the target part is segmented from the image of the object to be identified.

5. The method according to claim 4, characterized in that, The scaled edge contour includes at least one of the inner edge contour or the outer edge contour of the target portion, and the edge contour region includes at least one of the following regions: the region between the target edge contour and the inner edge contour, the region between the target edge contour and the outer edge contour, and the region between the inner edge contour and the outer edge contour. The inner edge contour is obtained by shrinking the target edge contour toward the interior of the target part, and the outer edge contour is obtained by enlarging the target edge contour toward the interior of the target part.

6. The method according to claim 5, characterized in that, The scaling operation on the target edge contour of the target region to obtain the scaled edge contour includes: Determine the position of each pixel of the target edge contour in the image of the object to be identified; The positions of each pixel are moved a first preset distance toward the interior of the target part in the image of the object to be identified, thereby obtaining the inner edge contour of the target part; The positions of each pixel are moved a second preset distance away from the interior of the target part in the image of the object to be identified, thereby obtaining the outer edge contour of the target part; The step of segmenting the edge contour region corresponding to the target part from the image of the object to be identified based on the scaled edge contour includes: From the image of the object to be identified, the region between the inner edge contour and the outer edge contour is segmented to obtain the edge contour region corresponding to the target part.

7. The method according to any one of claims 2 to 6, characterized in that, The step of performing forgery detection on the target part in the image of the object to be identified based on the edge contour region to obtain the identification result includes: Obtain the preset contour region corresponding to the target part in the pre-stored object image; Determine the target similarity between the preset contour region and the edge contour region, wherein the target similarity includes at least one of the boundary similarity between the preset contour region and the edge contour region, or the region similarity between the preset contour region and the edge contour region; Based on the target similarity, forgery detection is performed on the target part in the image of the object to be identified to obtain the identification result.

8. The method according to claim 7, characterized in that, The region similarity includes at least one of texture similarity or color similarity. The texture similarity characterizes the similarity between a first texture feature of the edge contour region and a second texture feature of the preset contour region. The color similarity characterizes the similarity between a first color feature of the edge contour region and a second color feature of the preset contour region.

9. The method according to any one of claims 2 to 8, characterized in that, The step of performing forgery detection on the target part in the image of the object to be identified based on the edge contour region to obtain the identification result includes: Extract multi-scale first contour region features from the edge contour region; Obtain a preset contour region of the target part in the pre-stored object image, and extract multi-scale second contour region features from the preset contour region; For each of the multiple scales, determine the feature similarity between the first contour region features and the second contour region features for that scale. Based on the feature similarity at each scale, forgery detection is performed on the target part in the image of the object to be identified, and the identification result is obtained.

10. The method according to claim 9, characterized in that, The step of performing forgery detection on the target region in the image of the object to be identified based on the feature similarity at each scale, and obtaining the identification result, includes: Based on the feature similarity of the target scale, forgery detection is performed on the target part in the image of the object to be identified, and the scale recognition result of the target scale is obtained. By fusing scale recognition results from multiple scales, the recognition result of the target part in the image of the object to be recognized is obtained.

11. The method according to any one of claims 1 to 10, characterized in that, The step of extracting the target edge contour of the target region in the image of the object to be identified based on the image features includes: The image of the object to be identified is segmented by mask based on the image features to obtain the mask image corresponding to the target part in the image of the object to be identified; The target edge contour of the target region in the image of the object to be identified is extracted based on the mask image.

12. The method according to claim 1, characterized in that, The step of performing forgery detection on the target region in the image of the object to be identified based on the target edge contour, and obtaining the identification result, includes: Based on the features of the target region and the target edge contour, forgery detection is performed on the target region in the image of the object to be identified, and the identification result is obtained.

13. The method according to any one of claims 1 to 12, characterized in that, The image of the object to be identified includes the target object to be identified, the target part includes multiple parts of the target object, the target edge contour includes the edge contour of each of the multiple parts, and the recognition result includes the recognition result of each of the multiple parts.

14. An image recognition model processing method, characterized in that, The method includes: Obtain a sample object image and extract sample image features from the sample object image; Based on the features of the sample image, extract the predicted edge contour of the sample part in the sample object image; Based on the predicted edge contour, forgery detection is performed on the sample part in the sample object image to obtain the predicted recognition result; Obtain the expected recognition result corresponding to the sample object image, and train the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

15. The method according to claim 14, characterized in that, The step of training a model based on the difference between the predicted recognition result and the expected recognition result to obtain an image recognition model includes: Obtain the expected edge contour corresponding to the sample object image, and determine the contour difference between the predicted edge contour and the expected edge contour; Determine the recognition difference between the predicted recognition result and the expected recognition result; Based on the contour differences and the recognition differences, a model is trained to obtain an image recognition model.

16. An image recognition device, characterized in that, The device includes: The acquisition module is used to acquire an image of the object to be identified and extract the image features of the object to be identified; The extraction module is used to extract the target edge contour of the target part in the image of the object to be identified based on the image features; The recognition module is used to perform forgery recognition on the target part in the image of the object to be recognized based on the target edge contour, and obtain the recognition result.

17. An image recognition model processing device, characterized in that, The device includes: The sample acquisition module is used to acquire sample object images and extract sample image features from the sample object images; The sample extraction module is used to extract the predicted edge contour of the sample part in the sample object image based on the features of the sample image; The sample recognition module is used to perform forgery recognition on the sample part in the sample object image based on the predicted edge contour, and obtain the predicted recognition result; The training module is used to obtain the expected recognition result corresponding to the sample object image, and to train the model based on the difference between the predicted recognition result and the expected recognition result to obtain the image recognition model.

18. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 15.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 15.

20. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 15.