Watermark is widely used in a large number of Internet images as an effective way to protect copyright. It is increasingly important for watermark processing, such as watermark detection and watermarking. Removal and removal. Here, we share with you some practices and explorations on the intelligent processing of watermarks during the amateur period, hoping to help you better protect your images from copyright while also better preventing your images from being used by others. abuse.
If you download and use a watermarked Internet image in your daily life, it is often neither aesthetically pleasing nor infringing. In order to avoid the various effects of using watermarked images, the most straightforward approach is to find out the watermarked image and discard it. In addition, it is not recommended to remove the watermark on the image before using it.
Next we will focus on the two common practices mentioned above.Firstly, how to use the depth learning technology to quickly build a watermark detector to realize the automatic detection of watermark, and we will further demonstrate how to use the deep learning technology to design a watermark remover based on watermark detection. The watermark on the image is automatically removed.
An all-encompassing watermark data set
whether it is a watermark detector or a watermark removal The device requires a massive watermark image as the data base. However, there is no watermark image dataset that can be used directly in reality. Therefore, our first task is to build a watermark image dataset. First of all, we need to collect a variety of watermarks. In order to ensure the good generalization performance of the subsequent models, the types of watermarks should be as many as possible, and the watermark patterns should be as rich as possible.
We collected a total of 80 watermarks from companies, organizations and individuals, including Chinese, English and logo. The next step is to make a watermarked image.In order to ensure the generality of the image data, we use the image of the public PASCAL VOC 2012 dataset as the original watermark-free image, and then use the image processing tool to mark the collected 80 watermarks on the original image with random size, position and transparency. At the same time, the position information of the watermark is recorded, thereby obtaining the first large-scale watermark image data set.
80% of the watermark dataset is divided into training sets, and the remaining 20% is divided into test sets, in order to adapt In real-life scenarios, the need for machines to automatically detect and remove watermarks that have never been seen is required. We ensure that the watermarks in the training set do not appear in the test set.This is a good way to simulate real-life usage scenarios. Now that the watermark image dataset is ready, the next step is how to set up the watermark detector and remover.
Detector that can see through various watermarks at a glance
Watermark is visually significant in the image The characteristics are very low, with small area, light color and high transparency. The difference between the watermarked image and the unwatermarked image is often small and the discrimination is low. In order to construct an effective watermark detector, we transform the image watermark detection problem into a special single-target detection task, that is, to determine whether there is a watermark in the image.
There are many current depth detection-based target detection models, which can be divided into two stages represented by Faster R-CNN. The target detection algorithm and the single-stage target detection algorithm represented by YOLO and RetinaNet.The former is to first generate a series of candidate frames to be detected by the algorithm, and then to classify the candidate frames by convolution neural network; the latter does not generate candidate frames, directly transform the problem of target frame positioning Handle for regression problems. Generally speaking, the single-stage algorithm will be faster in detection speed, but the detection accuracy will be reduced. Here we build the watermark detector based on the three target detection algorithms of Faster R-CNN, YOLOv2 and RetinaNet. From the comparison results, all three methods show satisfactory detection results, among which RetinaNet is optimal. .
In order to more intuitively demonstrate the effect of our built RetinaNet-based watermark detector, we visualize the watermark detection results on the test set, the blue frame is the actual watermark area, and the red frame is the watermark area of the detector. As can be seen from the visualization results, for watermarks that do not appear in the training set, our watermark detector can still be seen at a glance. With such a watermark detector, we can quickly and accurately detect in massive images. Watermarked image.
Go one step forward: from detection to removal
If you just use AI to automatically detect the watermark, is it always a little less? Next, we will take a step forward on the basis of watermark detection and use AI to automatically remove the watermark. Because the watermark has a small area on the image, it is too rough to directly remove the watermark from the entire image, which will seriously slow down the removal speed. For this situation, we design a more realistic watermark processing flow in combination with watermark detection. We first detect the watermark area by the watermark detector and then perform watermark removal on the watermark area.
Watermark removal problem can be seen as a slave image To image conversion problem,Convert the watermarked image to a watermark free image. Here we use a full convolutional network to build a watermark remover to achieve this image to image conversion. The input of the full convolutional network is the image area with watermark. After multi-layer convolution processing, the image area without watermark is output. We hope that the water-free image output by the network can be as close as possible to the original water-free image.
In order to maximize the quality of the network output without watermark image, we replaced the traditional codec structure with U-net structure and added the input information. Go to the output to preserve the background information of the image as much as possible.At the same time, we replace the traditional mean square error loss (MSE Loss) with a combination of Perceptual Loss and L1 Loss, so that the output of the watermark-free image can be closer to the original image in detail and texture. .
We visualize some watermarking effects of the watermark remover on the test set, the left column is the input watermark area, and the right column is the output no watermark region. From the results of the visualization, it can be seen that the removal effect of the unknown watermark is good.
Writing at the end
The various treatments for watermarks have been a hot topic of research and have attracted more and more attention. This article describes how to pass the current The popular deep learning technology is used to build watermark detectors and removers to realize intelligent processing of watermarks.
In the following articles, we will introduce one further A more powerful watermark remover will also propose some reflections on watermark removal. It is worth noting that copyright protection is something that everyone has been insisting on. The purpose of watermark removal is to verify whether it is attacked by watermark. Effective, thus promoting the improvement of watermark anti-removal ability. Protecting copyright, AI is responsible.