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

By extracting image features and identifying edge contours, the problem of decreased detection capability of deepfake technology detection models for unseen forgery methods is solved, achieving higher accuracy in forged image detection and improved information security.

WO2026157966A1PCT designated stage Publication Date: 2026-07-30TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2026-01-06
Publication Date
2026-07-30

AI Technical Summary

Technical Problem

Existing deepfake detection models suffer from reduced detection capabilities when faced with unfamiliar forgery methods, resulting in inaccurate detection of forged images.

Method used

By acquiring the image features of the object to be identified, the edge contours of the parts to be identified in the image are extracted, and forgery recognition is performed based on the edge contours to obtain the recognition result.

Benefits of technology

It improves the accuracy of forged image detection, enhances the security of personal image information, and eliminates the strong reliance on other feature information of the parts to be identified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2026070770_30072026_PF_FP_ABST
    Figure CN2026070770_30072026_PF_FP_ABST
Patent Text Reader

Abstract

An image recognition method, comprising: acquiring an object image to be recognized, and extracting an image feature of said object image (S202); on the basis of the image feature, extracting an edge contour of a part to be recognized (S204); and on the basis of the edge contour, performing counterfeit recognition on said part in said object image to obtain a recognition result (S206).
Need to check novelty before this filing date? Find Prior Art

Description

Image recognition methods, devices, computer equipment, storage media and software products

[0001] Related applications

[0002] This application claims priority to Chinese patent application filed on January 24, 2025, with application number 2025101177026, entitled "Image Recognition Method, Apparatus, Computer Equipment, Storage Medium and Program Product", the entire contents of which are incorporated herein by reference. Technical Field

[0003] 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

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

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

[0006] 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

[0007] According to various embodiments provided in this application, an image recognition method, apparatus, computer device, computer-readable storage medium, and computer program product are provided.

[0008] This application provides an image recognition method, executed by a computer device, the method comprising:

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

[0010] Based on the image features, extract the edge contours of the regions to be identified in the image of the object to be identified; and

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

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

[0013] 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;

[0014] The extraction module is used to extract the edge contours of the regions to be identified in the image of the object to be identified based on the image features; and

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

[0016] On the other hand, this application provides an image recognition model processing method, executed by a computer device, the method comprising:

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

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

[0019] Based on the predicted edge contour, forgery detection is performed on the sample portion in the sample object image to obtain the predicted detection result; and

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

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

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

[0023] 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;

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

[0025] The training module is used to obtain the expected recognition result of 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 an image recognition model.

[0026] 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 implement the steps of the various method embodiments of this application.

[0027] 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, implements the steps of the various method embodiments of this application.

[0028] 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, implements the steps of the various method embodiments of this application. Attached Figure Description

[0029] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.

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

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

[0032] Figure 3 is a flowchart illustrating the process of obtaining a mask image of the part to be identified in an image of an object to be identified in one embodiment;

[0033] Figure 4 is a schematic diagram of the process of forgery identification in the image of the object to be identified based on the image features and edge contour regions of the part to be identified in another embodiment;

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

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

[0036] Figure 7 is a flowchart illustrating the process of determining the regional similarity between the preset contour region and the edge contour region in another embodiment;

[0037] Figure 8 is a schematic diagram of another embodiment where the parts to be identified include eyes, nose, mouth, and eyebrows;

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

[0039] Figure 10 is a schematic diagram of the interface in another embodiment of a face recognition scenario;

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

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

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

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

[0044] Figure 15 is an internal structure diagram of a computer device in one embodiment. Detailed Implementation

[0045] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0046] The image recognition method provided in this application embodiment can be applied to the application environment shown in Figure 1. 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 application embodiment. Terminal 102 and server 104 can also work together to execute the image recognition method provided in this application embodiment. When terminal 102 and server 104 work together to execute the image recognition method provided in this application 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 edge contours of the parts to be recognized in the image of the object to be recognized, and performs forgery recognition on the parts to be recognized in the image of the object to be recognized based on the edge contours to obtain the recognition result. Server 104 returns the recognition result to terminal 102.

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

[0048] In one embodiment, an image recognition model processing method is also provided, which can be applied to the application environment shown in Figure 1. 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, and performs forgery recognition on the sample parts in the sample object image based on the predicted edge contours to obtain a predicted recognition result. Terminal 102 obtains the desired recognition result of the sample object image, and performs model training based on the difference between the predicted recognition result and the desired recognition result to obtain an image recognition model. The image recognition model can be deployed on terminal 102 or server 104.

