Virtual target identification method and device, electronic equipment and storage medium
Through feature extraction and pre-trained recognition model combined with comprehensive judgment of style difference, the problem of indistinguishability between virtual targets and real targets is solved, and the recognition accuracy and reliability are improved.
Patent Information
- Application Number
- CN202510185928.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-20
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2045-02-20
AI Technical Summary
The prior art is difficult to accurately identify virtual targets and real targets, resulting in a decrease in recognition accuracy.
By obtaining the sample image to be identified, performing feature extraction processing, constructing the data to be identified, and using the pre-trained target recognition model and style recognition model, combined with the style difference, comprehensive judgment is made to determine whether the target in the sample image is a virtual target.
It improves the accuracy and reliability of virtual target recognition, reduces misjudgment and misjudgment, and enhances the evaluation of image consistency and authenticity.
Smart Images

Figure CN119672444A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision technology, and in particular to a virtual target recognition method, device, electronic device and storage medium. Background Art
[0002] At present, with the development of deep learning technology, through training with large-scale data sets, the generation ability of the model is continuously optimized, so that the model can capture more detailed features about the real person image, such as facial contours, expression changes, skin color differences, etc. The model can better understand human language and visual information, thereby generating a more realistic virtual image that conforms to human aesthetics. The virtual image generated by the generative large model is getting closer and closer to the real person image in appearance. However, since the facial features or postures generated based on artificial intelligence can finely simulate the real target, the virtual image is visually difficult to distinguish from the real person image. As a result, users cannot distinguish between real targets (e.g., real human bodies, real animals, etc.) and virtual targets (e.g., virtual human bodies, virtual animals, etc.) in the image, which may lead to a decrease in the accuracy of identifying virtual targets. Summary of the invention
[0003] In view of the above, it is necessary to propose a virtual target recognition method, device, electronic device and storage medium to solve the technical problem of low accuracy in identifying virtual targets.
[0004] The present application provides a virtual target recognition method, which is applied to an electronic device, and the method includes: obtaining a sample image to be recognized; performing feature extraction processing on the sample image to obtain image features; constructing data to be recognized based on the image features; processing the data to be recognized based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image; processing image information of the target in the sample image and image information of a background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target; determining a style difference between the target and the sample image based on the first style recognition result and the second style recognition result; and determining recognition results of the sample image and the target based on the style difference and the target recognition result.
[0005] In some embodiments, the method also includes training the target recognition model, and the training of the target recognition model includes: constructing first training data based on a pre-stored training image; wherein the training image corresponds to first label data; determining a first confidence level of the corresponding first training data based on the first label data; the first confidence level is used to characterize the degree of credibility of the target corresponding to the training image; inputting the first training data into a pre-constructed first initial recognition model to obtain a first prediction result corresponding to the first training data; determining a first loss value of the first initial recognition model based on the first confidence level, the first prediction result and the first label data; updating the initial recognition model based on a back-propagation algorithm until the first loss value meets a preset condition, stopping updating the first initial recognition model, and obtaining a target recognition model trained to a convergence state.
[0006] In some embodiments, determining a first confidence level of the first training data corresponding to the first label data includes: ; Wherein, R represents the first confidence corresponding to the first training data; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first label data; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data; is the score of the facial features of the target with index i in the training image indicated by the first label data.
[0007] In some embodiments, determining the first loss value of the first initial recognition model according to the confidence, the first prediction result and the first label data includes: ; Wherein, Loss1 represents the first loss value of the initial recognition model; R represents the first confidence; e represents a natural constant; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image, is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data, is the score of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the score of the facial feature of the target with index i in the training image indicated by the first label data, is the score of the facial features of the target with index i in the training image indicated by the first prediction result.
[0008] In some embodiments, the method also includes training the style recognition model, and the training of the style recognition model includes: constructing second training data based on pre-stored training images; wherein the training images correspond to second label data; the second label data includes a first style vector and a second style vector; determining a second confidence level corresponding to the second training data based on the second label data; inputting the second training data into a pre-constructed second initial recognition model to obtain a second prediction result corresponding to the second training data; the second prediction result includes a first predicted style vector and a second predicted style vector; determining a second loss value of the second initial recognition model based on the second confidence level, the second prediction result and the second label data; updating the second initial recognition model based on a back-propagation algorithm until the second loss value meets a preset condition, stopping updating the initial recognition model, and obtaining a style recognition model trained to a convergence state.
[0009] In some embodiments, determining a second confidence level of the corresponding second training data according to the second label data includes: ; Wherein, S represents the second confidence corresponding to the second training data; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data; is the numerical value of the dimension indexed by x in the second style vector indicated by the second prediction result.
[0010] In some embodiments, determining the second loss value of the second initial recognition model according to the second confidence, the second prediction result and the second label data includes: ; Wherein, Loss2 represents the second loss value of the second initial recognition model; S represents the second confidence corresponding to the second training data; e represents a natural constant; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data, is the value of the dimension with index x in the first predicted style vector corresponding to the target with index z in the training image indicated by the second prediction result; is the value of the dimension indexed by x in the second style vector indicated by the second label data, is the numerical value of the dimension with index x in the second prediction style vector indicated by the second prediction result.
[0011] An embodiment of the present application also provides a virtual target recognition device, which includes: an acquisition module, used to acquire a sample image to be recognized; a feature extraction module, used to perform feature extraction processing on the sample image to obtain image features; a construction module, used to construct data to be recognized based on the image features; a first recognition module, used to process the data to be recognized based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image; a second recognition module, used to process the image information of the target in the sample image and the image information of the background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target; a determination module, used to determine the style difference between the target and the sample image based on the first style recognition result and the second style recognition result; the determination module is also used to determine the recognition results of the sample image and the target based on the style difference and the target recognition result.
[0012] An embodiment of the present application also provides an electronic device, which includes a processor and a memory, and the processor is used to implement the virtual target recognition method when executing a computer program stored in the memory.
[0013] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the virtual target identification method are implemented.
[0014] It can be seen from the above technical solutions that the embodiment of the present application accurately obtains the key features of the sample image through feature extraction, providing data support for subsequent target recognition and style recognition. The pre-trained target recognition model can accurately determine whether the target human body features in the sample image are reasonable, and can capture effective information of the target from deep image features. In the process of analyzing the style of the sample image, not only the overall style of the sample image is paid attention to, but also the style recognition of the target part in the image is particularly performed to ensure a comprehensive analysis of the image style. By comparing the difference between the target style and the overall style of the sample image, the consistency and authenticity of the image can be evaluated more carefully. Combining the target recognition results and the style difference, it is possible to comprehensively judge whether the target in the sample image is a virtual target. This multi-dimensional judgment method helps to reduce misjudgment and missed judgment, and improves the accuracy and reliability of the judgment. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 This is an application scenario diagram of a virtual target recognition method provided in one embodiment of the present application.
[0016] Figure 2This is a flowchart of a virtual target recognition method provided in one embodiment of the present application.
[0017] Figure 3 is a schematic diagram of a sample image provided by an embodiment of the present application.
[0018] Figure 4 It is a schematic diagram of a target provided by an embodiment of the present application.
[0019] Figure 5 It is a functional module diagram of a virtual target recognition device provided in one embodiment of the present application.
[0020] Figure 6 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] In order to more clearly understand the purpose, features and advantages of the present application, the present application is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other. In the following description, many specific details are set forth to facilitate a full understanding of the present application, and the embodiments described are only a part of the embodiments of the present application, rather than all of the embodiments.
[0022] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0023] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those generally understood by those skilled in the art to which the present application belongs. The terms used herein in the specification of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.
[0024] The embodiment of the present application provides a virtual target recognition method, which can be applied to one or more electronic devices. The electronic device is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a programmable gate array (Field-Programmable Gate Array, FPGA), a digital processor (Digital Signal Processor, DSP), an embedded device, etc.
[0025] An electronic device can be any electronic product that can interact with customers, such as personal computers, tablet computers, smart phones, personal digital assistants (PDAs), game consoles, Internet Protocol Television (IPTV), smart wearable devices, etc.
[0026] The electronic device may also include a network device and / or a client device, wherein the network device includes, but is not limited to, a single network server, a server group consisting of multiple network servers, or a cloud consisting of a large number of hosts or network servers based on cloud computing.
[0027] The networks where electronic devices are located include but are not limited to the Internet, wide area network, metropolitan area network, local area network, virtual private network (VPN), etc.
[0028] like Figure 1 As shown, a virtual target recognition method provided by the present application can be applied to an electronic device 100, and the electronic device 100 is communicatively connected to a server 200. The electronic device 100 is used to obtain a sample image to be recognized from the server 200. The electronic device 100 performs feature extraction processing on the sample image to obtain image features, and constructs data to be recognized based on the image features. The electronic device 100 also processes the data to be recognized based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image, and processes the image information of the target in the sample image and the image information of the background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target. The electronic device 100 also determines the style difference between the target and the sample image based on the first style recognition result and the second style recognition result, and determines the recognition results of the sample image and the target based on the style difference and the target recognition result.
[0029] like Figure 2 , which is a flow chart of a virtual target recognition method provided by an embodiment of the present application. According to different requirements, the order of the steps in the flow chart can be changed, and some steps can be omitted. A virtual target recognition method provided by an embodiment of the present application includes the following steps.
[0030] S20, obtaining a sample image to be identified.
[0031] In one embodiment of the present application, the sample image to be identified may be an image with a virtual target collected in real time by an electronic device. For example, the electronic device may read the sample image from a local file system, a network, a camera, or other image acquisition device. After acquiring the sample image, the sample image may also be preprocessed (e.g., scaling, cropping, denoising, etc.) to ensure that the image quality meets the requirements of subsequent processing. The preprocessed sample image is cached in a specified directory or database, and a corresponding index or metadata is established to facilitate subsequent retrieval and processing.
[0032] like Figure 3 The figure shows a schematic diagram of a sample image 300 provided by an embodiment of the present application. The sample image 300 includes a plurality of targets, for example, a target 310, a target 320, a target 330, a target 340, and a target 350. In order to determine whether the plurality of targets in the sample image are virtual targets generated based on artificial intelligence technology, feature extraction may be performed on the sample image to determine deep features in the sample image, and whether the target in the sample image is a virtual target generated based on artificial intelligence technology may be identified based on the deep features.
[0033] S21, performing feature extraction processing on the sample image to obtain image features.
[0034] In one embodiment of the present application, a pre-trained neural network model can be used as a feature extractor, and a sample image can be input into the feature extractor to obtain deep image features in the sample image. Exemplarily, the image features include edge features, texture features, shape features, semantic information features, etc. Exemplarily, the pre-trained neural network model can be a VGG network or a ResNet network, which is not limited in the present application.
[0035] S22, constructing data to be identified according to the image features.
[0036] In one embodiment of the present application, image features can be used to characterize deep information in a sample image. For example, the image features include the main content and objects in the sample image (for example, people, scenery, animals, etc.); for another example, the image features also include style information in the sample image, such as color, texture, lighting, etc., which can provide data support for subsequent style recognition of the sample image.
[0037] In one embodiment of the present application, information integration can be performed based on different types of information included in the image features, and the content and style information can be integrated into a comprehensive description of the sample image to facilitate subsequent processing and analysis. Exemplarily, the information representing the main content and object of the sample image in the image features can be a vector data, and the relevant data representing the style information of the sample image can also be a vector data. The data to be identified corresponding to the sample image can be obtained by splicing the two vector data.
[0038] S23, processing the data to be recognized based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image.
[0039] In one embodiment of the present application, the data to be identified includes a feature vector or an image block representing the deep information of the sample image. The input of the target recognition model is the data to be identified corresponding to the sample image, and the target recognition model is used to perform inference calculation based on the data to be identified to obtain information such as the position, category, attribute, etc. of the target in the sample image, as well as information such as the limbs, torso, and facial features of the target. For example, when the target in the sample image is a human body, the target recognition model is used to determine the position, category, attribute, and other information of the human body in the sample image according to the data to be identified, as well as information such as the pixels corresponding to the limbs of the human body, the pixels corresponding to the torso, and facial features. The output of the target recognition model is the target recognition result corresponding to the target in the sample image, wherein the target recognition result is used to characterize the reasonableness of the human body features in the sample image. For example, the target recognition result can be used to determine the reasonableness of the proportion of the human body according to the number of pixels in the limbs of the human body and the number of pixels in the torso, and the target recognition result can also be used to determine the reasonableness of the structure of the limbs according to the number of pixels in the limbs of the human body.
[0040] like Figure 4 The figure shows a schematic diagram of a target 400 in a sample image provided by an embodiment of the present application. The target 400 includes at least a facial region 410, a trunk region 420, a limb region 430 and a limb region 440. The limb region 430 can be used to characterize the arm region of the target 400, and the limb region 440 can be used to characterize the palm region of the target 400. The target recognition result can be used to characterize the reasonableness of the facial features of the target 400 according to the pixels in the facial region 410, and the target recognition result can also be used to determine the reasonableness of the proportion of the human body according to the number of pixels in the limb region 430 of the target 400 and the number of pixels in the trunk region 420, and the target recognition result can also be used to determine the reasonableness of the structure of the limb region according to the number of pixels in the limb region 440 of the human body.
[0041] In one embodiment of the present application, the target recognition model can be a pre-trained convolutional neural network model, a residual neural network model, or a fully connected neural network model, which is not limited in the present application.
[0042] In one embodiment of the present application, a method for training a target recognition model includes: constructing first training data according to a pre-stored training image; wherein the training image corresponds to first label data; determining a first confidence of the corresponding first training data according to the first label data; the first confidence is used to characterize the credibility of the target in the training image; inputting the first training data into a pre-constructed first initial recognition model to obtain a first prediction result corresponding to the first training data; determining a first loss value of the first initial recognition model according to the first confidence, the first prediction result and the first label data; updating the initial recognition model based on a back propagation algorithm until the first loss value meets a preset condition, stopping updating the first initial recognition model, and obtaining a target recognition model trained to a converged state. The preset condition may be that the first loss value is less than or equal to a preset first termination threshold. For example, when the preset first termination threshold is 0.1, when the first loss value is less than or equal to 0.1, it can be determined that the difference between the first prediction result output by the first initial recognition model and the first label data is small, and the accuracy of the first prediction result output by the first initial recognition model is high, then the first initial recognition model can be stopped to obtain a target recognition model trained to a converged state.
[0043] In one embodiment of the present application, the pre-stored training images may be a plurality of images containing human targets, and the first training data may be deep image features obtained after feature extraction of the training images. The first label data may be pre-labeled data, used to indicate the pixel points of the torso corresponding to the target in the training image, and also used to indicate the pixel points of the limb corresponding to the target in the training image, and also used to indicate the score of the limb area corresponding to the target in the training image, and also used to indicate the score of the facial area corresponding to the target in the training image. Among them, the score of the limb area is used to characterize the rationality of the structure of the limb area. For example, when the limb area is a hand area, if the hand area contains 4 fingers, the score of the limb area is low; the score of the facial area is used to characterize the rationality of the structure of the facial area. For example, when the distance between the two eyes in the facial area is large, the score of the facial area is low.
[0044] In one embodiment of the present application, in order to improve the accuracy of the training target recognition model, the first confidence corresponding to the first training data is further determined according to the first label data in the training image. Specifically, the calculation method of the first confidence satisfies the following relationship: ; Wherein, R represents the first confidence corresponding to the first training data; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first label data; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data; is the score of the facial features of the target with index i in the training image indicated by the first label data.
[0045] The lower the ratio between the number of pixels of the target's limbs and the number of pixels of the trunk, the greater the difference between the morphology of the target's limbs and trunk, and the lower the first confidence; the lower the score of the target's limbs, the lower the rationality of the structure of the limbs, and the lower the first confidence; the lower the score of the target's facial features, the lower the rationality of the target's facial features, and the lower the first confidence. In the case of a lower first confidence, it indicates that the credibility of the target in the training image is lower, and when the target recognition model is trained according to the training data corresponding to the training image, the credibility of the result is lower, and the loss value of the target recognition model is also greater.
[0046] In an embodiment of the present application, determining the first loss value of the first initial recognition model according to the confidence, the first prediction result and the first label data includes: ; Wherein, Loss1 represents the first loss value of the initial recognition model; R represents the first confidence; e represents a natural constant; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image, is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data, is the score of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the score of the facial feature of the target with index i in the training image indicated by the first label data, is the score of the facial features of the target with index i in the training image indicated by the first prediction result. The higher the first loss value, the higher the difference between the first prediction result identified by the first initial recognition model and the first label data, indicating that the accuracy of the first initial recognition model is low; the lower the first loss value, the lower the difference between the first prediction result identified by the first initial recognition model and the first label data, indicating that the accuracy of the first initial recognition model is high.
[0047] S24, processing the image information of the target in the sample image and the image information of the background area in the sample image based on the pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target.
[0048] In one embodiment of the present application, a sample image is processed using a pre-trained style recognition model, and the sample image is divided into a target part and a background part so as to perform style recognition respectively. The image information of the target part and the image information related to the background part are input into the style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target. The first style recognition result of the sample image is used to characterize the style information of the target corresponding to the sample image, and the second style recognition result is used to characterize the style information corresponding to the background part of the sample image.
[0049] In one embodiment of the present application, the style recognition model can be a pre-trained convolutional neural network model, a residual neural network model, or a fully connected neural network model, which is not limited in the present application.
[0050] In one embodiment of the present application, a method for training a style recognition model includes: constructing second training data according to a pre-stored training image; wherein the training image corresponds to second label data; the second label data includes a first style vector and a second style vector; determining a second confidence of the corresponding second training data according to the second label data; inputting the second training data into a pre-constructed second initial recognition model to obtain a second prediction result corresponding to the second training data; the second prediction result includes a first prediction style vector and a second prediction style vector; determining a second loss value of the second initial recognition model according to the second confidence, the second prediction result and the second label data; updating the second initial recognition model based on a back propagation algorithm until the second loss value meets a preset condition, stopping updating the initial recognition model, and obtaining a style recognition model trained to a convergent state. The higher the second loss value, the higher the difference between the second prediction result identified by the second initial recognition model and the second label data, indicating that the accuracy of the second initial recognition model is low; the lower the second loss value, the lower the difference between the second prediction result identified by the second initial recognition model and the second label data, indicating that the accuracy of the second initial recognition model is high. The preset condition may be that the second loss value is less than or equal to a preset second termination threshold. For example, when the preset second termination threshold is 0.01, when the second loss value is less than or equal to 0.01, it can be determined that the difference between the second prediction result output by the second initial recognition model and the second label data is small, and the accuracy of the second prediction result output by the second initial recognition model is high. Then, the updating of the second initial recognition model can be stopped to obtain a style recognition model trained to a convergent state.
[0051] In one embodiment of the present application, in order to improve the accuracy of the training style recognition model, the second confidence of the corresponding second training data is further determined according to the second label data. Specifically, the calculation method of the second confidence satisfies the following relationship: ; Wherein, S represents the second confidence corresponding to the second training data; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data; is the numerical value of the dimension indexed by x in the second style vector indicated by the second prediction result.
[0052] Among them, in the second label data, when the similarity between the first style vector and the second style vector is lower, it means that the difference between the style of the target and the style of the background part in the training image is greater, and the second confidence is lower. Therefore, when the style recognition model is trained according to the training data corresponding to the training image, the lower the credibility of the result obtained, the greater the loss value of the style recognition model.
[0053] In an embodiment of the present application, determining the second loss value of the second initial recognition model according to the second confidence, the second prediction result and the second label data includes: ; Wherein, Loss2 represents the second loss value of the second initial recognition model; S represents the second confidence corresponding to the second training data; e represents a natural constant; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data, is the value of the dimension with index x in the first predicted style vector corresponding to the target with index z in the training image indicated by the second prediction result; is the value of the dimension indexed by x in the second style vector indicated by the second label data, is the numerical value of the dimension with index x in the second prediction style vector indicated by the second prediction result.
[0054] S25: Determine the style difference between the target and the sample image according to the first style recognition result and the second style recognition result.
[0055] In one embodiment of the present application, the first style recognition result and the second style recognition result may be compared to determine the differences in color features, texture features, illumination features, etc. in the sample image. Specifically, the style difference between the first style recognition result and the second style recognition result may be determined based on cosine similarity, and the style difference may also be determined based on KL divergence between the first style recognition result and the second style recognition result. The present application does not limit the specific calculation method of the style difference. Specifically, the difference between the style of the target and the overall style of the sample image may be evaluated based on the style difference. When the style difference is higher, it indicates that the degree of difference between the style of the target and the overall style of the sample image is higher, and the possibility that the target is a virtual target generated by artificial skill technology is greater; when the style difference is lower, it indicates that the degree of difference between the style of the target and the overall style of the sample image is lower, and the possibility that the target is a virtual target generated by artificial skill technology is lower.
[0056] S26, determining the recognition result of the sample image and the target according to the style difference and the target recognition result.
[0057] In one embodiment of the present application, it can be determined whether the target in the sample image to be identified is a virtual target generated based on artificial intelligence based on the style difference and the target recognition result. Specifically, the style difference and the target recognition result can be combined and compared with a preset empirical threshold. If the style difference and the target recognition result exceed the preset empirical threshold, it indicates that the style difference is large and the human body features are unreasonable, indicating that the target in the sample image is a virtual target generated based on artificial intelligence.
[0058] It can be seen from the above technical solutions that the embodiment of the present application accurately obtains the key features of the sample image through feature extraction, providing data support for subsequent target recognition and style recognition. The pre-trained target recognition model can accurately determine whether the target human body features in the sample image are reasonable, and can capture effective information of the target from deep image features. In the process of analyzing the style of the sample image, not only the overall style of the sample image is paid attention to, but also the style recognition of the target part in the image is particularly performed to ensure a comprehensive analysis of the image style. By comparing the difference between the target style and the overall style of the sample image, the consistency and authenticity of the image can be evaluated more carefully. Combining the target recognition results and the style difference, it is possible to comprehensively judge whether the target in the sample image is a virtual target. This multi-dimensional judgment method helps to reduce misjudgment and missed judgment, and improves the accuracy and reliability of the judgment.
[0059] See also Figure 5 , Figure 51 is a functional module diagram of a virtual target recognition device provided by an embodiment of the present application. A virtual target recognition device 51 includes an acquisition module 510, a feature extraction module 520, a construction module 530, a first recognition module 540, a second recognition module 550 and a determination module 560. The module / unit referred to in the present application refers to a series of computer-readable instruction segments that can be executed by the processor 13 and can complete fixed functions, which are stored in the memory 12. In this embodiment, the functions of each module / unit will be described in detail in subsequent embodiments.
[0060] The acquisition module 510 is used to acquire a sample image to be identified.
[0061] The feature extraction module 520 is used to perform feature extraction processing on the sample image to obtain image features.
[0062] The construction module 530 is used to construct the data to be identified according to the image features.
[0063] The first recognition module 540 is used to process the data to be recognized based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image.
[0064] The second recognition module 550 is used to process the image information of the target in the sample image and the image information of the background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target.
[0065] The determination module 560 is used to determine the style difference between the target and the sample image according to the first style recognition result and the second style recognition result.
[0066] The determination module 560 is further configured to determine the recognition result of the sample image and the target according to the style difference and the target recognition result.
[0067] In some embodiments, the first recognition module 540 is also used to construct first training data based on pre-stored training images; wherein the training images correspond to first label data; determine a first confidence level of the corresponding first training data based on the first label data; the first confidence level is used to characterize the degree of credibility of the target corresponding to the training image; input the first training data into a pre-constructed first initial recognition model to obtain a first prediction result corresponding to the first training data; determine a first loss value of the first initial recognition model based on the first confidence level, the first prediction result and the first label data; update the initial recognition model based on a back-propagation algorithm until the first loss value meets a preset condition, stop updating the first initial recognition model, and obtain a target recognition model trained to a convergence state.
[0068] In some embodiments, the first recognition module 540 is further configured to determine, according to the first label data, a first confidence level of the corresponding first training data, including: ; Wherein, R represents the first confidence corresponding to the first training data; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first label data; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data; is the score of the facial features of the target with index i in the training image indicated by the first label data.
[0069] In some embodiments, the first recognition module 540 is further configured to determine the first loss value of the first initial recognition model according to the confidence, the first prediction result and the first label data, including: ; Wherein, Loss1 represents the first loss value of the initial recognition model; R represents the first confidence; e represents a natural constant; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image, is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data, is the score of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the score of the facial feature of the target with index i in the training image indicated by the first label data, is the score of the facial features of the target with index i in the training image indicated by the first prediction result.
[0070] In some embodiments, the second recognition module 550 is also used to construct second training data based on pre-stored training images; wherein the training images correspond to second label data; the second label data includes a first style vector and a second style vector; a second confidence level of the corresponding second training data is determined based on the second label data; the second training data is input into a pre-constructed second initial recognition model to obtain a second prediction result corresponding to the second training data; the second prediction result includes a first predicted style vector and a second predicted style vector; a second loss value of the second initial recognition model is determined based on the second confidence level, the second prediction result and the second label data; the second initial recognition model is updated based on the back-propagation algorithm until the second loss value meets a preset condition, and the initial recognition model is stopped from being updated to obtain a style recognition model trained to a convergence state.
[0071] In some embodiments, the second recognition module 550 is further configured to determine the second confidence level of the corresponding second training data according to the second label data, including: ; Wherein, S represents the second confidence corresponding to the second training data; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data; is the numerical value of the dimension indexed by x in the second style vector indicated by the second prediction result.
[0072] In some embodiments, the second recognition module 550 is further configured to determine the second loss value of the second initial recognition model according to the second confidence, the second prediction result and the second label data, including: ; Wherein, Loss2 represents the second loss value of the second initial recognition model; S represents the second confidence corresponding to the second training data; e represents a natural constant; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data, is the value of the dimension with index x in the first predicted style vector corresponding to the target with index z in the training image indicated by the second prediction result; is the value of the dimension indexed by x in the second style vector indicated by the second label data, is the numerical value of the dimension with index x in the second prediction style vector indicated by the second prediction result.
[0073] See also Figure 6 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 100 includes a memory 12 and a processor 13. The memory 12 is used to store computer-readable instructions, and the processor 13 is used to execute the computer-readable instructions stored in the memory to implement a virtual target recognition method described in any of the above embodiments.
[0074] In an embodiment of the present application, the electronic device 100 further includes a bus, a computer program stored in the memory 12 and executable on the processor 13, such as a virtual target recognition program.
[0075] Figure 6 Only the electronic device 100 having the memory 12 and the processor 13 is shown, and those skilled in the art can understand that Figure 6 The structure shown does not constitute a limitation on the electronic device 100 , and the electronic device 100 may include fewer or more components than shown in the figure, or combine some components, or arrange the components differently.
[0076] Combination Figure 2The memory 12 in the electronic device 100 stores a plurality of computer-readable instructions to implement a virtual target recognition method, and the processor 13 can execute the plurality of instructions to implement: obtaining a sample image to be recognized; performing feature extraction processing on the sample image to obtain image features; constructing data to be recognized based on the image features; processing the data to be recognized based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image; processing the image information of the target in the sample image and the image information of the background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target; determining a style difference between the target and the sample image based on the first style recognition result and the second style recognition result; determining recognition results of the sample image and the target based on the style difference and the target recognition result.
[0077] Specifically, the specific implementation method of the processor 13 for the above instructions can refer to Figure 2 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0078] Those skilled in the art will appreciate that the schematic diagram is merely an example of the electronic device 100 and does not constitute a limitation on the electronic device 100. The electronic device 100 may be a bus-type structure or a star-type structure. The electronic device 100 may also include more or less other hardware or software than shown in the diagram, or a different arrangement of components. For example, the electronic device 100 may also include input and output devices, network access devices, etc.
[0079] It should be noted that the electronic device 100 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.
[0080] Among them, the memory 12 includes at least one type of readable storage medium, and the readable storage medium can be non-volatile or volatile. The readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 12 can be an internal storage unit of the electronic device 100, such as a mobile hard disk of the electronic device 100. In other embodiments, the memory 12 can also be an external storage device of the electronic device 100, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. equipped on the electronic device 100. The memory 12 can not only be used to store application software and various types of data installed in the electronic device 100, such as a code of a virtual target recognition program, etc., but also can be used to temporarily store data that has been output or is to be output.
[0081] In some embodiments, the processor 13 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 13 is the control core (Control Unit) of the electronic device 100, and uses various interfaces and lines to connect various components of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing programs or modules stored in the memory 12 (for example, executing a virtual target recognition program, etc.), and calling data stored in the memory 12.
[0082] The processor 13 executes the operating system of the electronic device 100 and various installed applications. The processor 13 executes the applications to implement the steps in each of the above-mentioned virtual target recognition method embodiments, for example Figure 2 Steps shown.
[0083] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 12 and executed by the processor 13 to complete the present application. The one or more modules / units may be a series of computer-readable instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the electronic device 100. For example, the computer program may be divided into an acquisition module 510, a feature extraction module 520, a construction module 530, a first recognition module 540, a second recognition module 550, and a determination module 560.
[0084] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, and includes a number of instructions for enabling a computer device (which can be a personal computer, a computer device, or a network device, etc.) or a processor to execute a part of a virtual target recognition method described in each embodiment of the present application.
[0085] If the module / unit integrated in the electronic device 100 is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also instruct the relevant hardware devices to complete through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented.
[0086] The computer program includes computer program code, which may be in source code form, object code form, executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory and other memory, etc.
[0087] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0088] The bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. Figure 6 Only one arrow is used in the figure, but it does not mean that there is only one bus or one type of bus. The bus is configured to realize the connection and communication between the memory 12 and at least one processor 13, etc.
[0089] An embodiment of the present application also provides a computer-readable storage medium (not shown), in which computer-readable storage medium is stored computer-readable instructions, and the computer-readable instructions are executed by a processor in an electronic device to implement a virtual target recognition method described in any of the above embodiments.
[0090] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0091] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0092] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0093] In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the specification can also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any specific order.
[0094] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present application and are not intended to limit it. Although the present application has been described in detail with reference to the preferred embodiments, a person of ordinary skill in the art should understand that the technical solution of the present application may be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present application.
Claims
1. A virtual target recognition method, applied to electronic equipment, characterized in that: The method comprises: Obtaining a sample image to be identified; Performing feature extraction processing on the sample image to obtain image features; Constructing data to be identified according to the image features; Processing the to-be-recognized data based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image; Processing image information of the target in the sample image and image information of a background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target; Determining a style difference between the target and the sample image according to the first style recognition result and the second style recognition result; The recognition result of the sample image and the target is determined according to the style difference and the target recognition result.
2. The virtual target recognition method according to claim 1, characterized in that: The method further includes training the target recognition model, wherein the training the target recognition model includes: Constructing first training data according to pre-stored training images; wherein the training images correspond to first label data; Determine a first confidence level of the first training data corresponding to the first label data according to the first label data; the first confidence level is used to characterize the credibility of the target in the training image; Inputting the first training data into a pre-built first initial recognition model to obtain a first prediction result corresponding to the first training data; Determine a first loss value of the first initial recognition model according to the first confidence, the first prediction result and the first label data; The initial recognition model is updated based on a back propagation algorithm until the first loss value meets a preset condition, and then the updating of the first initial recognition model is stopped to obtain a target recognition model trained to a convergent state.
3. The virtual target recognition method according to claim 2, characterized in that: Determining the first confidence level of the first training data corresponding to the first label data includes: ; Wherein, R represents the first confidence corresponding to the first training data; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first label data; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data; is the score of the facial features of the target with index i in the training image indicated by the first label data.
4. The virtual target recognition method according to claim 2, characterized in that: The determining the first loss value of the first initial recognition model according to the confidence, the first prediction result and the first label data comprises: ; Wherein, Loss1 represents the first loss value of the initial recognition model; R represents the first confidence; e represents a natural constant; i is the index of the target in the training image indicated by the first label data, and m is the number of targets in the training image indicated by the first label data; j is the index of the limb part of the target indicated by the first label data, and n is the number of limb parts of the target indicated by the first label data; is the number of pixels of the limb part with index j in the target with index i in the training image, is the number of pixels of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the number of pixels in the torso of the target with index i in the training image; is the score of the limb part with index j in the target with index i in the training image indicated by the first label data, is the score of the limb part with index j in the target with index i in the training image indicated by the first prediction result; is the score of the facial feature of the target with index i in the training image indicated by the first label data, is the score of the facial features of the target with index i in the training image indicated by the first prediction result.
5. The virtual target recognition method according to claim 1, characterized in that: The method further includes training the style recognition model, wherein the training the style recognition model includes: Constructing second training data according to a pre-stored training image; wherein the training image corresponds to second label data; and the second label data includes a first style vector and a second style vector; Determine a second confidence level of the corresponding second training data according to the second label data; Inputting the second training data into a pre-built second initial recognition model to obtain a second prediction result corresponding to the second training data; the second prediction result includes a first prediction style vector and a second prediction style vector; Determine a second loss value of the second initial recognition model according to the second confidence, the second prediction result and the second label data; The second initial recognition model is updated based on the back propagation algorithm until the second loss value meets a preset condition, and then the updating of the initial recognition model is stopped to obtain a style recognition model trained to a convergent state.
6. The virtual target recognition method according to claim 5, characterized in that: Determining the second confidence level of the corresponding second training data according to the second label data includes: ; Wherein, S represents the second confidence corresponding to the second training data; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data; is the numerical value of the dimension indexed by x in the second style vector indicated by the second prediction result.
7. The virtual target recognition method according to claim 5, characterized in that: The determining the second loss value of the second initial recognition model according to the second confidence, the second prediction result and the second label data comprises: ; Wherein, Loss2 represents the second loss value of the second initial recognition model; S represents the second confidence corresponding to the second training data; e represents a natural constant; z is the index of the target in the training image indicated by the second label data, and v is the number of targets in the training image indicated by the second label data; x is the index of the dimension in the first style vector indicated by the second label data, and y is the number of dimensions in the first style vector indicated by the second label data; is the value of the dimension with index x in the first style vector corresponding to the target with index z in the training image indicated by the second label data, is the value of the dimension with index x in the first predicted style vector corresponding to the target with index z in the training image indicated by the second prediction result; is the value of the dimension indexed by x in the second style vector indicated by the second label data, is the numerical value of the dimension with index x in the second prediction style vector indicated by the second prediction result.
8. A virtual target recognition device, characterized in that: The device comprises a module for implementing the virtual target recognition method according to any one of claims 1 to 7, and the device comprises: An acquisition module, used for acquiring a sample image to be identified; A feature extraction module, used to perform feature extraction processing on the sample image to obtain image features; A construction module, used to construct the data to be identified according to the image features; A first recognition module, used for processing the to-be-recognized data based on a pre-trained target recognition model to obtain a target recognition result of the target in the sample image; A second recognition module, used for processing the image information of the target in the sample image and the image information of the background area in the sample image based on a pre-trained style recognition model to obtain a first style recognition result of the sample image and a second style recognition result of the target; A determination module, configured to determine a style difference between the target and the sample image according to the first style recognition result and the second style recognition result; The determination module is further configured to determine the sample image and the recognition result of the target according to the style difference and the target recognition result.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, and the processor is used to implement the virtual target recognition method as claimed in any one of claims 1 to 7 when executing a computer program stored in the memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the virtual target recognition method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Portrait style recognition method and device and computer readable storage medium
CN110555481A
Method for detecting photo compliance
CN110888998A
Synthetic image recognition method and device and image recognition model training method and device
CN114820467A
Image authentication method and device and electronic equipment
CN117523372A
System for training embedding network
US11823488B1