IP Library › Granted Patent US 11,595,737
Granted Patent B2
US 11,595,737 · App. 16/990,011 · Granted Feb 28, 2023

Method for embedding advertisement in video and computer device

Inventors: Wei Xu (Nanjing, CN); Clare Conran (Dublin, IE); Francois Pitié (Dublin, IE)
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
H04N21/812G06F17/15G06N3/0454
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,595,737
App. No.
16/990,011
Granted
Feb 28, 2023
Kind
B2
Abstract

A method for embedding an advertisement in a video and a computer device, which is configured to: determine a target image, where the target image is an image that is in M frames of images of a target video and that includes a first print advertisement, and M is a positive integer; determine a target area, where the target area is an area in which the first print advertisement is located in the target image; insert a to-be-embedded second print advertisement into the target area to replace the first print advertisement; and convert a style of the target image in which the second print advertisement is embedded, where a style of the second print advertisement in the target image after style conversion is consistent with a style of an image pixel outside the area in which the second print advertisement is located in the target image.

Claims (63)

1. A method for embedding an advertisement in a video, implemented by a computer device, and comprising:

determining a target image comprising P frames, wherein the target image is an image that is in M frames of images of a target video and that comprises a first print advertisement, and wherein M is a positive integer;

determining a target area in which the first print advertisement is located in the target image;

embedding a second print advertisement into the target area to replace the first print advertisement;

tracking, using a corner point tracking algorithm and after embedding the second print advertisement, coordinates of the second print advertisement embedded in each of the P frames;

adjusting, after embedding the second print advertisement, when the P frames comprise a first image in which the second print advertisement is embedded, and when a coordinate offset value of the second print advertisement is greater than or equal to a second preset threshold, the coordinates of the second print advertisement in the first image such that the coordinate offset value of the second print advertisement in the first image is less than the second preset threshold; and

converting, after tracking the coordinates and adjusting the coordinates, a style of the target image in which the second print advertisement is embedded,

wherein a style of the second print advertisement after style conversion is consistent with a style of an image pixel outside an area in which the second print advertisement is located in the target image.

2. The method according to claim 1 , wherein determining the target image comprises:

recognizing, based on a first convolutional neural network model, whether an i th frame in the M frames comprises the first print advertisement; and

determining, when the i th frame comprises the first print advertisement, that the i th frame is the target image, wherein i is a positive integer ranging from 1 to M successively.

3. The method according to claim 2 , wherein recognizing whether the i th frame comprises the first print advertisement comprises:

inputting the i th frame into at least one convolutional layer in the first convolutional neural network model to obtain a feature map of a last convolutional layer in the at least one convolutional layer, wherein the first convolutional neural network model comprises the at least one convolutional layer, at least one fully connected layer, and one Softmax layer;

inputting the feature map into the at least one fully connected layer to obtain a two-dimensional vector output by a last fully connected layer in the at least one fully connected layer; and

inputting the two-dimensional vector into the Softmax layer to obtain a vector for identifying whether the i th frame comprises the first print advertisement.

4. The method according to claim 3 , wherein a weight parameter and a bias term parameter of a convolutional layer in the first convolutional neural network model and a weight parameter and a bias term parameter of a fully connected layer in the first convolutional neural network model are based on a preset image that comprises the first print advertisement and a preset image that does not comprise the first print advertisement.

5. The method according to claim 1 , wherein determining the target area comprises:

inputting the target image into a second convolutional neural network model to obtain a first vertex coordinate set of the first print advertisement in the target image;

obtaining a second vertex coordinate set based on the first vertex coordinate set, wherein a difference between the second vertex coordinate set and the first vertex coordinate set is less than or equal to a first preset threshold;

performing at least one deformation on an area comprising the second vertex coordinate set to obtain N deformed areas, wherein N is a positive integer; and

inputting the N deformed areas into a third convolutional neural network model to obtain the target area, wherein the third convolutional neural network model recognizes an area that is in the N deformed areas and that is most accurate to position the first print advertisement.