[0049] In one embodiment, as shown in FIG2, an image recognition method is provided. Taking the application of this method to a computer device (the computer device is a terminal or server as shown in FIG1) as an example, the method includes the following steps:

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

[0051] The image to be identified is an image that includes the object to be identified. The object to be identified includes parts that need to be identified, which are the parts that need to be determined whether they have been forged. The object to be identified can be, for example, a person, an animal, a 3D model, a robot, etc.

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

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

[0054] Image features of the image of the object to be identified include each pixel of the object and its position in the image. For example, image features include pixels of different parts of the object and their positions in the image.

[0055] 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 to identify the parts of the object to be identified. Subject detection refers to the automatic processing of regions of interest (ROIs) while selectively ignoring regions of non-interest in a given scene. The ROI is called the subject region.

[0056] In this embodiment, the main area can be the area where the object is located or the area where the part of the object to be identified is located.

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

[0058] Step S204: Based on image features, extract the edge contours of the parts to be identified in the image of the object to be identified.

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

[0060] In one embodiment, the edge contour of the part to be identified 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 of the part to be identified in the image of the object to be identified; and extracting the edge contour of the part to be identified in the image of the object to be identified based on the mask image.

[0061] The mask image, also known as the mask template, is an image filter template used to detect the parts to be identified in an image of an object to be identified. It can block other parts of the image of the object to be identified and filter out the parts to be identified in the image.

[0062] Mask segmentation can separate the parts to be identified in an image of an object to be identified and generate a binary image to represent the position and shape of the parts to be identified.

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

[0064] In one embodiment, as shown in Figure 3, an image of the object to be identified with dimensions H×W×C is acquired. 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: F=CNN(I)

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

[0066] Skip connections are used to fuse feature maps of different scales to preserve detail. The fusion process can be represented as: F fused =F high +F low

[0067] Among them, F high and F low These are high-scale feature maps and low-scale feature maps, respectively.

[0068] Generating a mask image based on image features can be expressed as: M=σ(θ×F) fused +b)

[0069] Where M is the output mask image, θ is the weight matrix, b is the bias term, and σ is the activation function. Activation functions include Sigmoid or Softmax.

[0070] The mask image M has a size of H×W×1, representing the probability that each pixel belongs to the region to be identified.

[0071] 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 of the part to be identified in the image, so as to locate the position of the part to be identified in the image, thereby accurately extracting the edge contour of the part to be identified based on the mask image.

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

[0073] The identification result refers to the result indicating whether the part to be identified is a counterfeit part or a non-counterfeit part.

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

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

[0076] In one embodiment, a computer device acquires a pre-stored object image, which includes the region to be identified of the object to be identified. The computer device can extract image features from the pre-stored object image and extract the original edge contour of the region to be identified based on the image features. Based on the original edge contour and the original edge contour, the computer device performs forgery detection on the region to be identified in the object image to obtain a recognition result.

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

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

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

[0080] In this embodiment, when the part to be identified is a forged part, it indicates that the image to be identified is a forged image. When the part to be identified is not a forged part, it indicates that the image to be identified is not a forged image.

[0081] 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 edge contours of the parts to be identified based on the image features. Based on the edge contours, the image recognition model performs forgery detection on the parts to be identified in the image of the object to be identified, and obtains the recognition result.

[0082] 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 of 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.

[0083] 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 edge contour of the part to be identified based on these features. Edge contours reflect information such as the shape and size of the part to be identified. Since the same part can vary in shape and size across different objects, forgery detection is performed on the part to be identified within the image based on the edge contours. This allows for accurate identification of whether a part has been forged. Furthermore, this method eliminates strong reliance on other feature information of the part to be identified, achieving higher accuracy in forged image detection and improving the security of personal image information during the recognition process.

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

[0085] Based on the edge contour, the edge contour region of the part to be identified is segmented from the image of the object to be identified. The edge contour region contains the edge contour. Based on the edge contour region, the part to be identified in the image of the object to be identified is subjected to forgery detection to obtain the recognition result.

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

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

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

[0089] In one embodiment, the edge contour region includes an edge contour.

[0090] In one embodiment, the edge contour region may also include a portion of the part to be identified.

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

[0092] Furthermore, multi-scale contour region features can be extracted from the edge contour region, and based on the multi-scale contour region features, forgery detection can be performed on the part to be identified.

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

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

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

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

[0097] 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 similarity between preset contour regions and edge contour regions; based on feature similarity and similarity, perform forgery recognition on the parts to be recognized in the object image to be recognized, and obtain the recognition result.

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

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

[0100] In face-swapping recognition scenarios, the area to be identified can be a human face. Since the facial contour is directly adjacent to the background area, 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 the above, 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.

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

