Method for generating fake product sample image, related device and storage medium
By generating new fake product sample images through inverse differentiation and gradient value adjustment of fake product sample images, the problem of insufficient number of fake product samples is solved, and the recognition accuracy of the product authenticity identification model is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING REALAI TECH CO LTD
- Filing Date
- 2022-06-29
- Publication Date
- 2026-06-23
Smart Images

Figure CN116703808B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, related apparatus and storage medium for generating fake product sample images. Background Technology
[0002] With economic development, people can buy all kinds of goods in the market. However, some criminals counterfeit goods for profit, and the flow of counterfeit goods into the market will harm the interests of buyers.
[0003] Counterfeit goods have subtle differences in appearance from genuine goods. Therefore, a product authenticity identification network model can be provided to offer buyers or law enforcement personnel a means of distinguishing between genuine and counterfeit goods. However, due to the relatively small number of fake samples, the accuracy of the product authenticity identification network model is low, and sometimes it may identify counterfeit goods as genuine goods.
[0004] To solve the above problems, the most direct method is to increase the number of counterfeit product samples, thereby further training the model for identifying genuine and counterfeit products and improving the accuracy of the model's identification. However, in reality, counterfeit product samples can only be obtained by seizing counterfeit products, and the number of counterfeit product samples is very small. Summary of the Invention
[0005] This application provides a method, related apparatus, and storage medium for generating fake product sample images, which can increase the number of fake product samples.
[0006] In a first aspect, embodiments of this application provide a method for generating fake product sample images, comprising:
[0007] The existing target fake product sample image is input into the preset product authenticity recognition network model for inverse differentiation to obtain the gradient value of each pixel in the target fake product sample image;
[0008] Target pixels are determined from the target fake product sample image, wherein the target pixels are pixels whose absolute gradient value is greater than a first threshold;
[0009] In the target fake product sample image, the pixel value of the target pixel is adjusted according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image;
[0010] The candidate fake product sample image is input into the product authenticity recognition network model for authenticity recognition processing to obtain the recognition result;
[0011] If the identification result is a fake product, the candidate fake product sample image is used as the target fake product sample image until the identification result is a real product, then the candidate fake product sample image is determined as a new fake product sample image.
[0012] If the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
[0013] In some embodiments, the step of inputting an existing target fake product sample image into a preset product authenticity recognition network model for backpropagation to obtain the gradient value of each pixel in the target fake product sample image includes:
[0014] Obtain the image of the target fake product sample;
[0015] Determine the target region image of the target fake product sample image;
[0016] The target region image is input into the genuine / fake product identification network model for inverse differentiation to obtain the gradient value of each pixel in the target region image.
[0017] Secondly, embodiments of this application also provide a device for generating fake product sample images, which includes an input / output unit and a processing unit:
[0018] The input / output unit is used to input the existing target fake product sample image into the preset product authenticity recognition network model and perform inverse differentiation through the processing unit to obtain the gradient value of each pixel in the target fake product sample image.
[0019] The processing unit is further configured to determine target pixels from the target fake product sample image, wherein the target pixels are pixels whose absolute gradient values are greater than a first threshold; and to adjust the pixel values of the target pixels in the target fake product sample image according to a second threshold and the gradient values corresponding to the target pixels to obtain candidate fake product sample images.
[0020] The input / output unit is also used to input the candidate fake product sample image into the real and fake product identification network model and perform real and fake product identification processing through the processing unit to obtain the identification result;
[0021] The processing unit is further configured to, if the identification result is a fake product, use the candidate fake product sample image as the target fake product sample image until the identification result is a genuine product, then determine the candidate fake product sample image as a new fake product sample image; if the identification result is a genuine product, then determine the candidate fake product sample image as a new fake product sample image.
[0022] In some embodiments, when implementing the step of adjusting the pixel value of the target pixel based on the second threshold and the gradient value corresponding to the target pixel, the processing unit is specifically used for:
[0023] If the absolute value of the gradient value corresponding to the target pixel is greater than or equal to the second threshold, then the pixel value of the target pixel is adjusted according to the second threshold;
[0024] If the absolute value of the gradient value corresponding to the target pixel is less than the second threshold, then the pixel value of the target pixel is adjusted according to the gradient value corresponding to the target pixel.
[0025] In some embodiments, when implementing the step of determining target pixels from the target fake product sample image, the processing unit is specifically used for:
[0026] The pixel whose absolute value of the gradient value is greater than the first threshold is determined as the center pixel.
[0027] The pixels within a preset area centered on the central pixel are determined as the target pixels.
[0028] In some embodiments, when the input / output unit implements the step of inputting the existing target fake product sample image into the preset product authenticity recognition network model and performing inverse differentiation through the processing unit, it is specifically used for:
[0029] The target fake product sample image is input into the product authenticity recognition network model, and the processing unit performs inverse differentiation to obtain the first pixel value of each pixel when the target fake product sample image is converted into a real product sample image; the processing unit obtains the second pixel value of each pixel in the target fake product sample image; the difference between the first pixel value and the second pixel value is determined as the gradient value.
[0030] In some embodiments, after performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit is further configured to:
[0031] Adjust the first threshold according to the first threshold set, and return to the step of determining the target pixel from the target fake product sample image.
[0032] In some embodiments, after performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit is further configured to:
[0033] Adjust the second threshold according to the preset second threshold set, and return to the step of adjusting the pixel value of the target pixel in the target fake product sample image according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image.
[0034] In some embodiments, after performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit is further configured to:
[0035] Add fake product tags to the new fake product sample images;
[0036] The network model for identifying genuine and counterfeit goods is trained based on the new counterfeit product sample images.
[0037] Thirdly, embodiments of this application also provide a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the above-described method.
[0038] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, the computer program including program instructions that, when executed by a processor, can implement the above-described method.
[0039] This application provides a method, apparatus, computer device, and storage medium for generating fake product sample images. The method includes: first, inputting an existing target fake product sample image into a preset product authenticity recognition network model for backpropagation to obtain the gradient value of each pixel in the target fake product sample image; then, determining target pixels from the target fake product sample image, wherein the target pixel is a pixel whose absolute gradient value is greater than a first threshold; next, adjusting the pixel value of the target pixel in the target fake product sample image according to a second threshold and the gradient value corresponding to the target pixel to obtain a candidate fake product sample image; inputting the candidate fake product sample image into the product authenticity recognition network model for authenticity recognition processing to obtain a recognition result; if the recognition result is a fake product, then using the candidate fake product sample image as the target fake product sample image, until the recognition result is a genuine product, then determining the candidate fake product sample image as a new fake product sample image; if the recognition result is a genuine product, then determining the candidate fake product sample image as a new fake product sample image. This application embodiment can generate new fake product sample images based on existing fake product sample images, thereby increasing the number of fake product samples. Attached Figure Description
[0040] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a schematic diagram illustrating an application scenario of the method for generating fake product sample images provided in the embodiments of this application;
[0042] Figure 2 A flowchart illustrating the method for generating fake product sample images provided in this application embodiment;
[0043] Figure 3 A schematic diagram of a sub-process of the method for generating fake product sample images provided in the embodiments of this application;
[0044] Figure 4 A schematic diagram of a target region image in a target fake product sample image provided for embodiments of this application;
[0045] Figure 5 A scenario flow entity diagram for a method of generating fake product sample images provided in this application embodiment;
[0046] Figure 6 A flowchart illustrating a method for generating fake product sample images according to another embodiment of this application;
[0047] Figure 7 A schematic block diagram of a device for generating fake product sample images provided in the embodiments of this application;
[0048] Figure 8 This is a schematic diagram of the physical device implementing the method for generating fake product sample images in the embodiments of this application;
[0049] Figure 9 This is a schematic diagram of the structure of a mobile phone implementing the method for generating fake product sample images in this application embodiment;
[0050] Figure 10 This is a schematic diagram of the structure of a server implementing the method for generating fake product sample images in this application embodiment. Detailed Implementation
[0051] 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, 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.
[0052] It should be understood that, when used in this specification and the appended claims, the terms "comprising" and "including" indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0053] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0054] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0055] This application provides a method, related apparatus, and storage medium for generating fake product sample images. This solution can be used in scenarios involving the identification of genuine and counterfeit products, such as the identification of genuine and counterfeit cigarettes. In one embodiment, specifically, after obtaining a new fake cigarette sample image using the fake product sample image generation method, the new fake cigarette sample image is used to further train a product authenticity identification network model. Then, software containing the product authenticity identification network model is installed on a mobile phone. When a user needs to identify the authenticity of the obtained cigarette, they can first take a picture of the cigarette using the software to obtain an image of the cigarette, and then use the product authenticity identification network model in the software to identify the cigarette based on the image, obtaining the identification result.
[0056] The execution subject of the fake product sample image generation method can be the fake product sample image generation device provided in the embodiments of this application, or a computer device that integrates the fake product sample image generation device. The fake product sample image generation device can be implemented in hardware or software, and the computer device can be a terminal or a server.
[0057] It should be specifically noted that the server involved in the embodiments of this application can be an independent 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. The terminal involved in the embodiments of this application can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, personal digital assistant, etc., but is not limited to these.
[0058] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of the fake product sample image generation method provided in this application embodiment. This fake product sample image generation method can be applied to… Figure 1 In the computer device 10, the computer device 10 first inputs an existing target fake product sample image into a preset product authenticity recognition network model for back-derivative calculation to obtain the gradient value of each pixel in the target fake product sample image; then, it determines target pixels from the target fake product sample image, wherein the target pixel is a pixel whose absolute value of the gradient value is greater than a first threshold; then, in the target fake product sample image, it adjusts the pixel value of the target pixel according to a second threshold and the gradient value corresponding to the target pixel to obtain a candidate fake product sample image; and inputs the candidate fake product sample image into the product authenticity recognition network model for authenticity recognition processing to obtain a recognition result; if the recognition result is a fake product, the candidate fake product sample image is used as the target fake product sample image until the recognition result is a real product, then the candidate fake product sample image is determined as a new fake product sample image; if the recognition result is a real product, the candidate fake product sample image is determined as a new fake product sample image.
[0059] The solutions provided in this application involve technologies such as Artificial Intelligence (AI) and Machine Learning (ML), and are specifically illustrated through the following embodiments:
[0060] AI, or Artificial Intelligence, refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, Artificial Intelligence is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence. Artificial Intelligence studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0061] AI technology is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0062] When used to train a high-precision product authenticity recognition network model, a large number of real product sample images and fake product sample images are often required. However, since fake product samples can only be obtained by seizing fake products, the number of existing fake product sample images is very small. Furthermore, fake product sample images designed manually are very fake and differ greatly from real fake product sample images. Using such fake product sample images for model training cannot improve the accuracy of model recognition.
[0063] This application provides a method for generating fake product sample images. This method can generate new fake product sample images based on existing fake product sample images, increasing the number of fake product sample images and avoiding the situation where the fake product sample images are too fake when manually drawn. Using the new fake product sample images obtained by this application to train the model can improve the recognition accuracy of the model. The following is a detailed description of the fake product sample image generation method provided by this application.
[0064] Figure 2 This is a flowchart illustrating the method for generating fake product sample images provided in an embodiment of this application. Figure 2 As shown, the method includes the following steps S110-160.
[0065] S110. Input the target fake product sample image into the preset product authenticity recognition network model and perform inverse differentiation to obtain the gradient value of each pixel in the target fake product sample image.
[0066] The target fake product sample image is an image obtained by taking pictures based on existing fake products. The gradient value is the influence of the corresponding pixel on the authenticity of the target fake product sample image. The larger the gradient value, the greater the influence of the corresponding pixel on the authenticity of the product.
[0067] In some embodiments, considering the complexity of calculating pixel gradient values or the fact that the discrimination region image only occupies a portion of the product sample image, gradient difference calculation or local pixel calculation can be used to calculate pixel gradient values or improve the calculation speed. Examples of gradient difference calculation and local pixel calculation are given below:
[0068] (1) Gradient difference calculation method:
[0069] In some embodiments, see Figure 3 Step S110 specifically includes:
[0070] S1101. Input the target fake product sample image into the product authenticity recognition network model for inverse differentiation to obtain the first pixel value of each pixel when the target fake product sample image is converted into a real product sample image.
[0071] Specifically, the product authenticity recognition network model is forced to recognize the target fake product sample image as a real product, and then reverse derivation is performed to obtain the pixel value of each pixel in the real product sample image when the target fake product sample image is converted into a real product sample image.
[0072] S1102. Obtain the second pixel value of each pixel in the target fake product sample image.
[0073] Specifically, the pixel value of each pixel in the target fake product sample image is obtained.
[0074] It should be noted that this application does not limit the execution order of steps S111 and S112, that is, step S112 can be executed before step S111 or simultaneously with step S111.
[0075] S1103. The difference between the first pixel value and the second pixel value is determined as the gradient value.
[0076] That is, the gradient value represents the pixel value that needs to change when the target fake product sample image is converted into a real product sample image. For example, if, after the reverse derivation in the product authenticity recognition network model, the target fake product sample image is converted into a real product sample image, and the pixel value of a certain pixel is 55, while the pixel value of the same pixel in the original target fake product sample image is 10, then the gradient value corresponding to that pixel is: 55 - 10 = 45.
[0077] As can be seen, determining the gradient value of each pixel by the difference between the first pixel value in the real product sample image corresponding to the target fake product sample image and the second pixel value in the target fake product sample image reduces the complexity of gradient value calculation compared to directly calculating the gradient value of the pixel.
[0078] (2) Local pixel calculation method:
[0079] In some embodiments, step S110 specifically includes:
[0080] a. Obtain the image of the target fake product sample.
[0081] b. Determine the target region image of the target fake product sample image.
[0082] The target region image is a discrimination region image, for example... Figure 4 As shown.
[0083] c. Input the target region image into the real and fake product identification network model and perform inverse differentiation to obtain the gradient value of each pixel in the target region image.
[0084] As can be seen, since the target area image is the identification area image, and the fake product identification network model mainly uses the identification area image to distinguish between genuine and fake products, this application can ignore the calculation of images other than the target area image. That is, the fake product identification network model in this embodiment only needs to calculate the target area image, which can improve the image calculation speed.
[0085] It should be noted that the gradient value calculation method for each pixel in the target region image in step c can be used. Figure 3 The gradient difference calculation method in the corresponding embodiment.
[0086] S120. Determine the target pixel from the target fake product sample image.
[0087] The target pixel is defined as a pixel whose absolute gradient value is greater than a first threshold. For example, a target pixel in a sample image of a counterfeit product that plays a crucial role or has a significant impact on the determination of authenticity is a pixel whose absolute gradient value is greater than the first threshold.
[0088] In some embodiments, the first threshold is a gradient value threshold. For example, pixels in the target fake product sample image whose gradient value is greater than the gradient value threshold are determined as target pixels. The gradient value threshold can be 15 pixel values or other values, which are not limited here.
[0089] In other embodiments, the first threshold is the proportion of pixels, such as the top 20%. In this case, the pixels whose absolute gradient value is greater than the first threshold are the top 20% of pixels with the largest absolute gradient value. That is, the top 20% of pixels with the largest absolute gradient value are determined as target pixels.
[0090] In this application, only the pixel values of the target pixels in the target fake product sample image need to be adjusted, so as to avoid the situation where the target fake product sample image becomes a real product image sample due to the adjustment of the pixel values of all pixels in the target fake product sample image.
[0091] In some embodiments, although target pixels typically appear in clusters, to ensure that the calculated target pixels are in regions, thereby improving the generation speed of new fake product sample images and the "realism" of fake product sample images, step S120 in this embodiment includes:
[0092] The pixels whose absolute gradient value is greater than the first threshold are identified as center pixels; the pixels within a preset area centered on the center pixels are identified as target pixels.
[0093] The preset area can be a circular area with a radius of 5 pixels, or it can be other shapes, such as a square area with a side length of 4 pixels. The specific shape and size of the preset area are not limited here.
[0094] As can be seen, since the target pixels are pixels within a preset area centered on the central pixel, it can be guaranteed that the target pixels appear in regions. Processing the pixels by region can improve the generation speed of new fake product sample images.
[0095] S130. In the target fake product sample image, the pixel value of the target pixel is adjusted according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image.
[0096] The second threshold is the maximum adjustment threshold for the pixel value of a pixel. For example, if the second threshold is 20 pixel values, then the pixel value adjusted for a pixel in the target fake product sample image cannot exceed 20 pixel values. The upward adjustment of a pixel cannot exceed 20 pixel values, and the downward adjustment cannot exceed 20 pixel values.
[0097] In some embodiments, the pixel value of the target pixel may be adjusted according to the following steps:
[0098] If the absolute value of the gradient value corresponding to the target pixel is greater than or equal to the second threshold, the pixel value of the target pixel is adjusted according to the second threshold; if the absolute value of the gradient value corresponding to the target pixel is less than the second threshold, the pixel value of the target pixel is adjusted according to the gradient value corresponding to the target pixel.
[0099] It should be noted that when the pixel value of the target pixel needs to be adjusted according to the second threshold, the adjustment direction of the pixel value of the target pixel is consistent with the direction of the gradient value.
[0100] For example, if the gradient value corresponding to the target pixel is +30 pixels and the second threshold is 20 pixels, then the target pixel needs +20 pixels; if the gradient value corresponding to the target pixel is -30 pixels and the second threshold is 20 pixels, then the target pixel needs -20 pixels.
[0101] When the gradient value corresponding to the target pixel is +15 pixels and the second threshold is 20 pixels, the absolute value of the gradient value corresponding to the target pixel is less than the second threshold. In this case, the target pixel is directly adjusted according to the gradient value corresponding to the target pixel, that is, the target pixel is +15 pixels.
[0102] In this embodiment, all target pixels in the target fake product sample image are adjusted towards the direction of "real product", making the fake product sample image a more realistic candidate fake product sample image.
[0103] In this application, when adjusting the pixel value of the target pixel, an adjustment threshold (second threshold) is added to limit the pixel value. This avoids the pixel value of the target pixel after adjustment from being too different from the original, and also avoids the situation where the overall composition of the adjusted pixels and the unadjusted pixels in the candidate fake product sample image loses balance, which would violate the original intention of obtaining a more realistic candidate fake product sample image.
[0104] S140. Input the candidate fake product sample image into the real and fake product identification network model for real and fake product identification processing to obtain the identification result. If the identification result is a fake product, then execute step S150; if the identification result is a real product, then execute step S160.
[0105] Specifically, after obtaining the candidate fake product sample image, the candidate fake product sample image is input back into the product authenticity recognition network model, and the product authenticity recognition network model is used to perform authenticity recognition processing on the candidate fake product sample image to obtain the recognition result, wherein the recognition result includes genuine products or fake products.
[0106] S150. Use the candidate fake product sample image as the target fake product sample image, and return to step S110.
[0107] In this embodiment, if the product authenticity identification network model identifies the candidate fake product sample image as a fake product, then it means that the product authenticity identification network model can also identify the candidate fake product sample image as a fake product. At this time, it means that further processing is needed on the candidate fake product sample image. Specifically, the candidate fake product sample image is used as the target fake product sample image until the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
[0108] S160. The candidate fake product sample image is determined as the new fake product sample image.
[0109] If the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
[0110] Specifically, such as Figure 5 As shown, the target fake product sample image is input into the product authenticity recognition network model to obtain the gradient value of each pixel in the target fake product sample image. Then, the pixel values of the target pixels in the target fake product sample image are adjusted according to the gradient values to obtain the candidate fake product sample image (e.g., Figure 5 As shown, compared to the target counterfeit product sample image, the candidate counterfeit product sample image has an extra flower in the upper right corner of the cigarette box pattern (see the flower in the enlarged image). The candidate counterfeit product sample image is then processed by a product authenticity recognition network model to obtain the recognition result. If the recognition result is a counterfeit product, the candidate counterfeit product sample image is used as the target counterfeit product sample image until the recognition result is a genuine product. If the recognition result is a genuine product, the candidate counterfeit product sample image is then determined as the new counterfeit product sample image.
[0111] In this embodiment, if the identification result is a genuine product, it means that the candidate fake product sample image has successfully fooled the product authenticity identification network model. At this time, the product authenticity identification network model cannot identify the candidate fake product sample image. Therefore, this application determines the candidate fake product sample image that has fooled the product authenticity identification network model as a new fake product sample image, so that the product authenticity identification network model can be trained based on the new fake product sample image to increase the model's recognition accuracy.
[0112] In some embodiments, after determining a new fake product sample image, the first threshold will be adjusted according to a preset first threshold set, and the process will return to step S120, wherein in step S120, target pixels need to be determined from the target fake product sample image according to the first threshold.
[0113] Specifically, the first threshold set includes multiple first thresholds, such as 10%, 20%, and 30%. For example, after a new fake product sample image is determined based on 10% as the first threshold, an unused value will be selected from the first threshold set to replace the first threshold, for example, 20%. Then, a new fake product sample image is determined based on 20% as the first threshold, and then an unused value is selected from the first threshold set to replace the first threshold, until all the first thresholds in the first threshold set have been replaced.
[0114] As can be seen, by adjusting the first threshold, this embodiment can obtain multiple new fake product sample images based on a target fake product sample, thereby further increasing the number of fake product samples.
[0115] In some embodiments, after determining a new fake product sample image, the second threshold is adjusted according to a preset second threshold set, and the process returns to step S130, wherein in step S130, the target pixels in the target fake product sample image need to be adjusted according to the second threshold.
[0116] Specifically, the second threshold set includes multiple second thresholds, such as 20 pixel values, 30 pixel values, and 40 pixel values. For example, after a new fake product sample image is determined based on 20 pixel values as the second threshold, an unused value will be selected from the second threshold set to replace the second threshold, for example, 30 pixel values will be selected. Then, a new fake product sample image will be determined based on 30 pixel values as the second threshold, and then an unused value will be selected from the second threshold set to replace the second threshold, until all the second thresholds in the second threshold set have been replaced.
[0117] As can be seen, this embodiment can also obtain multiple new fake product sample images based on a target fake product sample by adjusting the first threshold, thereby further increasing the number of fake product samples.
[0118] It should be noted that in this embodiment, after obtaining each new fake product sample image, only the first threshold or the second threshold can be adjusted, or both the first threshold and the second threshold can be adjusted simultaneously. The specific method is not limited here.
[0119] In summary, the embodiments of this application can generate new fake product sample images based on existing fake product sample images, thereby increasing the number of fake product samples.
[0120] Figure 6 This is a flowchart illustrating a method for generating fake product sample images according to another embodiment of this application. Figure 6 As shown, the method for generating fake product sample images in this embodiment includes steps S210-S280. Steps S210-S260 are similar to steps S110-S160 in the above embodiment and will not be described again here. The following details the additional steps S270-S280 in this embodiment.
[0121] S270. Add fake product labels to the new fake product sample image.
[0122] In this embodiment, the new fake product sample image is a sample image obtained based on a known fake product sample image. Therefore, the new fake product sample image is still a fake product sample image. In this embodiment, a fake product label is added to the new fake product sample image.
[0123] S280. Train the product authenticity recognition network model based on the new fake product sample image.
[0124] The product authenticity recognition network model will misidentify the new fake product sample image. Therefore, the product authenticity recognition network model lacks the ability to correctly identify fake product photos of this type. In order to improve the recognition accuracy of the product authenticity recognition network model, after obtaining the new fake product sample image, this embodiment also needs to add a fake product label to the new fake product sample image, and train the product authenticity recognition network model based on the new fake product sample image with the fake product label.
[0125] As can be seen, after obtaining the new fake product sample image, this embodiment will train the product authenticity recognition network model based on the new fake product sample image. When the product authenticity recognition network model subsequently identifies fake product images with the features of the new fake product sample image, it can identify the fake products, thereby improving the recognition accuracy of the product authenticity recognition network model.
[0126] Figures 1 to 6 Any technical feature mentioned in the embodiments corresponding to any one of the above also applies to the embodiments of this application. Figures 7 to 10 The corresponding implementation examples will not be repeated hereafter.
[0127] The above describes a method for generating fake product sample images in the embodiments of this application. The following describes a device for generating fake product sample images that performs the above method.
[0128] See Figure 7 ,like Figure 7 The diagram shows a structural schematic of a fake product sample image generation device 50, which can be used to generate new fake product sample images based on existing fake product sample images, thereby increasing the number of fake product sample images. The fake product sample image generation device 50 in this embodiment can achieve the above-mentioned... Figures 1-6 The steps in the fake product sample image generation method executed by the fake product sample image generation device 50 in any corresponding embodiment. The functions implemented by the fake product sample image generation device 50 can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, and the modules can be software and / or hardware. The fake product sample image generation device 50 may include an input / output unit 501 and a processing unit 502. The functional implementation of the input / output unit 501 and the processing unit 502 can be referred to Figures 1-6 The operations performed in any of the corresponding embodiments will not be described in detail here.
[0129] In some implementations, the input / output unit 501 can be used to input an existing target fake product sample image into a preset product authenticity recognition network model and perform inverse differentiation through the processing unit 502 to obtain the gradient value of each pixel in the target fake product sample image.
[0130] The processing unit 502 can be used to determine target pixels from the target fake product sample image, wherein the target pixels are pixels whose absolute gradient values are greater than a first threshold; and in the target fake product sample image, the pixel values of the target pixels are adjusted according to a second threshold and the gradient values corresponding to the target pixels to obtain candidate fake product sample images.
[0131] The input / output unit 501 can also be used to input the candidate fake product sample image into the product authenticity recognition network model and perform authenticity recognition processing through the processing unit 502 to obtain the recognition result;
[0132] The processing unit 502 can also be used to, if the identification result is a fake product, use the candidate fake product sample image as the target fake product sample image until the identification result is a real product, then determine the candidate fake product sample image as a new fake product sample image; if the identification result is a real product, then determine the candidate fake product sample image as a new fake product sample image.
[0133] In some embodiments, when implementing the step of adjusting the pixel value of the target pixel based on the second threshold and the gradient value corresponding to the target pixel, the processing unit 502 is specifically used for:
[0134] If the absolute value of the gradient value corresponding to the target pixel is greater than or equal to the second threshold, then the pixel value of the target pixel is adjusted according to the second threshold;
[0135] If the absolute value of the gradient value corresponding to the target pixel is less than the second threshold, then the pixel value of the target pixel is adjusted according to the gradient value corresponding to the target pixel.
[0136] In some embodiments, when implementing the step of determining target pixels from the target fake product sample image, the processing unit 502 is specifically used for:
[0137] The pixel whose absolute value of the gradient value is greater than the first threshold is determined as the center pixel.
[0138] The pixels within a preset area centered on the central pixel are determined as the target pixels.
[0139] In some embodiments, when the input / output unit 501 implements the step of inputting the existing target fake product sample image into a preset product authenticity recognition network model and performing back-differentiation by the processing unit 502 to obtain the gradient value of each pixel in the target fake product sample image, it is specifically used for:
[0140] The target fake product sample image is input into the product authenticity recognition network model and the processing unit 502 performs inverse differentiation to obtain the first pixel value of each pixel when the target fake product sample image is converted into a real product sample image; the processing unit 502 obtains the second pixel value of each pixel in the target fake product sample image; and the difference between the first pixel value and the second pixel value is determined as the gradient value.
[0141] In some embodiments, after performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit 502 is further configured to:
[0142] Adjust the first threshold according to the first threshold set, and return to the step of determining the target pixel from the target fake product sample image.
[0143] In some embodiments, after performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit 502 is further configured to:
[0144] Adjust the second threshold according to the preset second threshold set, and return to the step of adjusting the pixel value of the target pixel in the target fake product sample image according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image.
[0145] In some embodiments, after performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit 502 is further configured to:
[0146] Add fake product tags to the new fake product sample images;
[0147] The network model for identifying genuine and counterfeit goods is trained based on the new counterfeit product sample images.
[0148] As can be seen, the fake product sample image generation device 50 in this application can be used to generate new fake product sample images based on existing fake product sample images, thereby increasing the number of fake product sample images.
[0149] The above description of the fake product sample image generation device 50 of the fake product sample image generation method in this application embodiment has been from the perspective of modular functional entities. The following description of the fake product sample image generation device 50 of the fake product sample image generation method in this application embodiment has been from the perspective of hardware processing. It should be noted that in the embodiments of this application… Figure 7 In the embodiments shown, the physical device corresponding to the input / output unit 501 can be an input / output unit, transceiver, radio frequency circuit, communication module, and output interface, etc., and the physical device corresponding to the processing unit 502 can be a processor. Figure 7 The fake product sample image generation device 50 shown can have, for example, Figure 8 The structure shown, when Figure 7 The fake product sample image generation device 50 shown has, for example, Figure 8 When the structure shown is used, Figure 8 The input / output unit and processor in the device can perform the same or similar functions as the input / output unit 501 and processing unit 502 provided in the aforementioned embodiment of the device corresponding to the fake product sample image generation device 50. Figure 8 The memory in the processor needs to call the computer program when executing the above-mentioned method for generating fake product sample images.
[0150] This application also provides another device for generating fake product sample images, such as... Figure 9 As shown, for ease of explanation, only the parts related to the embodiments of this application are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of this application. The fake product sample image generation device can be any fake product sample image generation device, including mobile phones, tablets, personal digital assistants (PDAs), point-of-sale (POS) devices, in-vehicle computers, etc. Taking a mobile phone as an example:
[0151] Figure 9 This diagram shows a partial structural representation of a mobile phone related to the fake product sample image generation device provided in this application embodiment. (Reference) Figure 9 The mobile phone includes: a radio frequency (RF) circuit 710, a memory 720, an input unit 730, a display unit 740, a sensor 750, an audio circuit 760, a wireless-fidelity (Wi-Fi) module 770, a processor 780, and a power supply 790, among other components. Those skilled in the art will understand that... Figure 9The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0152] The following is combined Figure 9 A detailed introduction to each component of a mobile phone:
[0153] The RF circuit 710 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the processor 780; additionally, it transmits uplink data to the base station. Typically, the RF circuit 710 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 710 can also communicate wirelessly with networks and other devices. The aforementioned wireless communications may use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0154] The memory 720 can be used to store software programs and modules. The processor 780 executes various mobile phone functions and data processing by running the software programs and modules stored in the memory 720. The memory 720 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 720 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0155] The input unit 730 can be used to receive input numerical or character information, and to generate key signal inputs related to user settings and function control of the mobile phone. Specifically, the input unit 730 may include a touch panel 731 and other input devices 732. The touch panel 731, also known as a touch screen, can collect touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 731), and drive the corresponding connected devices according to a pre-set program. Optionally, the touch panel 731 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends it to the processor 780, and can also receive and execute commands sent by the processor 780. In addition, the touch panel 731 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 731, the input unit 730 may also include other input devices 732. Specifically, other input devices 732 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.
[0156] The display unit 740 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. The display unit 740 may include a display panel 741, which may optionally be configured as a Liquid Crystal Display (LCD), Organic Light-Emitting Diode (OLED), or similar display panel 741. Further, a touch panel 731 may cover the display panel 741. When the touch panel 731 detects a touch operation on or near it, it transmits the information to the processor 780 to determine the type of touch event. Subsequently, the processor 780 provides corresponding visual output on the display panel 741 based on the type of touch event. Although in Figure 9 In this embodiment, the touch panel 731 and the display panel 741 are two separate components to realize the input and output functions of the mobile phone. However, in some embodiments, the touch panel 731 and the display panel 741 can be integrated to realize the input and output functions of the mobile phone.
[0157] The mobile phone may also include at least one sensor 750, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor. The ambient light sensor can adjust the brightness of the display panel 741 according to the ambient light level, and the proximity sensor can turn off the display panel 741 and / or backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, taps), etc. Other sensors that may be configured in the mobile phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.
[0158] Audio circuit 760, speaker 761, and microphone 762 provide an audio interface between the user and the mobile phone. Audio circuit 760 converts received audio data into electrical signals and transmits them to speaker 761, where speaker 761 converts them into sound signals for output. On the other hand, microphone 762 converts collected sound signals into electrical signals, which are received by audio circuit 760, converted into audio data, and then processed by processor 780 before being transmitted via RF circuit 710 to, for example, another mobile phone, or the audio data can be output to memory 720 for further processing.
[0159] Wi-Fi is a short-range wireless transmission technology. Through the Wi-Fi module 770, mobile phones can help users send and receive emails, browse web pages, and access streaming media, providing users with wireless broadband internet access. Although Figure 9 The Wi-Fi module 770 is shown, but it is understood that it is not a necessary component of the mobile phone and can be omitted as needed without changing the nature of the application.
[0160] The processor 780 is the control center of the mobile phone, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 720, and calls data stored in the memory 720 to perform various functions and process data, thereby providing overall monitoring of the phone. Optionally, the processor 780 may include one or more processing units; preferably, the processor 780 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 780.
[0161] The mobile phone also includes a power supply 790 (such as a battery) that supplies power to various components. The power supply can be logically connected to the processor 780 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.
[0162] Although not shown, mobile phones may also include a camera, Bluetooth module, etc., which will not be described in detail here.
[0163] In this embodiment of the application, the processor 780 included in the mobile phone also has the function of controlling and executing the above-mentioned... Figure 9 The method flow shown is executed by the fake product sample image generation device 50. The steps performed by the fake product sample image generation device in the above embodiments can be based on this... Figure 9 The mobile phone structure is shown. For example, the processor 722 performs the following operations by calling instructions from memory 720:
[0164] The existing target fake product sample image is input into the preset product authenticity recognition network model for inverse differentiation to obtain the gradient value of each pixel in the target fake product sample image;
[0165] Target pixels are determined from the target fake product sample image, wherein the target pixels are pixels whose absolute gradient value is greater than a first threshold;
[0166] In the target fake product sample image, the pixel value of the target pixel is adjusted according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image;
[0167] The candidate fake product sample image is input into the product authenticity recognition network model for authenticity recognition processing to obtain the recognition result;
[0168] If the identification result is a fake product, the candidate fake product sample image is used as the target fake product sample image until the identification result is a real product, then the candidate fake product sample image is determined as a new fake product sample image.
[0169] If the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
[0170] In some embodiments, when the processor 722 implements the step of adjusting the pixel value of the target pixel based on the second threshold and the gradient value corresponding to the target pixel, it specifically implements the following steps:
[0171] If the absolute value of the gradient value corresponding to the target pixel is greater than or equal to the second threshold, then the pixel value of the target pixel is adjusted according to the second threshold;
[0172] If the absolute value of the gradient value corresponding to the target pixel is less than the second threshold, then the pixel value of the target pixel is adjusted according to the gradient value corresponding to the target pixel.
[0173] In some embodiments, when implementing the step of determining the target pixel from the target fake product sample image, the processor 722 specifically implements the following steps:
[0174] The pixel whose absolute value of the gradient value is greater than the first threshold is determined as the center pixel.
[0175] The pixels within a preset area centered on the central pixel are determined as the target pixels.
[0176] In some embodiments, when the processor 722 performs the step of inputting the existing target fake product sample image into a preset product authenticity recognition network model for back-derivative calculation to obtain the gradient value of each pixel in the target fake product sample image, the specific implementation steps are as follows:
[0177] The target fake product sample image is input into the product authenticity recognition network model for inverse differentiation to obtain the first pixel value of each pixel when the target fake product sample image is converted into a real product sample image;
[0178] Obtain the second pixel value of each pixel in the target fake product sample image;
[0179] The difference between the first pixel value and the second pixel value is determined as the gradient value.
[0180] In some embodiments, after implementing the step of determining the candidate fake product sample image as a new fake product sample image, the processor 722 further implements the following steps:
[0181] Adjust the first threshold according to the first threshold set, and return to the step of determining the target pixel from the target fake product sample image.
[0182] In some embodiments, after implementing the step of determining the candidate fake product sample image as a new fake product sample image, the processor 722 further implements the following steps:
[0183] Adjust the second threshold according to the preset second threshold set, and return to the step of adjusting the pixel value of the target pixel in the target fake product sample image according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image.
[0184] In some embodiments, after implementing the step of determining the candidate fake product sample image as a new fake product sample image, the processor 722 further implements the following steps:
[0185] Add fake product tags to the new fake product sample images;
[0186] The network model for identifying genuine and counterfeit goods is trained based on the new counterfeit product sample images.
[0187] This application also provides another apparatus for generating fake product sample images that implements the above-described method for generating fake product sample images, such as... Figure 10 As shown, Figure 10 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 1020 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1022 (e.g., one or more processors) and memory 1032, and one or more storage media 1030 (e.g., one or more mass storage devices) for storing application programs 1042 or data 1044. The memory 1032 and storage media 1030 can be temporary or persistent storage. The program stored in the storage media 1030 may include one or more modules (not shown in the diagram), each module may include a series of instruction operations on the server. Furthermore, the CPU 1022 may be configured to communicate with the storage media 1030 and execute the series of instruction operations in the storage media 1030 on the server 1020.
[0188] Server 1020 may also include one or more power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1058, and / or one or more operating systems 1041, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
[0189] In the above embodiments, the server (e.g.) Figure 7 The steps performed by the fake product sample image generation device 50 shown can be based on this Figure 10 The structure of server 1020 is shown. For example, in the above embodiment, it consists of... Figure 7 The steps performed by the fake product sample image generation device 50 shown can be based on this Figure 10 The server architecture is shown. For example, the processor 1022 performs the following operations by calling instructions from memory 1032:
[0190] The existing target fake product sample image is input into the preset product authenticity recognition network model for inverse differentiation to obtain the gradient value of each pixel in the target fake product sample image;
[0191] Target pixels are determined from the target fake product sample image, wherein the target pixels are pixels whose absolute gradient value is greater than a first threshold;
[0192] In the target fake product sample image, the pixel value of the target pixel is adjusted according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image;
[0193] The candidate fake product sample image is input into the product authenticity recognition network model for authenticity recognition processing to obtain the recognition result;
[0194] If the identification result is a fake product, the candidate fake product sample image is used as the target fake product sample image until the identification result is a real product, then the candidate fake product sample image is determined as a new fake product sample image.
[0195] If the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
[0196] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0197] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0198] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, apparatuses, or modules, and may be electrical, mechanical, or other forms.
[0199] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0200] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0201] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0202] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state disk (SSD)).
[0203] The technical solutions provided in the embodiments of this application have been described in detail above. Specific examples have been used in the embodiments of this application to illustrate the principles and implementation methods of the embodiments of this application. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments of this application. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.
Claims
1. A method for generating fake product sample images, characterized in that, include: S110. Input the existing target fake product sample image into the preset product authenticity recognition network model for back-derivative calculation to obtain the gradient value of each pixel in the target fake product sample image. S120. Determine target pixels from the target fake product sample image, wherein the target pixels are pixels whose absolute value of the gradient value is greater than a first threshold; S130. In the target fake product sample image, if the absolute value of the gradient value corresponding to the target pixel is greater than or equal to the second threshold, the pixel value of the target pixel is adjusted according to the second threshold; if the absolute value of the gradient value corresponding to the target pixel is less than the second threshold, the pixel value of the target pixel is adjusted according to the gradient value corresponding to the target pixel to obtain a candidate fake product sample image. S140. Input the candidate fake product sample image into the product authenticity recognition network model for authenticity recognition processing to obtain the recognition result; S150. If the identification result is a fake product, then the candidate fake product sample image is used as the target fake product sample image and the process returns to step S110 until the identification result is a real product, then the candidate fake product sample image is determined as a new fake product sample image. S160. If the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
2. The method according to claim 1, characterized in that, Determining the target pixel from the target fake product sample image includes: The pixel whose absolute value of the gradient value is greater than the first threshold is determined as the center pixel. The pixels within a preset area centered on the central pixel are determined as the target pixels.
3. The method according to claim 1, characterized in that, The step of inputting an existing target fake product sample image into a preset product authenticity recognition network model for back-derivative calculation to obtain the gradient value of each pixel in the target fake product sample image includes: The target fake product sample image is input into the product authenticity recognition network model for back-derivative calculation to obtain the first pixel value of each pixel when the target fake product sample image is converted into a real product sample image; Obtain the second pixel value of each pixel in the target fake product sample image; The difference between the first pixel value and the second pixel value is determined as the gradient value.
4. The method according to claim 1, characterized in that, The step of inputting an existing target fake product sample image into a preset product authenticity recognition network model for back-derivative calculation to obtain the gradient value of each pixel in the target fake product sample image includes: Obtain the image of the target fake product sample; Determine the target region image of the target fake product sample image; The target region image is input into the genuine / fake product identification network model for inverse differentiation to obtain the gradient value of each pixel in the target region image.
5. The method according to claim 1, characterized in that, After determining the candidate fake product sample image as the new fake product sample image, the method further includes: Adjust the first threshold according to the first threshold set, and return to the step of determining the target pixel from the target fake product sample image.
6. The method according to claim 1, characterized in that, After determining the candidate fake product sample image as the new fake product sample image, the method further includes: Adjust the second threshold according to the preset second threshold set, and return to the step of adjusting the pixel value of the target pixel in the target fake product sample image according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image.
7. The method according to any one of claims 1 to 6, characterized in that, After determining the candidate fake product sample image as the new fake product sample image, the method further includes: Add fake product tags to the new fake product sample images; The network model for identifying genuine and counterfeit goods is trained based on the new counterfeit product sample images.
8. A device for generating fake product sample images, characterized in that, Includes input / output units and processing units: The input / output unit is used to execute S110, inputting the existing target fake product sample image into the preset product authenticity recognition network model and performing inverse differentiation through the processing unit to obtain the gradient value of each pixel in the target fake product sample image; The processing unit is configured to execute S120, determining a target pixel from the target fake product sample image, wherein the target pixel is a pixel whose absolute gradient value is greater than a first threshold; the processing unit is further configured to execute S130, in the target fake product sample image, if the absolute value of the gradient value corresponding to the target pixel is greater than or equal to a second threshold, then adjusting the pixel value of the target pixel according to the second threshold; if the absolute value of the gradient value corresponding to the target pixel is less than the second threshold, then adjusting the pixel value of the target pixel according to the gradient value corresponding to the target pixel, thereby obtaining a candidate fake product sample image; The input / output unit is also used to execute S140, inputting the candidate fake product sample image into the product authenticity recognition network model and performing authenticity recognition processing through the processing unit to obtain the recognition result; The processing unit is further configured to execute S150, if the identification result is a fake product, then the candidate fake product sample image is used as the target fake product sample image and the process returns to step S110 until the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image; the processing unit is further configured to execute S160, if the identification result is a genuine product, then the candidate fake product sample image is determined as a new fake product sample image.
9. The apparatus according to claim 8, characterized in that, When implementing the step of determining the target pixel from the target fake product sample image, the processing unit is specifically used for: The pixel whose absolute value of the gradient value is greater than the first threshold is determined as the center pixel. The pixels within a preset area centered on the central pixel are determined as the target pixels.
10. The apparatus according to claim 8, characterized in that, When the input / output unit implements the step of inputting the existing target fake product sample image into the preset product authenticity recognition network model and performing back-differentiation through the processing unit to obtain the gradient value of each pixel in the target fake product sample image, it is specifically used for: The target fake product sample image is input into the product authenticity recognition network model, and the processing unit performs inverse differentiation to obtain the first pixel value of each pixel when the target fake product sample image is converted into a real product sample image; the processing unit obtains the second pixel value of each pixel in the target fake product sample image; the difference between the first pixel value and the second pixel value is determined as the gradient value.
11. The apparatus according to claim 8, characterized in that, When the input / output unit implements the step of inputting the existing target fake product sample image into the preset product authenticity recognition network model and performing back-differentiation through the processing unit to obtain the gradient value of each pixel in the target fake product sample image, it is specifically used for: The process involves: acquiring the target fake product sample image; determining the target region image of the target fake product sample image through the processing unit; and inputting the target region image into the real and fake product identification network model through the processing unit for back-derivative calculation to obtain the gradient value of each pixel in the target region image.
12. The apparatus according to claim 8, characterized in that, After performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit is further configured to: Adjust the first threshold according to the first threshold set, and return to the step of determining the target pixel from the target fake product sample image.
13. The apparatus according to claim 8, characterized in that, After performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit is further configured to: Adjust the second threshold according to the preset second threshold set, and return to the step of adjusting the pixel value of the target pixel in the target fake product sample image according to the second threshold and the gradient value corresponding to the target pixel to obtain the candidate fake product sample image.
14. The apparatus according to any one of claims 8 to 13, characterized in that, After performing the step of determining the candidate fake product sample image as a new fake product sample image, the processing unit is further configured to: Add fake product labels to the new fake product sample images; train the real and fake product recognition network model based on the new fake product sample images.
15. A computer device, characterized in that, The computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the method as described in any one of claims 1-7.
16. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which includes program instructions that, when executed by a processor, can implement the method as described in any one of claims 1-7.