6. The method according to claim 5 , wherein a weight parameter and a bias term parameter of a convolutional layer in the third convolutional neural network model and a weight parameter and a bias term parameter of a fully connected layer in the third convolutional neural network model are based on a preset area that is accurate in positioning and a preset area that is inaccurate in positioning.

7. The method according to claim 1 , wherein converting the style of the target image comprises inputting the target image in which the second print advertisement is embedded to a generative adversarial network model to obtain an image after style conversion, and wherein the style of the second print advertisement is consistent with a style of an image pixel outside the second print advertisement in the image after style conversion.

8. The method according to claim 7 , wherein the generative adversarial network model comprises a generator and a discriminator, wherein the generator comprises a convolutional layer, a pooling layer, a deconvolution layer, and an anti-pooling layer, and wherein the discriminator comprises a convolutional layer, a pooling layer, a fully connected layer, and a Softmax layer.

9. The method according to claim 8 , wherein a weight parameter and a bias term parameter of the convolutional layer in the generator and a weight parameter and a bias term parameter of the deconvolution layer in the generator are trained and generated based on a preset image in which the second print advertisement has been embedded and an image that is obtained by adjusting a style of the image in which the second print advertisement has been embedded, and wherein a weight parameter and a bias term parameter of the convolutional layer in the discriminator and a weight parameter and a bias term parameter of the fully connected layer in the discriminator are trained and generated based on the preset image in which the second print advertisement has been embedded and the image that is obtained by adjusting the style of the image in which the second print advertisement has been embedded.

10. A computer device comprising:

a memory configured to store instructions; and

a processor coupled to the memory and configured to execute the instructions to cause the computer device to:

determine a target image comprising P frames, wherein the target image is an image that is in M frames of images of a target video and that comprises a first print advertisement, and wherein M is a positive integer;

determine a target area in which the first print advertisement is located in the target image;

embed a second print advertisement into the target area to replace the first print advertisement;

track, using a corner point tracking algorithm and after embedding the second print advertisement, coordinates of the second print advertisement embedded in each of the P frames;

adjust, after embedding the second print advertisement, when the P frames comprise a first image in which the second print advertisement is embedded, and when a coordinate offset value of the second print advertisement is greater than or equal to a second preset threshold, the coordinates of the second print advertisement in the first image such that the coordinate offset value of the second print advertisement in the first image is less than the second preset threshold; and

convert, after tracking the coordinates and adjusting the coordinates, a style of the target image in which the second print advertisement is embedded,

wherein a style of the second print advertisement after style conversion is consistent with a style of an image pixel outside an area in which the second print advertisement is located in the target image.

11. The computer device according to claim 10 , wherein the computer device is an identity recognition apparatus, and wherein the processor is further configured to execute the instructions to cause the identity recognition apparatus to:

recognize, based on a first convolutional neural network model, whether an i th frame of image in the M frames of images comprises the first print advertisement; and

determine, when the i th frame comprises the first print advertisement, that the i th frame is the target image, wherein i is a positive integer ranging from 1 to M successively.

12. The computer device according to claim 11 , wherein the processor is further configured to execute the instructions to cause the identity recognition apparatus to:

input the i th frame in the M frames into at least one convolutional layer in the first convolutional neural network model to obtain a feature map of a last convolutional layer in the at least one convolutional layer, wherein the first convolutional neural network model comprises the at least one convolutional layer, at least one fully connected layer, and one Softmax layer;

input the feature map of the last convolutional layer into the at least one fully connected layer to obtain a two-dimensional vector output by a last fully connected layer in the at least one fully connected layer; and

input the two-dimensional vector into the Softmax layer to obtain a vector for identifying whether the i th frame comprises the first print advertisement.

13. The computer device according to claim 12 , wherein a weight parameter and a bias term parameter of a convolutional layer in the first convolutional neural network model and a weight parameter and a bias term parameter of a fully connected layer in the first convolutional neural network model are trained and generated based on a preset image that comprises the first print advertisement and a preset image that does not comprise the first print advertisement.

14. The computer device according to claim 10 , wherein the computer device is an identity recognition apparatus, and wherein the processor is further configured to execute the instructions to cause the identity recognition apparatus to:

input the target image into a second convolutional neural network model to obtain a first vertex coordinate set of the first print advertisement in the target image;