[0102] The edge contour of the region to be identified 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 region to be identified, or enlarging away from the interior of the region to be identified. Based on the scaled edge contour, the edge contour region corresponding to the region to be identified is segmented from the image of the object to be identified.

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

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

[0105] Furthermore, the edge contour is formed by connecting each pixel. The computer device can obtain preset scaling parameters and the position of each pixel in the 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.

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

[0107] The computer device segments the region including the edge contour and the scaled edge contour from the image of the object to be identified, based on the scaled edge contour, to obtain the edge contour region of the part to be identified.

[0108] In this embodiment, the computer device can segment the scaled edge contour and the area between the edge contours from the image of the object to be identified, thereby obtaining the edge contour area of ​​the part to be identified.

[0109] In this embodiment, the edge contour of the part to be identified is scaled to obtain a scaled edge contour. Based on the scaled edge contour, the region with the most obvious difference when the part to be identified is forged is segmented from the image of the object to be identified, and the edge contour region is obtained. This allows the edge contour region to be used to accurately identify whether the part to be identified has been forged.

[0110] In one embodiment, the scaled edge contour includes at least one of the inner edge contour or the outer edge contour of the part to be identified, and the edge contour region includes at least one of the following regions: the region between the edge contour and the inner edge contour, the region between the edge contour and the outer edge contour, and the region between the inner edge contour and the outer edge contour.

[0111] The inner edge contour is obtained by shrinking the edge contour towards the interior of the area to be identified. The outer edge contour is obtained by enlarging the edge contour away from the interior of the area to be identified. The direction away from the interior of the area to be identified is the direction of the exterior of the area to be identified.

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

[0113] In one embodiment, the computer device magnifies the edge contour in a direction away from the interior of the region to be identified, thereby obtaining the outer edge contour of the region to be identified. The area between the edge contour and the outer edge contour is defined as the edge contour region.

[0114] In one embodiment, the area between the inner edge contour and the outer edge contour is the edge contour area.

[0115] 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 on the 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 on the edge contour to obtain the magnified positions. The magnified positions are then concatenated to obtain the outer edge contour.

[0116] As shown in Figure 5, the edge contour A1 is magnified in the direction away from the interior of the part to be identified to obtain the outer edge contour A2. The area between A1 and A2 is the edge contour region.

[0117] Alternatively, as shown in Figure 6, the edge contour A1 can be reduced towards the interior of the area to be identified to obtain the inner edge contour A3. The area between A1 and A3 is the edge contour region.

[0118] Alternatively, the area between A2 and A3 is the edge contour area.

[0119] In this embodiment, shrinking the edge contour inwards towards the part to be identified yields the inner edge contour, while magnifying it outwards yields the outer edge contour. Using at least one of the following regions—the region between the shrunk and magnified edges, the region between the magnified and enlarged edges, or the region 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 part to be identified changes most significantly when forged; using the edge contour region accurately identifies whether the part has been forged. Moreover, using only the edge contour region for identification avoids directly using the feature information of the part to be identified, improving the security of user image information during the identification process.

[0120] In one embodiment, scaling the edge contour of the region to be identified to obtain a scaled edge contour includes:

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

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

[0123] 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 of the part to be identified.

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

[0125] Specifically, the computer device can determine each pixel that forms the edge contour 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 area to be identified in the image of the object to be identified, obtain the moved positions, and connect the moved positions to obtain the inner edge contour of the area to be identified.

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

[0127] In one embodiment, based on the scaled edge contour, the edge contour region of the area to be identified is segmented from the image of the object to be identified. This includes: moving each pixel of the edge contour a first number of pixels toward the interior of the area to be identified in the image of the object to be identified, to obtain an inner edge contour; and moving each pixel of the edge contour a second number of pixels away from the interior of the area to be identified in the image of the object to be identified, to obtain an outer edge contour. The region between the inner and outer edge contours in the image of the object to be identified is the edge contour region.

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

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

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

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

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

[0133] In this embodiment, a preset contour region of the part to be identified in the 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 part to be identified in the object image to obtain the identification result.

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

[0135] The identification results can be obtained by performing forgery identification on the parts to be identified in the image of the object to be identified based on at least one of contour similarity, inner contour similarity, outer contour similarity, or region similarity.

[0136] Specifically, the computer device can pre-store an image including the part to be identified of the object to be identified, 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 part to be identified in the pre-stored object image to obtain a preset inner edge contour of the part to be identified. Then, the original edge contour is expanded away from the interior of the part to be identified in the pre-stored object image to obtain a preset outer edge contour corresponding to the part to be identified. 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.

