Method and computer program product for image style transfer
AssigneeAcer Incorporated
InventorsShih-Hao LIN, Chao-Kuang YANG, Liang-Chi CHEN, Shu-Wei YEH
Life of this patent
Estimating the term…
Abstract
The present application provides a method and a computer program product for image style transfer. The method uses an AI algorithm based on convolution to extract the content representation of a content image and the style representation of a style image, and generate a new image according to the extracted content representation and style representation. This new image not only has both the features of the content image and the features of the style image, but it also more aesthetically pleasing than the images generated by the commonly known methods do.
Claims10
A method for image style transfer, comprising the following steps:
- inputting a content image and a style image into a second convolutional neural network (CNN) model, whereby the second CNN model extracts a plurality of first feature maps of the content image and a plurality of second feature maps of the style image;
- inputting the content image into a style-transfer neural network model, whereby the style-transfer neural network model uses a specific number of filters to perform a convolution operation on the content image so as to generate a transferred image;
- inputting the transferred image into the second CNN model, whereby the second CNN model extracts a plurality of third feature maps of the transferred image;
- calculating a content loss using the first feature maps and the third feature maps, and calculating a style loss using the second feature maps and the third feature maps;
- adding the product of multiplying the content loss by a content-weight coefficient and the product of multiplying the style loss by a style-weight coefficient together so as to obtain a total loss, wherein the style-weight coefficient is 16 times larger than the content-weight coefficient;
- using a gradient descent method recursively to optimize the style-transfer neural network model and minimize the total loss so as to obtain an optimum transferred image.
A computer program product for image style transfer, wherein the program is loaded by a computer to perform:
- a first program instruction, causing a processor to input a content image and a style image into a second convolutional neural network (CNN) model, whereby the second CNN model extracts a plurality of first feature maps of the content image and a plurality of second feature maps of the style image;
- a second program instruction, causing the processor to input the content image into a style-transfer neural network model, whereby the style-transfer neural network model uses a specific number of filters to perform a convolution operation on the content image so as to generate a transferred image;
- a third program instruction, causing the processor to input the transferred image into the second CNN model, whereby the second CNN model extracts a plurality of third feature maps of the transferred image;
- a fourth program instruction, causing the processor to calculate a content loss according to the first feature maps and the third feature maps and to calculate a style loss according to the second feature maps and the third feature maps;
- a fifth program instruction, causing the processor to add the product of multiplying the content loss by a content-weight coefficient and the product of multiplying the style loss by a style-weight coefficient together so as to obtain a total loss, wherein the style-weight coefficient is 16 times larger than the content-weight coefficient;
- a sixth program instruction, causing the processor to use a gradient descent method recursively to optimize the style-transfer neural network model and minimize the total loss so as to obtain an optimum transferred image.
Dependencies are inferred from the claim text.