obtain a second vertex coordinate set based on the first vertex coordinate set, wherein a difference between the second vertex coordinate set and the first vertex coordinate set is less than or equal to a first preset threshold;

perform at least one deformation on an area comprising the second vertex coordinate set to obtain N deformed areas, wherein N is a positive integer; and

input the N deformed areas into a third convolutional neural network model to obtain the target area, wherein the third convolutional neural network model is for recognizing an area that is in the N deformed areas and that is most accurate to position the first print advertisement.

15. The computer device according to claim 14 , wherein a weight parameter and a bias term parameter of a convolutional layer in the third convolutional neural network model and a weight parameter and a bias term parameter of a fully connected layer in the third convolutional neural network model are trained and generated based on a preset area that is accurate in positioning and a preset area that is inaccurate in positioning.

16. The computer device according to claim 10 , wherein the computer device is an identity recognition apparatus, wherein the processor is further configured to execute the instructions to cause the identity recognition apparatus to input the target image in which the second print advertisement is embedded to a generative adversarial network model to obtain an image after style conversion, and wherein the style of the second print advertisement is consistent with a style of an image pixel outside the second print advertisement in the image after style conversion.

17. The computer device according to claim 16 , wherein the generative adversarial network model comprises a generator and a discriminator, wherein the generator comprises a convolutional layer, a pooling layer, a deconvolution layer, and an anti-pooling layer, and wherein the discriminator comprises a convolutional layer, a pooling layer, a fully connected layer, and a Softmax layer.

18. The computer device according to claim 17 , wherein a weight parameter and a bias term parameter of the convolutional layer in the generator and a weight parameter and a bias term parameter of the deconvolution layer in the generator are trained and generated based on a preset image in which the second print advertisement has been embedded and an image that is obtained by adjusting a style of the image in which the second print advertisement has been embedded, and wherein a weight parameter and a bias term parameter of the convolutional layer in the discriminator and a weight parameter and a bias term parameter of the fully connected layer in the discriminator are trained and generated based on the preset image in which the second print advertisement has been embedded and the image that is obtained by adjusting the style of the image in which the second print advertisement has been embedded.

19. A computer program product comprising instructions that are stored on a noni-transitory computer-readable medium and that, when executed by a processor, cause a computer device to:

determine a target image comprising P frames, wherein the target image is an image that is in M frames of images of a target video and that comprises a first print advertisement, and wherein M is a positive integer;

determine a target area in which the first print advertisement is located in the target image;

embed a second print advertisement into the target area to replace the first print advertisement;

track, using a corner point tracking algorithm and after embedding the second print advertisement, coordinates of the second print advertisement embedded in each of the P frames;

adjust, after embedding the second print advertisement, when the P frames comprise a first image in which the second print advertisement is embedded, and when a coordinate offset value of the second print advertisement is greater than or equal to a second preset threshold, the coordinates of the second print advertisement in the first image such that the coordinate offset value of the second print advertisement in the first image is less than the second preset threshold; and

convert, after tracking the coordinates and adjusting the coordinates, a style of the target image in which the second print advertisement is embedded,

wherein a style of the second print advertisement after style conversion is consistent with a style of an image pixel outside an area in which the second print advertisement is located in the target image.

20. The computer program product according to claim 19 , wherein the computer device is an identity recognition apparatus, and wherein the instructions, when executed by the processor, further cause the identity recognition apparatus to:

recognize, based on a first convolutional neural network model, whether an i th frame of image in the M frames of images comprises the first print advertisement; and

determine, when the i th frame comprises the first print advertisement, that the i th frame is the target image, wherein i is a positive integer ranging from 1 to M successively.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jan 17, 2023
From: XU, WEI; PITIE, FRANCOIS; CONRAN, CLARE
To: HUAWEI TECHNOLOGIES CO., LTD.
Reel/Frame 062389/0438 →
Priority Claims (1)
CN 201810147228.1 · Feb 12, 2018 · national
Continuity (2)
Continuation PCTCN2019072103 · Jan 17, 2019
Related Publication 20200374600A1 · Nov 26, 2020