[0137] 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 regional similarity between the preset contour region and the edge contour region, and fuses the inner contour similarity, outer contour similarity, and regional similarity to obtain a total similarity score. When the similarity score reaches the preset similarity score, the part to be identified in the image is determined to be genuine. When the similarity score does not reach the preset similarity score, the part to be identified in the image is determined to be genuine.

[0138] In this embodiment, the weights of contour similarity, inner contour similarity, outer contour similarity and region similarity can be determined. The contour similarity, inner contour similarity, outer contour similarity and region similarity are then fused according to the weights to obtain the similarity between the preset contour region and the edge contour region.

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

[0140] 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 can make the calculated similarity more accurate, thereby enabling more accurate identification of whether the part to be identified is forged.

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

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

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

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

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

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

[0147] Furthermore, the weights of 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.

[0148] In this embodiment, first texture features and first color features of the edge contour region are extracted, and second texture features and second color features of the preset contour region are extracted. Texture features can reflect the texture of the part to be identified. 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 part to be identified in the object image to be identified is sufficiently similar to the texture of the part to be identified in the pre-stored object image.

[0149] Color features can reveal the color of the area to be identified. 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 area to be identified in the image is sufficiently similar to the color of the area to be identified 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 area to be identified in the image is forged.

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

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

[0152] Extract multi-scale first contour region features from the edge contour region; obtain the preset contour region of the part to be identified in the pre-stored object image, and extract multi-scale second contour region features from the preset contour region; for each scale in the multi-scale, determine the feature similarity between the first contour region features and the second contour region features of the target scale; based on the feature similarity of each scale, perform forgery recognition on the part to be identified in the object image to be identified, and obtain the recognition result.

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

[0154] 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 the preset contour region of the part to be identified in the pre-stored object image, and extracts multi-scale features from the preset contour region to obtain multi-scale second contour region features.

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

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

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

[0158] In this embodiment, the computer device can use the feature similarity at each scale to perform forgery detection on the part to be identified in the image of the object to be identified, and obtain the scale recognition result of the feature similarity at each scale. Based on the scale recognition result at each scale, the recognition result of the part to be identified 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 part to be identified 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 part to be identified is forged.

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

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

[0161] 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 parts to be identified in the image to be identified and the pre-stored image, and thus more accurately determine whether the parts to be identified in the image to be identified are forged.

[0162] In one embodiment, based on the feature similarity at each scale, forgery detection is performed on the region to be identified in the image of the object to be identified, and the identification result is obtained, including:

[0163] Based on the feature similarity of the target scale, forgery detection is performed on the part to be identified 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 part to be identified in the image of the object to be identified.

[0164] Specifically, the computer device performs forgery detection on the parts to be identified in the image of the object to be identified based on the feature similarity at the target scale, thereby obtaining the scale recognition result at the target scale, and thus obtaining the scale recognition result for 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 parts to be identified in the image of the object to be identified.

[0165] In this embodiment, based on the feature similarity of the target scale, the part to be identified in the image of the object to be identified is forged 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 part to be identified in the image of the object to be identified more accurate.

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

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

[0168] 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 part to be identified in the pre-stored object image. The feature similarity between the features of the part to be identified in the pre-stored object image and the features of the part to be identified is determined, and the target contour similarity between the edge contour and the original edge contour is determined. Based on the feature similarity and the target contour similarity, forgery detection is performed on the part to be identified in the object image to obtain the recognition result.

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

[0170] In one embodiment, the image of the object to be identified includes the target object to be identified, the parts to be identified include multiple parts of the target object, the edge contours include the edge contours of each of the multiple parts, the edge contour regions include the contour regions of each of the multiple parts, and the recognition results include the recognition results of each of the multiple parts.

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

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

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

[0174] As shown in Figure 8, the target object is the human face, and the facial features to be identified include the eyes, nose, mouth, and eyebrows. The computer device extracts features from the eyes, nose, mouth, and eyebrows. For example, an eye mask image is segmented based on the 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.

[0175] In this embodiment, the image to be identified includes the target object to be identified, the parts to be identified include multiple parts of the target object, the edge contours include the edge contours of each of the multiple parts, the edge contour regions include the contour regions of each of the multiple parts, and the identification results include the identification results of each of the multiple parts. This allows for the identification of whether each part is forged, effectively improving the accuracy of image recognition.

[0176] In one embodiment, as shown in FIG9, an image recognition model processing method is provided. Taking the application of this method to a computer device (the computer device is a terminal or server as shown in FIG1) as an example, the method includes the following steps:

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

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

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

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

