Method and system for automatically generating tampered image
Through the automated process of image segmentation large model, objects are segmented and processed on the image to generate semantic tampered images, solving the problem of insufficient pre-training data of deep learning models and achieving efficient pre-training of image tampering and positioning models.
Patent Information
- Application Number
- CN202411301212.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-02-18
AI Technical Summary
The deep learning models used for image tampering positioning in the prior art lack sufficient pre-training data, resulting in the automatic generation of training data becoming necessary.
By segmenting the donor image based on the image segmentation model, randomly selecting and stitching or eliminating the segmented object image unit, and post-processing through image editing software, generate stitching tampered images and object eliminating tampered images, and their corresponding masks image.
It realizes the automatic generation of a large number of semantic tampered images for pre-training of image/video tampered positioning models, saving manpower and time costs, and improving the performance of tampered positioning.
Smart Images

Figure CN119478129A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image tampering, and in particular to a method and system for automatically generating tampered images. Background Art
[0002] With the widespread popularity of digital image editing software (such as Photoshop), the cost of image tampering has become lower and lower, and tampered images have become popular, and the tampered effects are very realistic. Criminals use this technology to maliciously tamper with images to achieve illegal purposes. Maliciously generated tampered images pose a great security risk to society. Therefore, detecting and locating tampered areas in images is of great practical significance.
[0003] In recent years, deep learning technology has made significant progress in image tampering localization, and its performance has significantly surpassed traditional tampering forensics methods. However, a major challenge facing deep learning models is the lack of sufficient pre-training data. This makes it particularly necessary to automatically generate training data to support the training and performance improvement of deep learning models.
[0004] The existing pre-training data of deep learning models used for image tampering positioning are mainly obtained in two ways. One is to obtain more pre-training data by manual tampering. However, the amount of pre-training data obtained in this way is too small and it takes too much time to meet the requirements of batch pre-training data. The other way is to obtain a large amount of pre-training data through the public network. However, the data quality of these pre-training data sets obtained from the network varies, and some data cannot meet the pre-training requirements of deep learning models in specific scenarios.
[0005] Therefore, the prior art needs to be improved. Summary of the invention
[0006] The technical problem to be solved by the present invention is that, in view of the defects of the prior art, the present invention provides a method and system for automatically generating tampered images to solve the problem of lack of pre-training data for existing deep learning models used for image tampering positioning.
[0007] The technical solution adopted by the present invention to solve the technical problem is as follows:
[0008] In a first aspect, the present invention provides a method for automatically generating a tampered image, comprising:
[0009] The donor image is segmented based on the image segmentation model, the first segmented object image unit is randomly selected and spliced to the receptor image, and the spliced receptor image is post-processed by image editing software to generate a spliced tampered image and a corresponding mask image;
[0010] The original image is segmented into objects based on the image segmentation model, the second segmented object image unit is randomly selected and eliminated, and the eliminated original image is post-processed by the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask.
[0011] In one implementation, the object segmentation of the donor image based on the image segmentation model includes:
[0012] Given an image, the image is used as a donor image, and the image segmentation model is called through a program calling interface to segment multiple objects in the donor image;
[0013] A corresponding segmented object image unit containing only the current object and with a transparent background is generated for each segmented object, so as to obtain a plurality of first segmented object image units and corresponding masks.
[0014] In one implementation, the randomly selected first segmented object image unit is spliced to a receptor image, and the spliced receptor image is post-processed by image editing software, including:
[0015] Randomly selecting one of the first segmented object image units and the receptor image, scaling, moving and rotating the first segmented object image unit using random parameter values, and splicing the first segmented object image unit into the receptor image to generate the spliced tampered image;
[0016] The image editing software is called to perform post-processing on the tampered object image unit in the spliced tampered image to generate a processed spliced tampered image and a corresponding tampered image mask.
[0017] In one implementation, the first segmented object image unit is scaled, moved, and rotated using random parameter values and spliced into the receptor image, and then includes:
[0018] Call the load selection tool of the image editing software, select the content of the first segmented object image unit, fill the area in the selection with white, and save it in PNG format as a tampered image mask corresponding to the spliced tampered image.
[0019] In one implementation, the calling of the image editing software to perform post-processing on the tampered object image unit in the spliced tampered image includes:
[0020] The tampered object image unit in the spliced tampered image is subjected to blurring processing, content recognition filling processing, repair brush processing, clone stamp tool processing, sharpening processing, darkening tool processing and lightening tool processing.
[0021] In one implementation, segmenting the original image based on the image segmentation model, randomly selecting and eliminating the second segmented object image unit, and post-processing the eliminated original image through the image editing software includes:
[0022] Performing object segmentation on the original image based on the image segmentation model;
[0023] Randomly select a second segmented object image unit, and splice the second segmented object image unit into the corresponding original image;
[0024] Calling the content recognition filling tool in the image editing software to eliminate the segmented objects in the spliced original image;
[0025] The image editing software is called to perform post-processing on the eliminated original image to generate the object-eliminated tampered image and the corresponding tampered image mask.
[0026] In one implementation, calling a content recognition filling tool in the image editing software to eliminate segmented objects in the spliced original image may then include:
[0027] The loading selection tool of the image editing software is called to fill the tampered area of the original image after elimination with white, and the background with black, and save it in PNG format as a tampered image mask corresponding to the tampered image of the object after elimination.
[0028] In a second aspect, the present invention provides a system for automatically generating a tampered image, comprising:
[0029] A spliced tampered image generation module is used to perform object segmentation on the donor image based on the image segmentation model, randomly select the first segmented object image unit to splice to the recipient image, and post-process the spliced recipient image through image editing software to generate a spliced tampered image and a corresponding mask image;
[0030] The module for generating an image after tampering is eliminated is used to segment the original image into objects based on the large image segmentation model, randomly select and eliminate the second segmented object image unit, and post-process the eliminated original image through the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask.
[0031] In a third aspect, the present invention provides a terminal, comprising: a processor and a memory, wherein the memory stores a tampered image automatic generation program, and when the tampered image automatic generation program is executed by the processor, it is used to implement the operation of the tampered image automatic generation method as described in the first aspect.
[0032] In a fourth aspect, the present invention further provides a medium, which is a computer-readable storage medium, and which stores a tampered image automatic generation program, and when the tampered image automatic generation program is executed by a processor, it is used to implement the operation of the tampered image automatic generation method as described in the first aspect.
[0033] The present invention adopts the above technical solution to achieve the following effects:
[0034] The present invention performs object segmentation on the donor image based on the image segmentation model, randomly selects the first segmented object image unit to be spliced to the receptor image, and post-processes the spliced receptor image through image editing software, so as to generate a spliced tampered image and a corresponding mask image; and performs object segmentation on the original image based on the image segmentation model, randomly selects and eliminates the second segmented object image unit, and post-processes the eliminated original image through image editing software, so as to generate an object-eliminated tampered image and a corresponding tampered image mask. The present invention can automatically generate a large number of tampered images with semantics and tampered masks for pre-training of image / video tampering positioning models. It can save a lot of manpower and time costs for generating tampered images, and has important application value in image / video tampering positioning forensics. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.
[0036] Figure 1 It is a flow chart of the method for automatically generating tampered images in the present invention.
[0037] Figure 2 It is a schematic diagram of a segmented object image unit including only one object and a transparent background in the present invention.
[0038] Figure 3 is a schematic diagram of a tampered image generated in the present invention.
[0039] Figure 4 This is a diagram showing the tampering localization performance after using the tampered image to pre-train the tampering localization model CFL-Net in the present invention.
[0040] Figure 5 It is a functional principle diagram of a terminal in one implementation of the present invention.
[0041] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings in conjunction with the embodiments. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0043] Exemplary Methods
[0044] The existing pre-training data of deep learning models used for image tampering positioning are mainly obtained in two ways. One is to obtain more pre-training data by manual tampering. However, the amount of pre-training data obtained in this way is too small and it takes too much time to meet the requirements of batch pre-training data. The other way is to obtain a large amount of pre-training data through the public network. However, the data quality of these pre-training data sets obtained from the network varies, and some data cannot meet the pre-training requirements of deep learning models in specific scenarios.
[0045] In view of the above technical problems, an embodiment of the present invention provides a method for automatically generating a tampered image. The method performs object segmentation on a donor image based on a large image segmentation model, randomly selects a first segmented object image unit to splice it to a receptor image, and post-processes the spliced receptor image through image editing software, thereby generating a spliced tampered image and a corresponding mask image; and performs object segmentation on an original image based on a large image segmentation model, randomly selects and eliminates a second segmented object image unit, and post-processes the eliminated original image through image editing software, thereby generating an object-eliminated tampered image and a corresponding tampered image mask. Therefore, the embodiment of the present invention can automatically generate a large number of tampered images with semantics and tampered masks for pre-training of image / video tampering positioning models. It can save a lot of manpower and time costs for generating tampered images, and has important application value in image / video tampering positioning forensics.
[0046] like Figure 1 As shown, an embodiment of the present invention provides a method for automatically generating a tampered image, comprising the following steps:
[0047] Step S100, performing object segmentation on the donor image based on the image segmentation model, randomly selecting the first segmented object image unit to splice to the recipient image, and post-processing the spliced recipient image through image editing software to generate a spliced tampered image and a corresponding mask image.
[0048] In this embodiment, in order to achieve image segmentation, firstly, a tampered image automatic generation program is written, and a pre-trained SAM large model (i.e., the image segmentation large model) is downloaded and loaded. The model is used to segment objects in the image. Then, for each donor image (i.e., the original image used for forgery or tampering), the API of the SAM large model is called for automatic segmentation to generate multiple segmented object image units and their corresponding masks. Finally, the OpenCV library (Open Source Computer Vision Library, an open source computer vision library) is called to further process the image. The specific operation is to cover the image with a mask to generate a segmented object image unit that contains only one segmented object and has a transparent background (i.e., the first segmented object image unit, such as Figure 2 As shown, Figure 2 The first column is the donor image, and the second column is the corresponding segmented object image unit). These segmented object image units are all saved in PNG format.
[0049] Specifically, in an implementation of this embodiment, step S100 includes the following steps:
[0050] Step S101, given an image, taking the image as a donor image, calling the image segmentation model through a program calling interface, and segmenting multiple objects in the donor image;
[0051] Step S102, generating, for each segmented object, a corresponding segmented object image unit containing only the current object and with a transparent background, to obtain a plurality of first segmented object image units and corresponding masks;
[0052] Step S103, randomly selecting one of the first segmented object image units and the receptor image, scaling, moving and rotating the first segmented object image unit using random parameter values, and splicing the first segmented object image unit into the receptor image to generate the spliced tampered image;
[0053] Step S104, calling the loading selection tool of the image editing software, selecting the content of the first segmented object image unit, filling the area in the selection with white, and saving it in PNG format as a tampered image mask corresponding to the spliced tampered image;
[0054] Step S105 , calling the image editing software to perform post-processing on the tampered object image unit in the stitched tampered image, and generating a processed stitched tampered image and a corresponding tampered image mask.
[0055] In this embodiment, in order to realize automatic generation of the stitched tampered image, the following processing is performed by the tampered image automatic generation program:
[0056] The program first randomly selects a segmented object image unit (ie, the first segmented object image unit) and a receptor image, scales, moves, rotates the segmented object image unit using random parameter values, and splices it into the receptor image.
[0057] Then, call the PhotoShop processing tool (i.e., the image editing software) to perform post-processing on the above-mentioned tampered object image unit to generate a spliced tampered image. Specifically, the program of this embodiment controls the Photoshop software to randomly select an image from the original image folder as the recipient of the spliced area (i.e., the recipient image), and randomly selects a segmented object image unit as the provider of the spliced area (i.e., the donor image). Then, the program will scale, move, and rotate the segmented object image unit with random parameter values, and splice it into the recipient image. Next, the program randomly calls the post-processing operation of Photoshop to process the tampered area of the tampered image, and the final spliced tampered image and the corresponding tampered image mask can be obtained.
[0058] In this embodiment, the specific operation of calling the image editing software to perform post-processing on the tampered object image unit is shown in Table 1. Finally, the processed tampered image is saved as a JPEG format file with random compression quality to obtain the final spliced tampered image.
[0059] Table 1 Photoshop post-processing operations
[0060]
[0061] Specifically, in an implementation of the present embodiment, the image editing software is called to perform post-processing on the tampered object image unit in the spliced tampered image, including: blurring, content recognition filling, repairing brush, clone stamp tool, sharpening, darkening tool and dodge tool processing on the tampered object image unit in the spliced tampered image.
[0062] Furthermore, in order to automatically generate a tampered image mask corresponding to the spliced tampered image, the program of this embodiment will control the Photoshop software, first create a new document with the same size as the recipient image as the tampered image mask, and fill it with black. Then, the above-mentioned segmented object image unit is scaled, moved, and rotated using the same parameters as when generating the spliced tampered image, and spliced into the tampered image mask. Finally, call the selection loading tool of Photoshop, select the content of the segmented object image unit, fill the area in the selection with white, and save it in PNG format as the tampered image mask corresponding to the spliced tampered image.
[0063] In this embodiment, for a given tampered image donor image, the SAM large model is used to implement object segmentation, and multiple segmented object image units and corresponding masks are obtained, and a segmented object image unit is randomly selected and spliced into the recipient image; then the PhotoShop processing tool is called to perform post-processing on the tampered object image unit to generate a spliced tampered image and a corresponding tampered mask; compared with the traditional manual tampering image method, the traditional manual tampering image method cannot generate tampered images on a large scale, is inefficient and consumes a lot of manpower; while in this embodiment, through the automated process, combined with the SAM large model and Photoshop tools, a large number of tampered images can be generated in a short time, which greatly saves time and labor costs.
[0064] like Figure 1 As shown, an embodiment of the present invention provides a method for automatically generating a tampered image, comprising the following steps:
[0065] Step S200, performing object segmentation on the original image based on the image segmentation model, randomly selecting and eliminating the second segmented object image unit, and post-processing the eliminated original image through the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask.
[0066] In this embodiment, in order to realize the automatic generation of the object-eliminated tampered image, the original image is first segmented based on the SAM large model, and a segmented object image unit (i.e., the second segmented object image unit) is randomly selected and spliced into the corresponding original image. Then, the content recognition fill tool in Photoshop is called to automatically eliminate the segmented objects in the original image. Then, the tampered image is subsequently processed using the processing tool of Photoshop to generate the final object-eliminated tampered image.
[0067] Specifically, in an implementation of this embodiment, step S200 includes the following steps:
[0068] Step S201, performing object segmentation on the original image based on the image segmentation model;
[0069] Step S202, randomly selecting a second segmented object image unit, and splicing the second segmented object image unit into the corresponding original image;
[0070] Step S203, calling a content recognition and filling tool in the image editing software to eliminate the segmented objects in the spliced original image;
[0071] Step S204, calling the loading selection tool of the image editing software, filling the tampered area of the original image after elimination with white, and filling the background with black, and saving it in PNG format as a tampered image mask corresponding to the object tampered image;
[0072] Step S205, calling the image editing software to perform post-processing on the eliminated original image to generate the object eliminated tampered image and the corresponding tampered image mask.
[0073] In this embodiment, the program first performs object segmentation on the original image based on the SAM large model, and randomly selects a segmented object image unit (i.e., the second segmented object image unit), and opens the segmented object image unit and its corresponding original image in Photoshop. In the document of the segmented object image unit, the program calls the loading selection tool, selects the object content of the segmented object image unit, deletes it, deselects the selection, selects the background and fills it with any color. Next, the layer of the segmented object image unit is copied and pasted into the document where the original image is located, and the selection loading tool is called again to select the selection area where the object is located in the segmented object image unit. In the original image, the content recognition and filling tool of Photoshop is called for the selection area, and the corresponding segmented object in the original image is automatically eliminated, and automatically filled according to the surrounding pixels. Subsequently, the program randomly calls the post-processing operation of Photoshop to further process the tampered area. Finally, the layer of the segmented object image unit is deleted, and the document is saved in JPEG format with random compression quality to generate the final object elimination tampering image.
[0074] Furthermore, in order to automatically generate a tampered image mask corresponding to the object-eliminated tampered image, the program of this embodiment first controls Photoshop software to open the segmented object image unit. Next, the program calls Photoshop's selection loading tool, selects the content of the segmented object image unit, and fills it with white. Then, the selection is inverted, the background is selected and filled with black. Finally, the image is saved in PNG format as a tampered image mask corresponding to the object-eliminated tampered image.
[0075] In one implementation, this embodiment generates the tampered image and a corresponding tampered image mask while generating the tampered image, wherein the tampered image mask marks the tampered area in the tampered image. Figure 3 As shown, Figure 3 The tampered image generated by the method of the present invention and its corresponding tampered image mask are shown in FIG. Figure 3 The first column is the original image, Figure 3 The second column is the tampered image. Figure 3The third column in the figure is the tampered image mask with the tampered area finally marked; Figure 3 The first two lines are spliced and tampered. Figure 3 The latter line is to remove the tampering of the object. This embodiment also generates a text file that stores the tampering operation used to tamper with the image.
[0076] It can be seen that this embodiment can automatically generate a large number of tampered images with semantics and tampering masks for pre-training of image / video tampering localization.
[0077] In order to illustrate that the tampered images automatically generated in this embodiment can play an important role in the image forensics method. This embodiment adopts a deep learning model CFL-Net that performs well in the field of forensics, and then uses the tampered images automatically generated in this embodiment as training images to pre-train the deep model, and then tests the performance of the pre-trained model on the artificial tampering database. The performance evaluation indicators used are AUC and F1, and the results are shown in Table 2.
[0078] Table 2 Performance of pre-trained models on the artificial tampering database
[0079]
[0080] It can be seen from Table 2 that using the tampered images generated by the method of the present invention as pre-training images can enable the network to learn traces that are closer to the actual tampering, thereby improving the network's tampering location performance for the tampered images.
[0081] like Figure 4 As shown, Figure 4 FIG. 2 shows the positioning result of the CFL-Net network for the tampered area of the artificially tampered image after the tampered image generated by the method of the present invention is trained. Figure 4 The first column is the test image. Figure 4 The second column is the test result of the tampered image pre-training model generated by the present invention. Figure 4 The third column in is the tampering mask of the test image. Figure 4 It can be seen that the network pre-trained with the tampered images generated by the method of the present invention can effectively learn the traces left by Photoshop tampering, thereby achieving better tampering location performance. From the above experimental results, it can be seen that the use of the method of the present invention is of great help in improving the detection performance of the image forensics method based on deep learning on actual tampered images, which is of great significance for use occasions involving image security.
[0082] The present invention provides a method for automatically generating pre-trained Photoshop tampered images based on the SAM large model, which has significant advantages in the following aspects compared with the existing manual and automatic tampered image generation methods.
[0083] 1) The traditional manual tampering method cannot generate tampered images on a large scale, is inefficient and consumes a lot of manpower. The present invention uses an automated process, combined with the SAM large model and Photoshop tools, to generate a large number of tampered images in a short time, greatly saving time and labor costs.
[0084] 2) Existing automated generation methods usually rely on ordinary image processing or simple AI technology, which cannot simulate image characteristics similar to the Photoshop tampering process, resulting in significant differences in statistical properties between the generated images and the real Photoshop tampered images. The present invention combines the SAM large model with the Photoshop processing tool, and the generated tampered images are closer to the real tampered images in statistical properties, which enhances its credibility and effectiveness in practical applications.
[0085] 3) The existing automated image tampering methods based on Photoshop scripts cannot generate tampered images that modify the semantics of the original image. In contrast, the present invention implements object segmentation through the SAM large model, and randomly selects segmented object image units for splicing or elimination. The generated tampered images and tampered masks have rich semantic information and high-quality visual effects, further improving the complexity and diversity of tampered images.
[0086] In the embodiment of the present invention, a large number of tampered images with semantic features and tampering masks can be generated in an automated manner, providing rich high-quality data for the pre-training of image / video tampering localization models, greatly reducing labor and time costs, and having important application value in image / video tampering localization forensics.
[0087] This embodiment achieves the following technical effects through the above technical solution:
[0088] This embodiment performs object segmentation on the donor image based on the large image segmentation model, randomly selects the first segmented object image unit to splice to the recipient image, and post-processes the spliced recipient image through image editing software, which can generate a spliced tampered image and a corresponding mask image; and performs object segmentation on the original image based on the large image segmentation model, randomly selects and eliminates the second segmented object image unit, and post-processes the eliminated original image through image editing software, which can generate an object-eliminated tampered image and a corresponding tampered image mask. This embodiment can automatically generate a large number of tampered images with semantics and tampering masks for pre-training of image / video tampering positioning models. It can save a lot of manpower and time costs for generating tampered images, and has important application value in image / video tampering positioning forensics.
[0089] Exemplary Devices
[0090] Based on the above embodiments, the present invention further provides a system for automatically generating a tampered image, comprising:
[0091] A spliced tampered image generation module is used to segment the donor image based on the image segmentation model, randomly select the first segmented object image unit to splice to the recipient image, and post-process the spliced recipient image through image editing software to generate a spliced tampered image and a corresponding mask image;
[0092] The module for generating an image after tampering is eliminated is used to segment the original image into objects based on the large image segmentation model, randomly select and eliminate the second segmented object image unit, and post-process the eliminated original image through the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask.
[0093] This embodiment achieves the following technical effects through the above technical solution:
[0094] This embodiment performs object segmentation on the donor image based on the large image segmentation model, randomly selects the first segmented object image unit to splice to the recipient image, and post-processes the spliced recipient image through image editing software, which can generate a spliced tampered image and a corresponding mask image; and performs object segmentation on the original image based on the large image segmentation model, randomly selects and eliminates the second segmented object image unit, and post-processes the eliminated original image through image editing software, which can generate an object-eliminated tampered image and a corresponding tampered image mask. This embodiment can automatically generate a large number of tampered images with semantics and tampering masks for pre-training of image / video tampering positioning models. It can save a lot of manpower and time costs for generating tampered images, and has important application value in image / video tampering positioning forensics.
[0095] Based on the above embodiment, the present invention further provides a terminal, whose principle block diagram can be as follows: Figure 5 shown.
[0096] The terminal includes: a processor, a memory, an interface, a display screen and a communication module connected through a system bus; wherein the processor of the terminal is used to provide computing and control capabilities; the memory of the terminal includes a storage medium and an internal memory; the storage medium stores an operating system and a computer program; the internal memory provides an environment for the operation of the operating system and the computer program in the storage medium; the interface is used to connect to external devices; the display screen is used to display corresponding information; and the communication module is used to communicate with a cloud server or other devices.
[0097] When the computer program is executed by a processor, it is used to implement the operation of the method for automatically generating a tampered image.
[0098] It can be understood by those skilled in the art that Figure 5The principle block diagram shown in the figure is only a block diagram of a partial structure related to the scheme of the present invention, and does not constitute a limitation on the terminal to which the scheme of the present invention is applied. The specific terminal may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0099] In one embodiment, a terminal is provided, which includes: a processor and a memory, wherein the memory stores a tampered image automatic generation program, and when the tampered image automatic generation program is executed by the processor, it is used to implement the operation of the tampered image automatic generation method as described above.
[0100] In one embodiment, a storage medium is provided, wherein the storage medium stores a tampered image automatic generation program, and when the tampered image automatic generation program is executed by a processor, it is used to implement the operation of the tampered image automatic generation method as described above.
[0101] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the computer program can be stored in a non-volatile storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present invention can include non-volatile and volatile memory.
[0102] In summary, the present invention provides a method and system for automatically generating tampered images, including: performing object segmentation on a donor image based on a large image segmentation model, randomly selecting a first segmented object image unit to splice to a recipient image, and post-processing the spliced recipient image through image editing software to generate a spliced tampered image and a corresponding mask image; performing object segmentation on the original image based on the large image segmentation model, randomly selecting and eliminating a second segmented object image unit, and post-processing the eliminated original image through the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask. The present invention improves the complexity and diversity of tampered images, provides rich high-quality data for pre-training of deep learning models, greatly reduces labor and time costs, and has important application value in image / video tampering location and evidence collection.
[0103] It should be understood that the application of the present invention is not limited to the above examples. For ordinary technicians in this field, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for automatically generating a tampered image, characterized in that: include: The donor image is segmented based on the image segmentation model, the first segmented object image unit is randomly selected and spliced to the receptor image, and the spliced receptor image is post-processed by image editing software to generate a spliced tampered image and a corresponding mask image; The original image is segmented into objects based on the image segmentation model, the second segmented object image unit is randomly selected and eliminated, and the eliminated original image is post-processed by the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask.
2. The method for automatically generating a tampered image according to claim 1, characterized in that: The object segmentation of the donor image based on the image segmentation model includes: Given an image, the image is used as a donor image, and the image segmentation model is called through a program calling interface to segment multiple objects in the donor image; A corresponding segmented object image unit containing only the current object and with a transparent background is generated for each segmented object, so as to obtain a plurality of first segmented object image units and corresponding masks.
3. The method for automatically generating a tampered image according to claim 1, characterized in that: The randomly selected first segmented object image unit is spliced to the receptor image, and the spliced receptor image is post-processed by image editing software, including: Randomly selecting one of the first segmented object image units and the receptor image, scaling, moving and rotating the first segmented object image unit using random parameter values, and splicing the first segmented object image unit into the receptor image to generate the spliced tampered image; The image editing software is called to perform post-processing on the tampered object image unit in the spliced tampered image to generate a processed spliced tampered image and a corresponding tampered image mask.
4. The method for automatically generating a tampered image according to claim 3, characterized in that: The step of scaling, moving and rotating the first segmented object image unit by using random parameter values and splicing the first segmented object image unit into the receptor image further includes: Call the load selection tool of the image editing software, select the content of the first segmented object image unit, fill the area in the selection with white, and save it in PNG format as a tampered image mask corresponding to the spliced tampered image.
5. The method for automatically generating a tampered image according to claim 3, characterized in that: The calling of the image editing software to perform post-processing on the tampered object image unit in the spliced tampered image includes: The tampered object image unit in the spliced tampered image is subjected to blurring processing, content recognition filling processing, repair brush processing, clone stamp tool processing, sharpening processing, darkening tool processing and lightening tool processing.
6. The method for automatically generating a tampered image according to claim 1, characterized in that: The object segmentation of the original image based on the image segmentation large model, randomly selecting and eliminating the second segmented object image unit, and post-processing the eliminated original image through the image editing software, includes: Performing object segmentation on the original image based on the image segmentation model; Randomly select a second segmented object image unit, and splice the second segmented object image unit into the corresponding original image; Calling the content recognition filling tool in the image editing software to eliminate the segmented objects in the spliced original image; The image editing software is called to perform post-processing on the eliminated original image to generate the object-eliminated tampered image and the corresponding tampered image mask.
7. The method for automatically generating a tampered image according to claim 6, characterized in that: The calling of the content recognition filling tool in the image editing software to eliminate the segmented objects in the spliced original image further includes: The loading selection tool of the image editing software is called to fill the tampered area of the original image after elimination with white, and the background with black, and save it in PNG format as a tampered image mask corresponding to the tampered image of the object after elimination.
8. A system for automatically generating tampered images, characterized in that: include: A spliced tampered image generation module is used to segment the donor image based on the image segmentation model, randomly select the first segmented object image unit to splice to the recipient image, and post-process the spliced recipient image through image editing software to generate a spliced tampered image and a corresponding mask image; The module for generating an image after tampering is eliminated is used to segment the original image into objects based on the large image segmentation model, randomly select and eliminate the second segmented object image unit, and post-process the eliminated original image through the image editing software to generate an object-eliminated tampered image and a corresponding tampered image mask.
9. A terminal, characterized in that: include: A processor and a memory, wherein the memory stores a tampered image automatic generation program, and when the tampered image automatic generation program is executed by the processor, it is used to implement the operation of the tampered image automatic generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a tampered image automatic generation program, and when the tampered image automatic generation program is executed by a processor, it is used to implement the operation of the tampered image automatic generation method according to any one of claims 1 to 7.