(Individual) The third week of innovative training on style transfer of traditional Chinese characteristic images based on deep learning

This week's work is an experiment in ink painting style on the VGG16 network built last week for image style transfer: (as shown below)

It can be seen that the results are not satisfactory, especially the parts of the sky and water surface, there is a lot of texture information, and in the actual ink painting, these parts should be left blank, or a small amount of texture information. In order to solve this phenomenon, we decided to separate the foreground and background of the image, train separately, and test the effect.

Drawing on some methods in the paper Sky Region Detection in a Single Image for Autonomous Ground Robot Navigation, I will introduce the specific steps below:

This paper has three premise assumptions:

1. The average brightness of the sky area is brighter than the average brightness of the ground area

2. The sky area is above the ground area

3. The sky area is relatively smooth

The general idea of ​​the algorithm is:

1. Scan pixels from top to bottom line by line, and set a threshold, so that a boundary can be obtained. Different boundaries can be obtained by setting different thresholds.

2. Set an energy function, different boundaries correspond to different values ​​of the energy function, and the maximum energy function is the optimal boundary

3. If the jump of the temporary optimal boundary is too large, it is considered to be a false detection. At this time, it is necessary to use K-means to divide the pixels of the sky (S) into two sets, and calculate the horses of the two types of sky and ground (G) respectively. The distance between the two, the large Mahalanobis distance is considered to be the real sky (S1), and the other is marked as the ground (S2).

4. Calculate the Mahalanobis distance between each pixel in S and S1 and G, and mark it as the closest distance.

5. Scan each column of S, if half of the pixels are the sky, consider this column to be the sky, otherwise consider the ground

As can be seen from the assumptions of the article, this algorithm has a big deficiency (only the uppermost sky can be identified), so the above algorithm was improved according to a blog on the identification of sky areas in pictures:

We scan each pixel in other areas of the image (s2 and G after step3 processing), and if the pixels in other areas meet the following two conditions, it is considered to be the sky:
   <1> Weak texture area

   <2> The difference between the pixel value and the average pixel value of the Strue area is very small.

The test results are as follows:


It can be seen that the recognition of the sky part is still good

According to the original image and template image, the effect image after separating the foreground and background:


I have submitted pictures to the group, waiting for the training results

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324736927&siteId=291194637