[0181] 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 of the sample part in the sample object image; the predicted edge contour of the sample part is extracted based on the predicted mask image.

[0182] 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 of 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.

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

[0184] In one 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:

[0185] Based on the predicted edge contour, the predicted edge contour region of the sample part is segmented from the sample object image. The predicted edge contour region contains the predicted edge contour. Based on the predicted edge contour region, the sample part in the sample object image is subjected to forgery detection to obtain the prediction detection result.

[0186] In this embodiment, since the contour region of the sample area in the image directly borders the background region, modifying the contour of the sample area requires simultaneous modification of the background region, making face-swapping more difficult. Therefore, changes to the contour are generally ignored when forging sample areas in an image. Furthermore, the edge contour region is the area where texture and color information change most significantly when the sample area is forged. In this embodiment, the predicted edge contour region of the sample area is segmented from the sample object image based on the predicted edge contour, thereby obtaining a predicted edge contour region containing the predicted edge contour of the sample area. Forgery detection of the sample area is performed based on the predicted edge contour region, thus enabling accurate identification of whether the sample area has been forged. Moreover, it avoids directly using the feature information of the sample area, improving the security of personal image information during the identification process.

[0187] In one embodiment, segmenting the predicted edge contour region of a sample part from the sample object image based on the predicted edge contour includes: scaling the predicted edge contour of the sample part to obtain a scaled predicted edge contour, wherein the scaling operation includes at least one of the following operations: shrinking towards the interior of the sample part, or enlarging towards the exterior of the sample part; and segmenting the predicted edge contour region of the sample part from the sample object image based on the scaled predicted edge contour.

[0188] In this embodiment, the predicted edge contour of the sample part is scaled to obtain the scaled predicted edge contour. Based on the scaled predicted edge contour, the region with the most obvious difference when the sample part is forged is segmented from the sample object image to obtain the predicted edge contour region. This allows the predicted edge contour region to be used to accurately identify whether the sample part has been forged.

[0189] In one 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.

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

[0191] 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 of 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 of 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.

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

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

[0194] In one embodiment, determining the region similarity between the desired contour region and the predicted edge contour region includes:

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

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

[0197] Color features can reflect the color of a sample 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 sample color features, it is possible to determine whether the color of a sample area in the sample object image is sufficiently similar to the color of a sample area in the pre-stored object image. By fusing texture similarity and color similarity, the region similarity between the desired contour region and the predicted edge contour region is obtained. This allows both texture and color factors to be considered, thus enabling a more accurate determination of whether a sample area in the sample object image is forged.

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

[0199] In this embodiment, the computer device can fuse the feature similarity at each scale to obtain a fused similarity. Based on the fused similarity, it performs forgery detection on sample parts in the sample object image to obtain the detection result. For example, it determines whether the fused similarity reaches a similarity threshold. If it does, it means that the sample part in the sample object image is not forged; if it does not reach the similarity threshold, it means that the sample part is forged.

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

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

[0202] In this embodiment, based on the feature similarity of the target scale, forgery identification is performed on the sample parts in the sample object image to obtain the scale identification result of the target scale. The scale identification results of multiple scales are fused to make the identification result of the sample parts in the obtained sample object image more accurate.

[0203] Step S908: Obtain the expected recognition result of 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.

[0204] The expected recognition result of 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.

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

[0206] Specifically, the computer device acquires the expected recognition result of 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.

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

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

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

[0210] 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 x. i Where i represents the real identity. Then calculate x. i Recognition headers for each identity category j cosine similarity cosθ j Finally, the recognition loss generated by this image is calculated:

[0211] Where N represents the number of images in the current batch, n represents the total number of face identities, i represents the real identity, m is a hyperparameter set to further reduce the feature differences between faces with the same identity, and s is a hyperparameter set to further increase the feature differences between faces with different identities. It is x i The identification head y of its true category i The included angle.

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

[0213] 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 of 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.

[0214] 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:

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

[0216] In one embodiment, the desired edge contour region of 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.

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

[0218] The expected edge contour region is the true edge contour region of the sample object image, while the predicted edge contour region is the edge contour region determined by the model during training.

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

[0220] 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 true 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 of the negative sample image is the true edge contour region of the sample part in the negative sample image.

[0221] Specifically, the computer device can acquire the desired edge contour region of the sample object image and calculate the contour region difference between the predicted edge contour region and the desired edge contour region. The computer device can determine the recognition difference between the predicted recognition result and the desired 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.

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

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

[0224] In this embodiment, the desired edge contour region of 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.

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

[0226] Training process:

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

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

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

[0230] 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;

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

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

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

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

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

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

[0237] Using an image recognition model, the edge contour is reduced towards the interior of the part to be identified in the image to obtain the inner edge contour of the part to be identified; the edge contour is expanded away from the interior of the part to be identified in the image to obtain the outer edge contour of the part to be identified; the area between the inner edge contour and the outer edge contour is taken as the edge contour region.

[0238] Obtain the preset inner edge contour and preset outer edge contour of the part to be identified 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;

[0239] 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;

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

[0241] 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 parts to be identified in the image of the object to be identified, and the recognition result is obtained.

[0242] In this embodiment, during the training process, by combining mask segmentation and edge contour region prediction, refined learning of the structural features of sample parts is achieved. Furthermore, the dual supervision mechanism of contour region differences and recognition differences effectively enhances the model's ability to perceive forged features. This joint training strategy not only improves the model's accuracy in edge localization but also promotes the synergistic optimization between forged recognition features and structural features through multi-task learning. This results in a final image recognition model with stronger generalization and robustness, capable of more accurately separating target parts from complex backgrounds and capturing their true shape and texture patterns.

[0243] In application, this method constructs multi-layered contour regions by dynamically adjusting the inner and outer edge contours, and combines multi-scale texture and color feature similarity comparison to achieve detailed detection of forgery traces in the target area. This mechanism of dual verification of inner and outer contours and multi-feature fusion significantly improves the system's sensitivity to attacks such as local tampering, boundary forgery, and texture inconsistencies. At the same time, the comparison of pre-stored templates enhances the reliability of the judgment, enabling the method to effectively cope with interference such as changes in lighting and pose differences in real-world scenarios while maintaining high operating efficiency, ultimately outputting more accurate and stable forgery recognition results.

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

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

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

[0247] As shown in Figure 10, when user authentication is required, the user can upload a face image to be recognized via the terminal. This image can be captured by camera or selected from a local image. An image of the object to be recognized 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: F = CNN(I)

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

[0249] Skip connections are used to fuse feature maps of different scales to preserve detail. The fusion process can be represented as: F fused=F high +F low

[0250] Among them, F high and F low These are high-scale feature maps and low-scale feature maps, respectively.

[0251] The generation of a face mask image based on image features can be expressed as: M=σ(θ×F) fused +b)

[0252] Where M is the output face mask image, θ is the weight matrix, b is the bias term, and σ is the activation function. Activation functions can be, for example, Sigmoid or Softmax.

[0253] The mask image M has a size of H×W×1, representing the probability that each pixel belongs to the region to be identified.

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

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

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

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

[0258] When the region similarity reaches the similarity threshold, it indicates that the face image is not a face-swapped image, that is, the face image 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, that is, the face image is a fake image. In this case, the recognition result shown in Figure 11 will be displayed on the terminal interface: the face image is a face-swapped image.

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

[0260] 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 face images. The performance of traditional face recognition methods and the contour-based image recognition method of this embodiment in intercepting face-swapped images was compared, as shown in Figure 12. It can be seen that the interception rate of the edited image using the contour-based image recognition method in this embodiment is significantly improved compared to traditional face recognition methods.

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

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

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

[0264] In one embodiment, as shown in FIG13, an image recognition device 1300 is provided, including: an acquisition module 1302, an extraction module 1304, and a recognition module 1306, wherein:

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

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

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

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

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

[0270] 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 of the part to be identified in the image of the object to be identified;

[0271] The extraction module 1304 is also used to extract the edge contour of the part to be identified based on the mask image.

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

[0273] The region segmentation module is used to perform region segmentation processing based on edge contours to obtain the edge contour regions of the parts to be identified in the image of the object to be identified.

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

[0275] In one embodiment, the edge contour region includes an edge contour.

[0276] In one embodiment, the region segmentation module is further configured to scale the edge contour of the region to be identified to obtain the scaled edge contour. The scaling operation includes at least one of the following operations: a shrinking operation towards the interior of the region to be identified, or a magnification operation towards the exterior of the region to be identified. Based on the scaled edge contour, the edge contour region of the region to be identified is segmented from the image of the object to be identified.

[0277] In one embodiment, the scaled edge contour includes at least one of the inner edge contour or the outer edge contour of the part to be identified, and the edge contour region includes at least one of the following regions: the region between the edge contour and the inner edge contour, the region between the edge contour and the outer edge contour, and the region between the inner edge contour and the outer edge contour.

[0278] The inner edge contour is obtained by shrinking the edge contour towards the interior of the part to be identified, while the outer edge contour is obtained by enlarging the edge contour towards the interior of the part to be identified.

[0279] In one embodiment, the region segmentation module is further configured to determine the position of each pixel of the edge contour in the image of the object to be identified; move the position of each pixel toward the interior of the part to be identified in the image of the object to be identified by a first preset distance to obtain the inner edge contour of the part to be identified; move the position of each pixel toward the interior of the part to be identified in the image of the object to be identified by a second preset distance to obtain the outer edge contour of the part to be identified; 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 of the part to be identified.

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

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

[0282] In this embodiment, first texture features and first color features of the edge contour region are extracted, and second texture features and second color features of the preset contour region are extracted. Texture features can reflect the texture of the part to be identified. 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 part to be identified in the object image to be identified is sufficiently similar to the texture of the part to be identified in the pre-stored object image.

[0283] Color features can reveal the color of the area to be identified. 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 area to be identified in the image is sufficiently similar to the color of the area to be identified 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 area to be identified in the image is forged.

[0284] 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 part to be recognized 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 part to be recognized in the object image based on the feature similarity of each scale to obtain the recognition result.

[0285] 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 parts to be identified in the image to be identified and the pre-stored image can be determined more accurately. This allows for a more accurate determination of whether the parts to be identified in the image to be identified are forged.

[0286] In one embodiment, the recognition module 1306 is further configured to perform forgery recognition on the part to be recognized 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.

[0287] By fusing scale recognition results from multiple scales, the recognition result of the part to be identified in the image of the object to be identified is obtained.

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

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

[0290] In one embodiment, the recognition module 1306 is further configured to acquire preset image features and preset contour regions of a pre-stored object image, wherein the preset image features include image features of the part to be recognized 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 edge contour region; and perform forgery recognition on the part to be recognized in the object image based on the first similarity and the second similarity to obtain a recognition result.

[0291] In one embodiment, the image of the object to be identified includes the target object to be identified, the parts to be identified include multiple parts of the target object, the edge contours include the edge contours of each of the multiple parts, the edge contour regions include the contour regions of each of the multiple parts, and the recognition results include the recognition results of each of the multiple parts.

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

[0293] In one embodiment, as shown in FIG14, 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:

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

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

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

[0297] The training module 1408 is used to obtain the expected recognition result of 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.

[0298] 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 recognition, without needing to use the feature information of the sample part, improves the security of personal image information during the recognition process. The desired recognition result of the sample object image is obtained, and the model is trained based on the difference between the predicted recognition result and the desired recognition result. This allows the trained image recognition model to accurately identify whether a part has been forged based on its edge contours. Moreover, using an image recognition model to identify forged images effectively improves the accuracy and efficiency of image recognition.

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

[0300] The sample mask segmentation module is used to perform mask segmentation on the sample object image based on the features of the sample image to obtain the predicted mask image of the sample part in the sample object image;

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

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

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

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

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

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

[0307] 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 shown in Figure 15. 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 connected to the system bus via the input / output interface. The processor of the computer device provides computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used for exchanging information between the processor and external devices. The communication interface of the computer device 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 the computer program is executed by the processor, it 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.

[0308] Those skilled in the art will understand that the structure shown in Figure 15 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 may combine certain components, or may have different component arrangements.

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

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

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

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

[0313] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. 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.

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

[0315] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. 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 patent application should be determined by the appended claims.

Claims

1. An image recognition method, characterized in that, Performed by a computer device, 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, extract the edge contours of the regions to be identified in the image of the object to be identified; and Based on the edge contour, forgery detection is performed on the part to be identified in the image of the object to be identified, and the identification result is obtained.

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

3. The method of claim 2, wherein, The step of segmenting the edge contour region of the part to be identified from the image of the object to be identified based on the edge contour includes: The edge contour of the region to be identified is scaled to obtain a scaled edge contour. The scaling operation includes at least one of the following: a shrinking operation moving closer to the interior of the region to be identified, or a zooming operation moving away from the interior of the region to be identified; and Based on the scaled edge contour, the edge contour region of the part to be identified is segmented from the image of the object to be identified.

4. The method according to claim 3, characterized in that, The scaled edge contour includes at least one of the inner edge contour or the outer edge contour of the part to be identified, and the edge contour region includes at least one of the following regions: the region between the edge contour and the inner edge contour, the region between the 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 edge contour toward the interior of the part to be identified, and the outer edge contour is obtained by enlarging the edge contour toward the interior of the part to be identified.

5. The method of claim 4, wherein, The scaling operation on the edge contour of the region to be identified to obtain the scaled edge contour includes: Determine the position of each pixel of the 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 region to be identified in the image of the object to be identified, thereby obtaining the inner edge contour of the region to be identified. The positions of each pixel are moved a second preset distance away from the interior of the region to be identified in the image of the object to be identified, thereby obtaining the outer edge contour of the region to be identified; and The step of segmenting the edge contour region of the part to be identified 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 of the part to be identified.

6. The method according to any one of claims 2 to 5, characterized in that, The step of performing forgery detection on the part to be identified in the image of the object to be identified based on the edge contour region, and obtaining the identification result, includes: Obtain the preset contour region of the part to be identified in the pre-stored object image; Determine the similarity between the preset contour region and the edge contour region, wherein the 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 Based on the similarity, forgery detection is performed on the part to be identified in the image of the object to be identified, and the identification result is obtained.

7. The method of claim 6, wherein, 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.

8. The method according to any one of claims 2 to 7, characterized in that, The step of performing forgery detection on the part to be identified in the image of the object to be identified based on the edge contour region, and obtaining the identification result, includes: Extract multi-scale first contour region features from the edge contour region; Obtain the preset contour region of the part to be identified 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; and Based on the feature similarity at each scale, forgery detection is performed on the part to be identified in the image of the object to be identified, and the identification result is obtained.

9. The method of claim 8, wherein, The step of performing forgery detection on the part to be identified 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 at the target scale, forgery detection is performed on the region to be identified in the image of the object to be identified, thereby obtaining the scale recognition result at the target scale; and By fusing scale recognition results from multiple scales, the recognition result of the region to be recognized in the image of the object to be recognized is obtained.

10. The method according to any one of claims 1 to 9, characterized in that, The step of extracting the edge contour of the region to be identified in the image of the object to be identified based on the image features includes: Based on the image features, the image of the object to be identified is segmented using a mask to obtain a mask image of the region to be identified in the image of the object to be identified; and The edge contours of the parts to be identified in the image of the object to be identified are extracted based on the mask image.

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

12. The method according to any one of claims 1 to 11, characterized in that, The image of the object to be identified includes the object to be identified, the parts to be identified include multiple parts of the object to be identified, the edge contours include the edge contours of each of the multiple parts, and the identification result includes the identification result of each of the multiple parts.

13. An image recognition model processing method, comprising: Performed by a computer device, the method includes: Acquire 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 portion in the sample object image to obtain the predicted detection result; and Obtain the expected recognition result of the sample object image, and train the model based on the difference between the predicted recognition result and the expected recognition result to obtain an image recognition model.

14. The method of claim 13, wherein, The step of performing forgery detection on the sample portion in the sample object image based on the predicted edge contour to obtain the predicted detection result includes: Based on the predicted edge contour, a predicted edge contour region of the sample location is segmented from the sample object image, the predicted edge contour region including the predicted edge contour; and Based on the predicted edge contour region, forgery detection is performed on the sample part in the sample object image to obtain the prediction detection result.

15. The method of claim 14, wherein, The step of segmenting the predicted edge contour region of the sample part from the sample object image based on the predicted edge contour includes: The predicted edge contour of the sample region is scaled to obtain a scaled predicted edge contour; the scaling operation includes at least one of the following operations: shrinking towards the interior of the sample region, or enlarging away from the interior of the sample region; and Based on the scaled predicted edge contour, the predicted edge contour region of the sample part is segmented from the sample object image.

16. The method of claim 15, wherein, 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. The predicted inner edge contour is obtained by shrinking the predicted edge contour toward the interior of the sample region, and the predicted outer edge contour is obtained by enlarging the predicted edge contour toward the interior of the sample region.

17. The method of claim 13, wherein, 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 desired edge contour of the sample object image, and determine the contour difference between the predicted edge contour and the desired edge contour; Determine the recognition difference between the predicted recognition result and the expected recognition result; and Based on the contour differences and the recognition differences, a model is trained to obtain an image recognition model.

18. An image recognition apparatus characterized by comprising: 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 edge contours of the regions to be identified in the image of the object to be identified based on the image features; and The recognition module is used to perform forgery recognition on the part to be recognized in the image of the object to be recognized based on the edge contour, and obtain the recognition result.

19. An image recognition model processing apparatus, comprising: 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 portion in the sample object image based on the predicted edge contour, and obtain the predicted recognition result; and The training module is used to obtain the expected recognition result of 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 an image recognition model. 20.A computer device, comprising a memory and a processor, wherein the memory stores a computer program. When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 17.

21. A computer readable storage medium having stored thereon 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 17.

22. 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 17.