Implantation location determination method, device, electronic device and storage medium

The target detection algorithm and shot segmentation algorithm automatically determine the position of the specified object in the video frame, which solves the problem of high cost and low efficiency of manual browsing on the video playback platform to determine the implantation position, and achieves efficient resource implantation position determination.

CN116074582BActive Publication Date: 2024-08-30BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310047804.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-01-31
Publication Date
2024-08-30
Estimated Expiration
2043-01-31

AI Technical Summary

Technical Problem

In the existing technology, the video playback platform requires manual browsing of videos to determine the location of resource implantation, resulting in high cost and low efficiency.

Method used

A target detection algorithm is used to determine the position of the specified object in the video frame, and the implantation position is automatically determined based on the intersection ratio and shot segmentation algorithm.

Benefits of technology

It reduces labor costs, improves the efficiency of implant location determination, and ensures that resources are integrated into the video without affecting the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116074582B
    Figure CN116074582B
Patent Text Reader

Abstract

The embodiment of the present application provides a method, device, electronic device and storage medium for determining an implantation position, which relates to the field of video processing technology. The method includes: obtaining a video image in which a two-dimensional image resource needs to be implanted; based on a target detection algorithm, determining a video frame containing a specified object in the video image as a first video frame; wherein, when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, the intersection-and-union ratio of the image area occupied by the two-dimensional image resource and the image area occupied by the specified object is greater than a preset threshold; based on the position of the specified object in the first video frame, determining the implantation position of the two-dimensional image resource in the video image. Based on this, the implantation position is automatically detected by the electronic device, which can reduce the labor cost and improve the efficiency of determining the implantation position compared to manually browsing the video image to determine the implantation position.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing technology, and in particular to an implantation position determination method, device, electronic device and storage medium. Background Art

[0002] At present, in video playback platforms, it is often necessary to embed other resources in the video without affecting the user's viewing of the video content. For example, the embedded resources can be advertisements. For example, an advertisement poster image can be embedded on the wall in the video. Therefore, for the video playback platform, it is very important to determine the embedding position of the resource in the image screen so that the resource can be integrated into the video content without affecting the user's viewing experience.

[0003] In the related art, it is usually necessary to manually browse the video where the resource needs to be embedded so as to determine the embedding position of the resource in the video. However, this method has high labor cost and low efficiency. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, device, electronic device and storage medium for determining an implantation position, so as to reduce the cost of determining an implantation position and improve the efficiency of determining an implantation position. The specific technical solution is as follows:

[0005] In a first aspect of the present application, a method for determining an implantation position is first provided, the method comprising:

[0006] Acquire the video image that needs to be embedded with the two-dimensional image resource;

[0007] Based on the target detection algorithm, a video frame containing the specified object in the video image is determined as the first video frame; wherein when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-over-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold;

[0008] Based on the position of the designated object in the first video frame, an implantation position of the two-dimensional image resource in the video image is determined.

[0009] Optionally, the determining, based on the target detection algorithm, a video frame containing a specified object in the video image as the first video frame includes:

[0010] Based on the target detection algorithm, determining that the designated objects contained in the video image are video frames of the same object as the second video frames corresponding to the designated object;

[0011] The step of determining, based on the position of the designated object in the first video frame, the implantation position of the two-dimensional image resource in the video image comprises:

[0012] Based on the position of each designated object in the corresponding second video frame, an embedding position of the two-dimensional image resource in the video image is determined.

[0013] Optionally, the determining, based on the target detection algorithm, that the designated objects contained in the video image are video frames of the same object as the second video frames corresponding to the designated objects includes:

[0014] Determining a current video frame to be processed in the video image according to the order of the video frames in the video image;

[0015] Based on the target detection algorithm, detect whether the current video frame to be processed contains the specified object;

[0016] If it is determined based on the target detection algorithm that the current video frame to be processed contains the specified object, determining whether the specified object is determined in a video frame before the current video frame to be processed;

[0017] If the designated object is determined in a video frame before the current video frame to be processed, determining whether the designated object detected in the current video frame to be processed and the designated object determined in the previous video frame are the same object;

[0018] If the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame, then determining that the current video frame to be processed and the previous video frame belong to a set of video frames containing the same specified object; and returning to execute the step of determining the current video frame to be processed in the video image according to the order between the video frames in the video image;

[0019] Based on the similarity between the image regions occupied by the designated objects in the video frames, the video frames in the video frame set including the designated objects as the same object are determined as the second video frames corresponding to the designated objects.

[0020] Optionally, before determining, based on the similarity between the image areas occupied by the specified objects in the video frames, the video frames in the set of video frames including the specified objects as the same object as the second video frames corresponding to the specified objects, the method further includes:

[0021] Based on a shot segmentation algorithm, determining the shot to which each video frame in the video image belongs;

[0022] The method of determining, based on the similarity between the image areas occupied by the designated objects in the video frames, the video frames in the video frame set including the designated objects as the same object as the second video frames corresponding to the designated objects includes:

[0023] For each shot, based on the similarity between the image areas occupied by the designated object in the video frames, from the video frame sets belonging to the shot, a set of video frames containing the designated object as the same object is determined as the set of video frames corresponding to the designated object;

[0024] The video frames in the video frame set corresponding to the designated object are determined as the second video frames corresponding to the designated object.

[0025] Optionally, the method further includes:

[0026] If the specified object detected in the current video frame to be processed is not the same object as the specified object determined in the previous video frame, or if the specified object is not determined in the previous video frame of the current video frame to be processed, or if it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object, then determine the video frame containing the specified object determined last time as the current third video frame;

[0027] Based on the target tracking algorithm, determining whether the specified object determined in the current third video frame is tracked in the current video frame to be processed;

[0028] If, based on the target tracking algorithm, the specified object determined in the current third video frame is tracked in the current video frame to be processed, it is determined that the current video frame to be processed and the current third video frame belong to a set of video frames containing the same specified object; and the process returns to execute the step of determining the current video frame to be processed in the video image according to the order between the video frames in the video image.

[0029] Optionally, when it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object, before determining the video frame containing the specified object determined last time as the current third video frame, the method further includes:

[0030] Determine whether there are a preset number of continuous fourth video frames before the current video frame to be processed; wherein the fourth video frame represents a video frame determined not to contain the specified object;

[0031] The step of determining the last determined video frame containing the specified object as the current third video frame includes:

[0032] If there are no preset number of consecutive fourth video frames before the current video frame to be processed, determine the video frame containing the specified object determined last time as the current third video frame;

[0033] When there are a preset number of consecutive fourth video frames before the current video frame to be processed, it is determined that the current video frame to be processed does not contain the specified object, and the step of determining the current video frame to be processed in the video image according to the order between the video frames in the video image is returned to be executed.

[0034] Optionally, before determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame, the method further includes:

[0035] For each candidate object included in the video image, based on each second video frame corresponding to the candidate object, calculate the evaluation value of the candidate object for the preset evaluation item to obtain the object evaluation value of the candidate object; wherein the candidate object is determined based on the designated object included in the video image;

[0036] The preset evaluation items include at least one of the following: a completeness evaluation item, a clarity evaluation item, and a stability evaluation item;

[0037] The completeness evaluation item is used to represent: the maximum value of the completeness of the candidate object in each corresponding second video frame;

[0038] The clarity evaluation item is used to represent: the proportion of the foreground in the first image area corresponding to the candidate object; the first image area corresponding to the candidate object represents: the image area occupied by the candidate object in each corresponding second video frame;

[0039] The stability evaluation item is used to characterize: the change amplitude of the first image region corresponding to the candidate object;

[0040] The step of determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame includes:

[0041] Determine a target object from among the candidate objects based on the object evaluation value of each candidate object;

[0042] Based on the position of the target object in the corresponding second video frame, an implantation position of the two-dimensional image resource in the video image is determined.

[0043] Optionally, the evaluation value of a candidate object for the completeness evaluation item is calculated as follows:

[0044] For each second video frame corresponding to the candidate object, obtaining a detection value corresponding to the second video frame as the completeness of the candidate object in the second video frame; wherein the detection value corresponding to the second video frame represents a probability of determining that the second video frame contains the candidate object;

[0045] For each video frame set corresponding to the candidate object, calculating an average value of the completeness of the candidate object in each second video frame included in the video frame set as the average completeness of the candidate object in the video frame set;

[0046] The maximum value of the average completeness of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the completeness evaluation item.

[0047] Optionally, the evaluation value of a candidate object for the clarity evaluation item is calculated as follows:

[0048] For each second video frame corresponding to the candidate object, calculating the proportion of the foreground in the first image area corresponding to the candidate object in the second video frame as the clarity of the candidate object in the second video frame;

[0049] For each video frame set corresponding to the candidate object, calculating an average value of the clarity of the candidate object in each second video frame included in the video frame set as the average clarity of the candidate object in the video frame set;

[0050] The maximum value of the average definition of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the definition evaluation item.

[0051] Optionally, the stability evaluation item corresponding to a candidate object includes at least one of the following: a first stability evaluation sub-item, a second stability evaluation sub-item, and a third stability evaluation sub-item;

[0052] The evaluation value of a candidate object for the first stability evaluation sub-item is calculated in the following way:

[0053] For each second video frame corresponding to the candidate object, obtaining the coordinates of the center point of the first image region corresponding to the candidate object in the second video frame as the coordinates to be processed corresponding to the second video frame; and calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0054] For each video frame set corresponding to the candidate object, calculate the standard deviation of the coordinates to be processed corresponding to each second video frame included in the video frame set as the first standard deviation corresponding to the video frame set;

[0055] Calculating an average value of first areas to be processed corresponding to each second video frame included in the video frame set as an average area corresponding to the video frame set;

[0056] Calculating a ratio of a first standard deviation corresponding to the video frame set to an average area corresponding to the video frame set as the central point stability corresponding to the video frame set;

[0057] Determine an average value of the central point stability corresponding to each set of video frames corresponding to the candidate object as an evaluation value of the candidate object for the first stability evaluation sub-item;

[0058] The evaluation value of a candidate object for the second stability evaluation sub-item is calculated in the following way:

[0059] For each second video frame corresponding to the candidate object, calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0060] For each video frame set corresponding to the candidate object, calculate the standard deviation of the first area to be processed corresponding to each second video frame included in the video frame set as the second standard deviation corresponding to the video frame set;

[0061] Determine an average value of second standard deviations corresponding to each video frame set corresponding to the candidate object as an evaluation value of the candidate object for the second stability evaluation sub-item;

[0062] The evaluation value of a candidate object for the third stability evaluation sub-item is calculated as follows:

[0063] For each second video frame corresponding to the candidate object, determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that does not match the image region of a preset size, as the second area to be processed corresponding to the second video frame, and determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that matches the image region of the preset size, as the third area to be processed corresponding to the second video frame; wherein the image region of the preset size includes a first preset image region and a second preset image region, the width of the second preset image region is greater than the width of the first preset image region, and the height of the second preset image region is greater than the height of the first preset image region;

[0064] Calculating a ratio of a second area to be processed corresponding to the second video frame to a third area to be processed corresponding to the second video frame as an area ratio corresponding to the second video frame;

[0065] An average value of the area ratios corresponding to the second video frames corresponding to the candidate object is determined as an evaluation value of the candidate object for the third stability evaluation sub-item.

[0066] Optionally, before calculating, for each candidate object included in the video image, an evaluation value of the candidate object for a preset evaluation item based on each second video frame corresponding to the candidate object to obtain the object evaluation value of the candidate object, the method further includes:

[0067] For each designated object included in the video image, based on each second video frame corresponding to the designated object, obtain the appearance duration of the designated object in the video image;

[0068] Determine whether the appearance duration of the specified object is greater than a preset duration;

[0069] If the appearance duration of the designated object is greater than the preset duration, the designated object is determined as a candidate object.

[0070] In a second aspect of the present application, there is also provided an implantation position determination device, the device comprising:

[0071] A video image acquisition module, used to acquire video images that need to be embedded with two-dimensional image resources;

[0072] A first determination module is used to determine, based on a target detection algorithm, a video frame containing a specified object in the video image as a first video frame; wherein, when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-over-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold;

[0073] The implantation position determination module is used to determine the implantation position of the two-dimensional image resource in the video image based on the position of the designated object in the first video frame.

[0074] Optionally, the first determining module includes:

[0075] A first determination submodule is used to determine, based on a target detection algorithm, video frames of the same object as the designated objects contained in the video image as the second video frames corresponding to the designated object;

[0076] The implantation position determination module comprises:

[0077] The implantation position determination submodule is used to determine the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame.

[0078] Optionally, the first determining submodule includes:

[0079] A first determining unit, configured to determine a current video frame to be processed in the video image according to an order between video frames in the video image;

[0080] A designated object detection unit is used to detect whether the current video frame to be processed contains a designated object based on a target detection algorithm;

[0081] A first judgment unit is used to judge whether the specified object is determined in a previous video frame of the current video frame to be processed if it is determined based on the target detection algorithm that the current video frame to be processed contains the specified object;

[0082] A second judgment unit is used to judge whether the specified object detected in the current video frame to be processed and the specified object determined in the previous video frame are the same object if the specified object is determined in the previous video frame of the current video frame to be processed;

[0083] a second determining unit, configured to determine that the current video frame to be processed and the previous video frame belong to a set of video frames containing the same specified object if the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame; and trigger the first determining unit;

[0084] The third determining unit is used to determine the video frames in the video frame set including the designated object as the same object as the second video frames corresponding to the designated object based on the similarity between the image areas occupied by the designated object in the video frames.

[0085] Optionally, the device further comprises:

[0086] a shot determination module, configured to determine the shot to which each video frame in the video image belongs based on a shot segmentation algorithm before determining the video frames in the video frame set containing the same designated object as the second video frames corresponding to the designated object based on the similarity between the image areas occupied by the designated object in the video frames;

[0087] The third determining unit is specifically configured to determine, for each shot, based on the similarity between the image areas occupied by the designated objects in the video frames, a set of video frames containing the designated objects as the same object from among the sets of video frames belonging to the shot as the set of video frames corresponding to the designated object;

[0088] The video frames in the video frame set corresponding to the designated object are determined as the second video frames corresponding to the designated object.

[0089] Optionally, the device further comprises:

[0090] A second determination module is used to determine the video frame containing the specified object determined last time as the current third video frame if the specified object detected in the current video frame to be processed is not the same object as the specified object determined in the previous video frame, or if the specified object is not determined in the previous video frame of the current video frame to be processed, or if it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object;

[0091] A designated object tracking module, used to determine whether the designated object determined in the current third video frame is tracked in the current video frame to be processed based on a target tracking algorithm;

[0092] A video frame set determination module is used to determine that the current video frame to be processed and the current third video frame belong to a video frame set containing the same specified object if the specified object determined in the current third video frame is tracked in the current video frame to be processed based on the target tracking algorithm; and trigger the first determination unit.

[0093] Optionally, the device further comprises:

[0094] A first judgment module is used for, when it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object, and before determining the video frame containing the specified object determined last time as the current third video frame, judging whether there are a preset number of continuous fourth video frames before the current video frame to be processed; wherein the fourth video frame represents the video frame determined not to contain the specified object;

[0095] The second determination module is specifically configured to determine the video frame containing the specified object determined last time as the current third video frame when there is no preset number of consecutive fourth video frames before the current video frame to be processed;

[0096] When there are a preset number of continuous fourth video frames before the current video frame to be processed, it is determined that the current video frame to be processed does not include the specified object, and the first determining unit is triggered.

[0097] Optionally, the device further comprises:

[0098] The object evaluation value calculation module is used to calculate the evaluation value of each candidate object included in the video image based on each second video frame corresponding to the candidate object for a preset evaluation item before determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame, so as to obtain the object evaluation value of the candidate object; wherein the candidate object is determined based on the designated object included in the video image;

[0099] The preset evaluation items include at least one of the following: a completeness evaluation item, a clarity evaluation item, and a stability evaluation item;

[0100] The completeness evaluation item is used to represent: the maximum value of the completeness of the candidate object in each corresponding second video frame;

[0101] The clarity evaluation item is used to represent: the proportion of the foreground in the first image area corresponding to the candidate object; the first image area corresponding to the candidate object represents: the image area occupied by the candidate object in each corresponding second video frame;

[0102] The stability evaluation item is used to characterize: the change amplitude of the first image region corresponding to the candidate object;

[0103] The implantation position determination submodule is specifically used to determine the target object from each candidate object based on the object evaluation value of each candidate object;

[0104] Based on the position of the target object in the corresponding second video frame, an implantation position of the two-dimensional image resource in the video image is determined.

[0105] Optionally, the evaluation value of a candidate object for the completeness evaluation item is calculated as follows:

[0106] For each second video frame corresponding to the candidate object, obtaining a detection value corresponding to the second video frame as the completeness of the candidate object in the second video frame; wherein the detection value corresponding to the second video frame represents a probability of determining that the second video frame contains the candidate object;

[0107] For each video frame set corresponding to the candidate object, calculating an average value of the completeness of the candidate object in each second video frame included in the video frame set as the average completeness of the candidate object in the video frame set;

[0108] The maximum value of the average completeness of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the completeness evaluation item.

[0109] Optionally, the evaluation value of a candidate object for the clarity evaluation item is calculated as follows:

[0110] For each second video frame corresponding to the candidate object, calculating the proportion of the foreground in the first image area corresponding to the candidate object in the second video frame as the clarity of the candidate object in the second video frame;

[0111] For each video frame set corresponding to the candidate object, calculating an average value of the clarity of the candidate object in each second video frame included in the video frame set as the average clarity of the candidate object in the video frame set;

[0112] The maximum value of the average definition of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the definition evaluation item.

[0113] Optionally, the stability evaluation item corresponding to a candidate object includes at least one of the following: a first stability evaluation sub-item, a second stability evaluation sub-item, and a third stability evaluation sub-item;

[0114] The evaluation value of a candidate object for the first stability evaluation sub-item is calculated in the following way:

[0115] For each second video frame corresponding to the candidate object, obtaining the coordinates of the center point of the first image region corresponding to the candidate object in the second video frame as the coordinates to be processed corresponding to the second video frame; and calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0116] For each video frame set corresponding to the candidate object, calculate the standard deviation of the coordinates to be processed corresponding to each second video frame included in the video frame set as the first standard deviation corresponding to the video frame set;

[0117] Calculating an average value of first areas to be processed corresponding to each second video frame included in the video frame set as an average area corresponding to the video frame set;

[0118] Calculating a ratio of a first standard deviation corresponding to the video frame set to an average area corresponding to the video frame set as the central point stability corresponding to the video frame set;

[0119] Determine an average value of the central point stability corresponding to each set of video frames corresponding to the candidate object as an evaluation value of the candidate object for the first stability evaluation sub-item;

[0120] The evaluation value of a candidate object for the second stability evaluation sub-item is calculated in the following way:

[0121] For each second video frame corresponding to the candidate object, calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0122] For each video frame set corresponding to the candidate object, calculate the standard deviation of the first to-be-processed area corresponding to each second video frame included in the video frame set as the second standard deviation corresponding to the video frame set;

[0123] Determine an average value of second standard deviations corresponding to each video frame set corresponding to the candidate object as an evaluation value of the candidate object for the second stability evaluation sub-item;

[0124] The evaluation value of a candidate object for the third stability evaluation sub-item is calculated as follows:

[0125] For each second video frame corresponding to the candidate object, determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that does not match the image region of a preset size, as the second area to be processed corresponding to the second video frame, and determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that matches the image region of the preset size, as the third area to be processed corresponding to the second video frame; wherein the image region of the preset size includes a first preset image region and a second preset image region, the width of the second preset image region is greater than the width of the first preset image region, and the height of the second preset image region is greater than the height of the first preset image region;

[0126] Calculating a ratio of a second area to be processed corresponding to the second video frame to a third area to be processed corresponding to the second video frame as an area ratio corresponding to the second video frame;

[0127] An average value of the area ratios corresponding to the second video frames corresponding to the candidate object is determined as an evaluation value of the candidate object for the third stability evaluation sub-item.

[0128] Optionally, the device further comprises:

[0129] an appearance duration acquisition module, for calculating the evaluation value of each candidate object for a preset evaluation item based on each second video frame corresponding to the candidate object for each candidate object included in the video image, and obtaining the object evaluation value of the candidate object, and for each designated object included in the video image, obtaining the appearance duration of the designated object in the video image based on each second video frame corresponding to the designated object;

[0130] The second judging module is used to judge whether the appearance time of the specified object is greater than a preset time;

[0131] The candidate object determination module is used to determine the specified object as a candidate object if the appearance duration of the specified object is greater than a preset duration.

[0132] In a third aspect of the implementation of the present application, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0133] Memory, used to store computer programs;

[0134] The processor is used to implement any of the above-mentioned implantation position determination method steps when executing the program stored in the memory.

[0135] In another aspect of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any of the above-mentioned implantation position determination methods is implemented.

[0136] In another aspect of the present application, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned implantation position determination methods.

[0137] An embodiment of the present application provides an implantation position determination method, which comprises acquiring a video image in which a two-dimensional image resource needs to be implanted; determining, based on a target detection algorithm, a video frame containing a specified object in the video image as a first video frame; wherein, when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-and-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold; and determining an implantation position in the video image for implanting the two-dimensional image resource based on the position of the specified object in the first video frame.

[0138] Based on the above processing, the designated object in the video image can be determined. Since when the two-dimensional image resource is implanted at the position of the designated object in the first video frame, the intersection and union ratio of the image area occupied by the two-dimensional image resource and the image area occupied by the designated object is greater than the preset threshold, that is, the two-dimensional image resource can be implanted at the position of the designated object. Accordingly, the implantation position of the two-dimensional image resource in the video image can be determined according to the position of the designated object in the first video frame. Based on this, the automatic detection of the implantation position by the electronic device can reduce the labor cost and improve the efficiency of determining the implantation position compared with manually browsing the video image to determine the implantation position. BRIEF DESCRIPTION OF THE DRAWINGS

[0139] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0140] Figure 1 A first flow chart of the implantation position determination method provided in an embodiment of the present application;

[0141] Figure 2 A second flow chart of the implantation position determination method provided in an embodiment of the present application;

[0142] Figure 3A third flow chart of the implantation position determination method provided in an embodiment of the present application;

[0143] Figure 4 A fourth flow chart of the implantation position determination method provided in an embodiment of the present application;

[0144] Figure 5 A fifth flow chart of the implantation position determination method provided in an embodiment of the present application;

[0145] Figure 6 A flowchart for determining a set of video frames containing the same specified object provided in an embodiment of the present application;

[0146] Figure 7 A schematic diagram of a foreground portion of a video frame provided in an embodiment of the present application;

[0147] Figure 8 A schematic diagram of the relationship between a first image area corresponding to a candidate object and an image area of ​​a preset size provided in an embodiment of the present application;

[0148] Fig. 9 A flowchart of calculating the evaluation value of a candidate object for a preset evaluation item provided in an embodiment of the present application;

[0149] Fig.10 A flow chart of clustering a set of video frames provided in an embodiment of the present application;

[0150] Fig.11 A schematic diagram of a video frame set clustering result provided in an embodiment of the present application;

[0151] Fig.12 A sixth flow chart of the implantation position determination method provided in an embodiment of the present application;

[0152] Fig.13 A schematic diagram of the structure of an implantation position determination device provided in an embodiment of the present application;

[0153] Fig.14 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0154] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0155] At present, in video playback platforms, it is often necessary to embed other resources in the video without affecting the user's viewing of the video content. For example, the embedded resources can be advertisements. For example, an advertisement poster image can be embedded on the wall in the video, or an advertisement poster image can be embedded on the billboard in the video. Therefore, for the video playback platform, it is very important to determine the embedding position of the resource in the image screen so that the resource can be integrated into the video content without affecting the user's viewing experience.

[0156] In the related art, it is usually necessary to manually browse the video where the resource needs to be embedded so as to determine the embedding position of the resource in the video. However, this method has high labor cost and low efficiency.

[0157] In order to reduce the cost of implantation position determination and improve the efficiency of implantation position determination, the present application embodiment provides an implantation position determination method. Figure 1 , Figure 1 A first flow chart of a method for determining an implantation position provided in an embodiment of the present application, the method comprising the following steps:

[0158] Step S101: obtaining a video image into which a two-dimensional image resource needs to be embedded.

[0159] Step S102: Based on the target detection algorithm, determine a video frame containing a specified object in the video image as the first video frame.

[0160] When the two-dimensional image resource is implanted at the position of the designated object in the first video frame, an intersection-and-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the designated object is greater than a preset threshold.

[0161] Step S103: Determine an embedding position for embedding the two-dimensional image resource in the video image based on the position of the designated object in the first video frame.

[0162] Based on the above processing, the designated object in the video image can be determined. Since when the two-dimensional image resource is implanted at the position of the designated object in the first video frame, the intersection and union ratio of the image area occupied by the two-dimensional image resource and the image area occupied by the designated object is greater than the preset threshold, that is, the two-dimensional image resource can be implanted at the position of the designated object. Accordingly, the implantation position of the two-dimensional image resource in the video image can be determined according to the position of the designated object in the first video frame. Based on this, the automatic detection of the implantation position by the electronic device can reduce the labor cost and improve the efficiency of determining the implantation position compared with manually browsing the video image to determine the implantation position.

[0163] For step S101, the video image that needs to be embedded with the two-dimensional image resource, that is, the video image for which the embedding position of the two-dimensional image resource is currently to be determined, can be, for example, a video image of a TV series, or a video image of a movie. The two-dimensional image resource can be a two-dimensional picture, for example, a poster picture of an advertisement.

[0164] For step S102, the preset threshold value may be 0.75 or 0.8. When the two-dimensional image resource is implanted at the position of the designated object in the first video frame, the intersection-and-union ratio of the image area occupied by the two-dimensional image resource and the image area occupied by the designated object is greater than the preset threshold value. That is, the image area occupied by the two-dimensional image resource and the image area occupied by the designated object have a large overlapping portion. For example, the image area occupied by the two-dimensional image resource and the image area occupied by the designated object may completely overlap, that is, the intersection-and-union ratio of the image area occupied by the two-dimensional image resource and the image area occupied by the designated object is 1.

[0165] For example, the designated object may have a plane with an angle greater than a preset angle with the horizontal direction in the first video frame. That is, from the user's viewing angle, the designated object has a plane that is biased toward the vertical direction. For example, the preset angle may be 75° or 85°. For example, the designated object may be a wall, a green belt, a lamp post of a street lamp, a display screen, or a billboard.

[0166] In order to ensure the user's viewing experience, the image area occupied by the designated object may be filled with a two-dimensional image resource, so that the image area occupied by the designated object and the image area occupied by the two-dimensional image resource have a large overlap. For example, the two-dimensional image resource may be an advertisement poster image, and the designated object may be a billboard. In real life scenarios, advertisement poster images are usually filled in billboards, so the image area occupied by the billboard in the video image may be filled with advertisement poster images.

[0167] The video image includes multiple video frames. For any video frame, there may be one specified object, multiple specified objects, or no specified object in the video frame. In the present application, a target detection algorithm can be used to detect whether a video frame contains a specified object, and then the video frame containing the specified object can be determined as the first video frame. It is understandable that there can be multiple first video frames determined. For example, for any video frame, if the video frame contains at least one specified object, the video can be determined as the first video frame.

[0168] The target detection algorithm may be an R-CNN (Region-based Convolutional Neural Networks) algorithm, an SSD (Single Shot MultiBox Detector) algorithm, or a YOLO (You Only Look Once) algorithm.

[0169] With respect to step S103 , for example, the position of the designated object in the first video frame may be determined as the implantation position for implanting the two-dimensional image resource in the video image.

[0170] In addition, when there are multiple video frames that contain the specified object, see Figure 2 , Figure 2 The second flow chart of the implantation position determination method provided in the embodiment of the present application, based on the target detection algorithm, determines a video frame containing a specified object in a video image as a first video frame (S102), including:

[0171] Step S1021: Based on the target detection algorithm, determine that the designated object contained in the video image is a video frame of the same object as each second video frame corresponding to the designated object.

[0172] Determining an implantation position of a two-dimensional image resource in a video image based on a position of a designated object in a first video frame (S103), including:

[0173] Step S1031: Determine an embedding position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame.

[0174] In an embodiment of the present application, if the first video frame contains multiple specified objects, then for any one of the multiple specified objects, multiple first video frames containing the specified object can be determined, and the multiple first video frames are the second video frames corresponding to the specified object.

[0175] For example, based on the target detection algorithm, the first video frame containing the specified object in the video image can be determined, and then, based on the similarity between the image areas occupied by the specified object in the first video frames, it is determined whether the specified objects contained in any two first video frames are the same object, and the first video frame containing the specified object as the same object is determined as the second video frame corresponding to the specified object.

[0176] Subsequently, the position at which the two-dimensional image resource is implanted in the video image may be determined based on the position of each designated object in the corresponding second video frame. For example, the position of any designated object in the corresponding second video frame may be determined as the position at which the two-dimensional image resource is implanted in the video image; or, multiple designated objects may be screened, and the position at which the two-dimensional image resource is implanted in the video image may be determined based on the screening result.

[0177] Based on this, for any designated object, the second video frame containing the designated object in the video image can be determined. That is, the video frames containing the designated object in the video image can be associated, and subsequently, based on the position of the designated object in each corresponding second video frame, the position of the two-dimensional image resource to be implanted in the video image is determined, which can avoid the situation where the position of the same designated object in different video frames is determined as different implantation positions for implanting the two-dimensional image resource, further ensuring the effect of implanting the two-dimensional image resource.

[0178] In one embodiment, Figure 2 Based on Figure 3 , Figure 3 The third flow chart of the implantation position determination method provided in the embodiment of the present application, based on the target detection algorithm, determines that the designated objects contained in the video image are video frames of the same object as the second video frames corresponding to the designated objects (S1021), including:

[0179] Step S10211: Determine the current video frame to be processed in the video image according to the order of the video frames in the video image.

[0180] Step S10212: Based on the target detection algorithm, detect whether the current video frame to be processed contains the specified object. If yes, execute step S10213; if not, execute step S10219.

[0181] Step S10213: Determine whether the designated object is determined in the previous video frame of the current video frame to be processed. If yes, execute step S10214; if not, execute step S10216.

[0182] Step S10214: Determine whether the designated object detected in the current video frame to be processed is the same as the designated object determined in the previous video frame. If yes, execute step S10215; if not, execute step S10216.

[0183] Step S10215: Determine whether the current video frame to be processed and the previous video frame belong to a video frame set containing the same specified object. If the current video frame to be processed is the last frame in the video image, execute step S102111; if the current video frame to be processed is not the last frame in the video image, return to execute step S10211.

[0184] Step S10216: Determine the video frame containing the specified object determined last time as the current third video frame.

[0185] Step S10217: Based on the target tracking algorithm, determine whether the designated object determined in the current third video frame is tracked in the current video frame to be processed. If yes, execute step S10218.

[0186] Step S10218: Determine whether the current video frame to be processed and the current third video frame belong to a video frame set containing the same specified object. If the current video frame to be processed is the last frame in the video image, execute step S102111; if the current video frame to be processed is not the last frame in the video image, return to execute step S10211.

[0187] Step S10219: Determine whether there are a preset number of consecutive fourth video frames before the current video frame to be processed. If not, execute step S10216; if yes, execute step S102110.

[0188] The fourth video frame represents a video frame that is determined not to contain the specified object. That is, for the fourth video frame, it is determined based on both the target detection algorithm and the target tracking algorithm that it does not contain the specified object.

[0189] Step S102110: Determine whether the current video frame to be processed does not contain the specified object. If the current video frame to be processed is the last frame in the video image, execute step S102111; if the current video frame to be processed is not the last frame in the video image, return to execute step S10211.

[0190] Step S102111: based on the similarity between the image regions occupied by the designated objects in the video frames, video frames in a set of video frames that include the designated objects as the same object are determined as second video frames corresponding to the designated objects.

[0191] In the embodiment of the present application, each video frame in the video image may be processed in sequence according to the order between the video frames in the video image to determine whether a specified object exists in the video frame.

[0192] For example, there are N video frames in the video image, and the video frames in the video image can be numbered in sequence, and then the first frame, the second frame, ..., the Nth frame can be determined as the current video frames to be processed in sequence, and processed according to the above steps S10212 to S102110. It can be understood that for the first frame, it is only necessary to detect whether the frame contains a specified object based on the target detection algorithm, without determining whether the specified object is determined in the previous video frame.

[0193] If it is determined based on the target detection algorithm that the current video frame to be processed contains a specified object, and the specified object is determined in a video frame before the current video frame to be processed, then it is determined whether the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame.

[0194] For example, the overlap between the image area occupied by the specified object detected in the current video frame to be processed and the image area occupied by the specified object determined in the previous video frame can be calculated. For example, the overlap can be expressed by the IoU (Intersection over Union) of the two image areas.

[0195] When the calculated overlap reaches the preset overlap threshold, it indicates that the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame, and it can be determined that the current video frame to be processed and the previous video frame belong to a set of video frames containing the same specified object. Accordingly, the same identifier (which can be called a target ID) can be used to mark video frames belonging to the same set of video frames.

[0196] Based on the above processing, the video frames in the video image that are adjacent and contain the same designated object can be determined to belong to a set of video frames. Since in the entire video image, the same designated object may appear in different segments, that is, different sets of video frames may also contain the same designated object, therefore, based on the similarity between the image areas occupied by the designated objects in the video frames, the video frames in the set of video frames containing the same designated object can be determined as the second video frames corresponding to the designated object. In this way, for any designated object, the video frame containing the designated object in the entire video image can be determined. That is, the video frames containing the designated object in the entire video image can be associated, and subsequently, based on the position of the designated object in the corresponding second video frames, the implantation position of the two-dimensional image resource in the video image is determined, which can avoid the situation where the position of the same designated object in different video frames is determined as different implantation positions for implanting the two-dimensional image resource, and further ensure the effect of implanting the two-dimensional image resource.

[0197] Since the same designated object may appear in different segments in the entire video image, that is, the same designated object may appear in non-adjacent video frames. Therefore, if the designated object detected in the current video frame to be processed is not the same object as the designated object determined in the previous video frame, or the designated object is not determined in the previous video frame of the current video frame to be processed, the designated object determined in the current third video frame (which may be referred to as the first designated object) may be tracked based on the target tracking algorithm using the video frame containing the designated object determined last time (that is, the current third video frame).

[0198] If the first designated object is tracked in the current video frame to be processed, it is determined that the current video frame to be processed and the current third video frame belong to a video frame set containing the first designated object. The current video frame to be processed in the video image is determined according to the order between the video frames in the video image, so that non-adjacent video frames in the video image and containing the same designated object can be determined as belonging to a video frame set.

[0199] It can be understood that the designated object determined in the previous video frame and the designated object determined in the current third video frame can be determined based on a target detection algorithm, or can also be determined based on a target tracking algorithm.

[0200] For example, the target tracking algorithm may be a CSRT (Correlation Filter-based Tracking) algorithm, a KCF tracker (Kernelized Correlation Filters tracker) algorithm, or a MIL tracker (Multiple Instance Learning tracker) algorithm.

[0201] Since the same designated object may appear in different segments in the entire video image, based on the above processing, non-adjacent video frames in the video image that contain the same designated object can be determined to belong to a set of video frames. In this way, for any designated object, the video frame that contains the designated object in the entire video image can be determined. That is, the video frames that contain the designated object in the entire video image can be associated, and then, based on the position of the designated object in the corresponding second video frames, the implantation position of the two-dimensional image resource in the video image is determined, which can avoid the situation where the position of the same designated object in different video frames is determined as different implantation positions for implanting the two-dimensional image resource, further ensuring the effect of the implantation of the two-dimensional image resource.

[0202] Due to the influence of the accuracy of the target detection algorithm, the target detection algorithm may not be able to detect the specified object contained in the current video frame to be processed. Therefore, in the embodiment of the present application, if the target detection algorithm determines that the current video frame to be processed does not contain the specified object, the last determined video frame containing the specified object (i.e., the current third video frame) can be used to track the first specified object based on the target tracking algorithm.

[0203] If the first designated object is tracked in the current video frame to be processed, it is determined that the current video frame to be processed and the current third video frame belong to a video frame set containing the same designated object. The current video frame to be processed in the video image is determined according to the order between the video frames in the video image, so that the video frames containing the same designated object in the video image are determined to belong to a video frame set.

[0204] Based on the above processing, for any designated object, the situation where the video frame that partially contains the designated object in the video image is not determined due to the influence of the accuracy of the target detection algorithm can be avoided, and the video frame that contains the designated object in the entire video image can be determined. That is, the video frames that contain the designated object in the entire video image can be associated, and then, based on the position of the designated object in each corresponding second video frame, the implantation position of the two-dimensional image resource in the video image is determined, which can avoid the situation where only the position of the same designated object in a part of the video frames is determined as the implantation position of the two-dimensional image resource, and can further ensure the effect of the implantation of the two-dimensional image resource.

[0205] When it is necessary to embed advertisements in video images, the method provided based on the above embodiment can avoid the situation where only the position of the same designated object in a part of the video frames is determined as the embedding position of the embedded advertisement, and avoid the situation where the positions of the same designated object in different video frames are determined as different embedding positions of the embedded advertisement, thereby avoiding the situation where the advertisement embedding is exposed.

[0206] In a video image, a specified object may appear in different segments, but if the specified object does not exist in multiple consecutive video frames, the specified object may not exist in subsequent video frames. Therefore, in an embodiment of the present application, if there are no preset number of consecutive fourth video frames before the current video frame to be processed, it indicates that the specified object may still exist in the current video frame to be processed, and therefore, the current video frame to be processed can be tracked. The preset number may be 10, or 20.

[0207] On the contrary, if there are a preset number of consecutive fourth video frames before the current video frame to be processed, it means that the current video frame to be processed and the subsequent video frames may not contain the specified object. Here, there is no need to perform target tracking on the current video frame to be processed, and it is directly determined that the current video frame to be processed does not contain the specified object.

[0208] Based on the above processing, it is not necessary to track every video frame in the video image, which can improve the efficiency of implantation position determination.

[0209] In addition, since there may be multiple designated objects, the multiple designated objects may be screened, and based on the screening result, the implantation position of the two-dimensional image resource in the video image is determined. Figure 4 , Figure 4 The fourth flow chart of the method for determining an implantation position provided in an embodiment of the present application, before determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame (S1031), the method may further include:

[0210] Step S104: for each candidate object included in the video image, based on each second video frame corresponding to the candidate object, calculating the evaluation value of the candidate object for the preset evaluation item, to obtain the object evaluation value of the candidate object.

[0211] The candidate objects are determined based on the designated objects contained in the video image.

[0212] The preset evaluation items include at least one of the following: a completeness evaluation item, a clarity evaluation item, and a stability evaluation item. The completeness evaluation item is used to characterize: the maximum value of the completeness of the candidate object in each corresponding second video frame. The clarity evaluation item is used to characterize: the proportion of the foreground in the first image area corresponding to the candidate object; the first image area corresponding to the candidate object represents: the image area occupied by the candidate object in each corresponding second video frame. The stability evaluation item is used to characterize: the change amplitude of the first image area corresponding to the candidate object.

[0213] Accordingly, based on the position of each designated object in the corresponding second video frame, determining the implantation position of the two-dimensional image resource in the video image (S1031) includes:

[0214] Step S10311: Determine a target object from among the candidate objects based on the object evaluation value of each candidate object.

[0215] Step S10312: Determine an implantation position of the two-dimensional image resource in the video image based on the position of the target object in the corresponding second video frame.

[0216] In the embodiment of the present application, if the first video frame contains multiple specified objects, then for any one of the multiple specified objects, multiple first video frames containing the specified object can be determined, and the multiple first video frames are the second video frames corresponding to the specified object. For example, based on the similarity between the image areas occupied by the specified objects in the first video frames, it can be determined whether the specified objects contained in any two first video frames are the same object.

[0217] In one implementation, each designated object determined in the first video frame may be directly determined as a candidate object.

[0218] In another implementation, the candidate objects may be determined by screening the designated objects determined in the first video frame. Figure 5 , Figure 5 The fifth flow chart of the implantation position determination method provided in the embodiment of the present application. Before calculating the evaluation value of each candidate object included in the video image based on each second video frame corresponding to the candidate object for the preset evaluation item and obtaining the object evaluation value of the candidate object (S104), the implantation position determination method further includes:

[0219] Step S105: for each designated object included in the video image, based on each second video frame corresponding to the designated object, obtain the appearance duration of the designated object in the video image.

[0220] Step S106: Determine whether the appearance duration of the designated object is greater than a preset duration.

[0221] Step S107: If the appearance duration of the designated object is greater than the preset duration, the designated object is determined as a candidate object.

[0222] In an embodiment of the present application, the duration of appearance of each designated object in the video image can be obtained based on each second video frame corresponding to each designated object. For example, the number of second video frames corresponding to the designated object can be counted to indicate the duration of appearance of the designated object in the video image. Accordingly, the preset duration can be a preset number of frames, for example, 144 frames or 192 frames.

[0223] Alternatively, the duration of each second video frame corresponding to the specified object in the video image may be counted as the duration of appearance of the specified object in the video image. Accordingly, the preset duration may be a preset time length, for example, 6 seconds or 8 seconds.

[0224] The longer the appearance time of the specified object in the video image, the better the implantation effect will be if the two-dimensional image resource is implanted at the position of the specified object. Therefore, the specified objects can be screened based on the appearance time, that is, the position of the specified object with a shorter appearance time is not suitable for implanting the two-dimensional image resource.

[0225] In addition, based on the appearance duration of the designated objects, the designated objects in the video image are screened, and the designated objects with longer appearance durations are determined as candidate objects, so that the designated objects with shorter appearance durations can be screened out. Furthermore, based on the designated objects with longer appearance durations (i.e., candidate objects), the implantation position of the two-dimensional image resource in the video image can be determined, without executing the subsequent step S104 for each designated object, thereby further improving the efficiency of implantation position determination.

[0226] For each candidate object, based on each second video frame corresponding to the candidate object, an evaluation value of the candidate object for the preset evaluation item is calculated to obtain an object evaluation value of the candidate object.

[0227] It can be understood that the greater the maximum value of the completeness of the candidate object in each corresponding second video frame, the more complete the two-dimensional image resource can be implanted at the position of the candidate object in the video image. Therefore, the specified object can be screened based on the completeness evaluation item.

[0228] As mentioned above, the clarity evaluation item of a candidate object is used to characterize the proportion of the foreground in the first image area corresponding to the candidate object. The first image area corresponding to the candidate object is the image area occupied by the candidate object in each corresponding second video frame. Specifically, the first image area can be the image area corresponding to the minimum circumscribed rectangle of the candidate object in the corresponding second video frame. The first image area can be marked with a target frame, that is, the target frame is a frame represented by the boundary of the first image area.

[0229] In addition, in order to highlight the foreground in the video image, the background is often processed in a defocused manner, so the foreground in the video image is clearer. Therefore, the higher the proportion of the foreground in the first image area corresponding to the candidate object, the higher the proportion of the foreground in the first image area corresponding to the candidate object. Accordingly, the two-dimensional image resource can be implanted at the position of the candidate object in the video image, so that the implanted two-dimensional image resource can be clearer in the video image. Therefore, the specified object can be screened based on the clarity evaluation item.

[0230] In one embodiment, the clarity evaluation item may be used to characterize the clarity of the first image region corresponding to the candidate object, wherein the clarity of the first image region corresponding to the candidate object may be obtained based on a preset clarity evaluation method. For example, the preset clarity evaluation method may be a Tenengrad (a gradient-based function) gradient method, a Laplacian gradient method, or a variance method.

[0231] In addition, the smaller the change range of the first image area corresponding to the candidate object is, the more stable the position of the candidate object in the video image is. Accordingly, implanting a two-dimensional image resource at the position of the candidate object in the video image can make the implanted two-dimensional image resource appear more stable in the video image. Thus, the effect of implanting the two-dimensional image resource can be better. Therefore, the specified object can be screened based on the stability evaluation item.

[0232] It can be understood that the preset evaluation items may include any one or any two of the completeness evaluation item, the clarity evaluation item and the stability evaluation item, or may also include all three items.

[0233] Correspondingly, the evaluation value of each candidate object for the preset evaluation item (i.e., the object evaluation value) can be obtained based on any one, any two, or any three of the evaluation values ​​of the completeness evaluation item (which can be called the detection score), the evaluation value of the clarity evaluation item (which can be called the clarity score), and the evaluation value of the stability evaluation item (which can be called the stability score) of each candidate object in the corresponding second video frames.

[0234] The object evaluation value is positively correlated with the calculated multiple evaluation values. For example, the sum of the calculated multiple evaluation values ​​can be used as the object evaluation value. In addition, when calculating the sum, weights can be set for different evaluation items respectively, and then the weighted sum of the multiple evaluation values ​​can be calculated as the object evaluation value.

[0235] For example, the candidate object with the highest object evaluation value can be determined as the target object. In this way, the implantation position can be automatically determined by the electronic device, which can reduce labor costs and improve the efficiency of determining the implantation position compared to manually browsing video images to determine the implantation position. Alternatively, multiple candidate objects with the highest object evaluation values ​​can be selected as the target object. Subsequently, the multiple candidate objects and their corresponding object evaluation values ​​can be provided to the user, so that the user can further screen the multiple candidate objects.

[0236] Based on the above processing, the target object can be determined from the candidate objects based on the preset evaluation items, and then the position of the target object in the video image can be determined as the implantation position for implanting the two-dimensional image resource in the video image. In other words, the implantation position with a better effect of implanting the two-dimensional image resource can be determined, and the efficiency of implantation position determination is improved while improving the effect of implanting the two-dimensional image resource at the determined implantation position.

[0237] In one embodiment, see Figure 6 , Figure 6 A flowchart for determining a set of video frames containing the same specified object is provided in an embodiment of the present application.

[0238] Step S601: Obtain the i-th frame of the picture. That is, obtain the i-th frame of the picture in the video image as the current video frame to be processed, and the initial value of i is 1.

[0239] Step S602: Target detection: That is, based on the target detection algorithm, it is detected whether the current video frame to be processed contains a specified object.

[0240] Step S603: Determine whether there is a target. That is, based on the result of target detection, determine whether the current video frame to be processed contains a target (i.e., a specified object). If the current video frame to be processed contains a target, execute step S604; if the current video frame to be processed does not contain a target, execute step S605.

[0241] Step S604: Determine whether there is a target in the previous frame. That is, determine whether the specified object is determined in the previous video frame of the current video frame to be processed. If the specified object is determined in the previous video frame of the current video frame to be processed, execute step S606; if the specified object is not determined in the previous video frame of the current video frame to be processed, execute step S607.

[0242] Step S605: Determine whether the duration of continuous absence of detection results exceeds a threshold. That is, determine whether there are a preset number of continuous fourth video frames before the current video frame to be processed. The fourth video frame represents a video frame determined not to contain the specified object. If there are a preset number of continuous fourth video frames before the current video frame to be processed, then end; if there are no preset number of continuous fourth video frames before the current video frame to be processed, then execute step S607.

[0243] The end here only ends the process for the specified object, and the process for other specified objects can continue.

[0244] Step S606: Determine whether the degree of coincidence with the target of the previous frame reaches a threshold. That is, determine whether the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame. If the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame, execute step S608; if the specified object detected in the current video frame to be processed is not the same object as the specified object determined in the previous video frame, execute step S607.

[0245] Step S607: target tracking. That is, based on the target tracking algorithm, target tracking is performed on the specified object determined in the current third video frame. The current third video frame is the video frame containing the specified object determined last time.

[0246] Step S608: Update object_result. After updating object_result, return to step S601 and assign the value of i to i+1.

[0247] Step S609: Determine whether the target is tracked. That is, determine whether the specified object determined in the current third video frame is tracked in the current video frame to be processed. If the specified object determined in the current third video frame is tracked in the current video frame to be processed, then execute step S608; if the specified object determined in the current third video frame is not tracked in the current video frame to be processed, then end.

[0248] In the embodiment of the present application, object_result is a set of detection and tracking results obtained after target detection and tracking of the specified object, which is used to record the detection and tracking results of each specified object. For each specified object, the detection and tracking results of the specified object are shown in Table (1). The information recorded in Table (1) is as follows:

[0249] TrackId, data type is Int (integer), target tracking result ID, that is, the target ID in the above embodiment.

[0250] Label, data type is Str (string type), target tracking result label, that is, the category of the specified object. The category of the specified object can be a building, billboard, street lamp post, telephone pole or green belt.

[0251] DetectScore, data type is List, target detection score, that is, the probability of containing a specified object in a video frame based on the target detection algorithm (which can be called the first probability). For a video frame, if the first probability is greater than the preset detection probability threshold, it is determined that the video frame contains the specified object, and the DetectScore corresponding to the video frame is recorded as the first probability. If the first probability is less than the preset detection probability threshold, it is determined that the video frame does not contain the specified object, and the DetectScore corresponding to the video frame is recorded as -1. The preset detection probability threshold can be 0.7 or 0.8.

[0252] TrackScore, data type is List, target tracking score, that is, the probability (which can be called the second probability) that a specified object is contained in a video frame based on the target tracking algorithm. For a video frame, if the second probability is greater than the preset tracking probability threshold, it is determined that the video frame contains the specified object, and the TrackScore corresponding to the video frame is recorded as the second probability. If the second probability is less than the preset tracking probability threshold, it is determined that the video frame does not contain the specified object, and the TrackScore corresponding to the video frame is recorded as -1. The preset tracking probability threshold can be 0.7 or 0.8.

[0253] FrameId, data type is List, contains the frame number of the target, that is, the serial number of the video frame containing the specified object. For example, there are N video frames in the video image, and the video frames in the video image can be numbered in sequence. Then, the serial number of each video frame in the video image can be obtained, and when the video frame containing the specified object is determined, the serial number of the video frame can be recorded.

[0254] Box, data type is List, the position of the target in each frame, that is, the position of the specified object in each video frame containing the specified object. It can be the position of the target box in the above embodiment, and accordingly, the coordinate representation of the four vertices of the target box can be recorded.

[0255] Table (1)

[0256] name type illustrate TrackId Int Target tracking result ID Label Str Target tracking result label DetectScore List Object Detection Score TrackScore List Target tracking score FrameId List The frame number where the target exists Box List The location of the target in each frame

[0257] In one embodiment, the evaluation value of a candidate object for the completeness evaluation item is calculated in the following manner:

[0258] For each second video frame corresponding to the candidate object, a detection value corresponding to the second video frame is obtained as the completeness of the candidate object in the second video frame, wherein the detection value corresponding to the second video frame represents the probability of determining that the candidate object is contained in the second video frame.

[0259] For each video frame set corresponding to the candidate object, an average value of the completeness of the candidate object in each second video frame included in the video frame set is calculated as the average completeness of the candidate object in the video frame set.

[0260] The maximum value of the average completeness of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the completeness evaluation item.

[0261] It can be understood that, for each candidate object, the video frames included in each video frame set corresponding to the candidate object are all second video frames corresponding to the candidate object. The second video frames belonging to the same video frame set have the same target ID.

[0262] In the embodiment of the present application, the detection value corresponding to the candidate object in each second video frame is the probability that the candidate object is included in the second video frame, which can be the larger value of the DetectScore and TrackScore in the above embodiment corresponding to the candidate object in each second video frame, or it can also be the intersection and union ratio of the target frame predicted by the candidate object in each second video frame and the actual target frame. The greater the probability that the candidate object is included in the second video frame, the greater the detection value corresponding to the second video frame, and then the greater the average completeness of the candidate object in each video frame set corresponding to the candidate object. The greater the average completeness of the candidate object, the more complete the candidate object appears in the video image. The maximum value of the average completeness of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the completeness evaluation item, which can make the evaluation value of the relatively complete candidate object appearing in the video image for the completeness evaluation item higher. Based on this, a relatively complete implantation position can be selected to further ensure the effect of implantation of two-dimensional image resources.

[0263] Alternatively, for each video frame set corresponding to the candidate object, the maximum value of the completeness of the candidate object in each second video frame included in the video frame set may be used as the maximum completeness of the candidate object in the video frame set. Furthermore, the maximum value of the maximum completeness of the candidate object in each video frame set corresponding to the candidate object may be determined as the evaluation value of the candidate object for the completeness evaluation item.

[0264] In one embodiment, the average completeness of the video frame set with target ID i can be calculated based on formula (1):

[0265]

[0266] Among them, score1 iis the average completeness of the video frame set with target ID i, EndId is the serial number of the last video frame in the video frame set with target ID i, StartId is the serial number of the first video frame in the video frame set with target ID i, DetectScore j TrackScore is the target detection score of the jth frame in the video frame set with target ID i. j is the target tracking score of the jth frame in the video frame set with target ID i. j is the sequence number of the video frame in the video frame set with target ID i.

[0267] The evaluation value of the candidate object for the completeness evaluation item can be calculated based on formula (2):

[0268] score1=max(score1 i∈Ω ) (2)

[0269] Wherein, score1 is the evaluation value of the candidate object for the completeness evaluation item, and Ω is a set of target IDs corresponding to each set of video frames containing the candidate object.

[0270] In one embodiment, the evaluation value of a candidate object for the clarity evaluation item is calculated in the following manner:

[0271] For each second video frame corresponding to the candidate object, the proportion of the foreground in the first image area corresponding to the candidate object in the second video frame is calculated as the clarity of the candidate object in the second video frame.

[0272] For each video frame set corresponding to the candidate object, an average value of the clarity of the candidate object in each second video frame included in the video frame set is calculated as the average clarity of the candidate object in the video frame set.

[0273] The maximum value of the average definition of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the definition evaluation item.

[0274] In the embodiment of the present application, the video image is divided into a foreground and a background, the foreground is relatively clear, and the background is relatively blurred. In order to ensure the effect of implanting the two-dimensional image resource, it is necessary to make the proportion of the foreground in the implantation position higher.

[0275] For example, for each video frame in a video image, foreground detection can be performed on the video frame through a foreground detection network. Then, a binary matrix consistent with the pixel size of the video frame can be obtained, in which the pixel value corresponding to the foreground pixel is 1, and the pixel value corresponding to the background pixel is 0. The foreground detection network can be trained based on the frame difference method, the optical flow method or the average background method.

[0276] like Figure 7 As shown, Figure 7 A schematic diagram of a foreground portion of a video frame provided in an embodiment of the present application. Figure 7 The part selected by the dotted line is the detected foreground in the video frame, and the part selected by the solid line is the target frame in the video frame.

[0277] For the j-th video frame with target ID i, the mask is obtained through the foreground detection network i,j , that is, a binary matrix with the same pixel size as the video frame. The target box corresponding to the specified object in the video frame can be represented as box i,j =[x1 i,j ,y1 i,j ,x2 i,j ,y2 i,j ],(x1 i,j ,y1 i,j ) and (x2 i,j ,y2 i,j ) are the coordinates of the upper left corner vertex and the lower right corner vertex of the target box respectively. The clarity of the candidate object in the j-th video frame with target ID i can be calculated based on formula (3):

[0278]

[0279] Among them, score2 i,j is the clarity of the candidate object in the j-th video frame with target ID i, mask i,j (r, c) is the pixel value corresponding to the pixel point with coordinates (r, c) in the j-th video frame with target ID i.

[0280] The average definition of the candidate object in the video frame set can be calculated based on formula (4):

[0281]

[0282] Among them, score2 i is the average definition of the video frame set with target ID i, EndId is the serial number of the last video frame in the video frame set with target ID i, StartId is the serial number of the first video frame in the video frame set with target ID i, score2 i,j is the definition of the candidate object in the j-th video frame with target ID i, and j is the sequence number of the video frame in the video frame set with target ID i.

[0283] The evaluation value of the candidate object for the clarity evaluation item can be calculated based on formula (5):

[0284] score2=max(score2 i∈Ω ) (5)

[0285] Wherein, score2 is the evaluation value of the candidate object for the clarity evaluation item, and Ω is the set of target IDs corresponding to the set of video frames containing the candidate object.

[0286] In one embodiment, for each second video frame corresponding to the candidate object, the clarity of the first image area corresponding to the candidate object in the second video frame can be calculated based on a preset clarity evaluation method as the clarity of the candidate object in the second video frame.

[0287] For each video frame set corresponding to the candidate object, an average value of the clarity of the candidate object in each second video frame included in the video frame set is calculated as the average clarity of the candidate object in the video frame set.

[0288] The maximum value of the average definition of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the definition evaluation item.

[0289] In one embodiment, the stability evaluation item corresponding to a candidate object includes at least one of the following: a first stability evaluation sub-item, a second stability evaluation sub-item, and a third stability evaluation sub-item.

[0290] The evaluation value of a candidate object for the first stability evaluation sub-item is calculated in the following way:

[0291] For each second video frame corresponding to the candidate object, obtaining the coordinates of the center point of the first image region corresponding to the candidate object in the second video frame as the coordinates to be processed corresponding to the second video frame; and calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0292] For each video frame set corresponding to the candidate object, calculate the standard deviation of the coordinates to be processed corresponding to each second video frame included in the video frame set as the first standard deviation corresponding to the video frame set;

[0293] Calculating an average value of first areas to be processed corresponding to each second video frame included in the video frame set as an average area corresponding to the video frame set;

[0294] Calculating a ratio of a first standard deviation corresponding to the video frame set to an average area corresponding to the video frame set as the central point stability corresponding to the video frame set;

[0295] An average value of the central point stability corresponding to each video frame set corresponding to the candidate object is determined as an evaluation value of the candidate object for the first stability evaluation sub-item.

[0296] In one embodiment, in a video frame set with target ID i, for each candidate object, the coordinates of the center point of each target frame corresponding to the candidate object can be obtained based on formula (6): centeri = [(x1i, StarId + x2i, Id, y1i, StarId + y2i, d) / 2, ..., (x1i, EndId + x2i, Id, y1i, EndId + y2i, Id) / 2] (6)

[0297] in, centeri are the coordinates of the center points of each target box corresponding to the candidate object, E n dId is the sequence number of the last video frame in the video frame set with target ID i, S tart Id is the sequence number of the first video frame in the video frame set with target ID i.

[0298] The center point stability corresponding to the video frame set is calculated based on formula (7):

[0299]

[0300] in, is the center point stability corresponding to the video frame set, st d[ centeri ] is the first standard deviation corresponding to the video frame set, mean [ areai ] is the average area corresponding to the video frame set.

[0301] The first area to be processed corresponding to the second video frame in the video frame set with target ID i is calculated based on formula (8):

[0302] areai=[(x2i,StarId-x1i,StartId)(y2i,StarId-y1i,StartId),…,(x2i,StarId-x1i,EndId)(y2i,StarId-y1i,EndId) (8)

[0303] in, areai is the first area to be processed corresponding to the second video frame in the video frame set with target ID i, EndId is the sequence number of the last video frame in the video frame set with target ID i, Start Id is the sequence number of the first video frame in the video frame set with target ID i.

[0304] The evaluation value of the candidate object for the first stability evaluation sub-item is the average value of the central point stabilities corresponding to each set of video frames corresponding to the candidate object.

[0305] The evaluation value of a candidate object for the second stability evaluation sub-item is calculated in the following way:

[0306] For each second video frame corresponding to the candidate object, calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0307] For each video frame set corresponding to the candidate object, calculate the standard deviation of the first area to be processed corresponding to each second video frame included in the video frame set as the second standard deviation corresponding to the video frame set;

[0308] An average value of second standard deviations corresponding to each video frame set corresponding to the candidate object is determined as an evaluation value of the candidate object for the second stability evaluation sub-item.

[0309] In one embodiment, the second standard deviation corresponding to the set of video frames with target ID i is calculated based on formula (9):

[0310]

[0311] in, is the second standard deviation of the video frame set with target ID i, areai is the first area to be processed corresponding to the second video frame in the video frame set with target ID i.

[0312] The evaluation value of the candidate object for the second stability evaluation sub-item is the average value of the second standard deviations corresponding to each video frame set corresponding to the candidate object.

[0313] The evaluation value of a candidate object for the third stability evaluation sub-item is calculated as follows:

[0314] For each second video frame corresponding to the candidate object, determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that does not match the image region of a preset size, as the second area to be processed corresponding to the second video frame, and determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that matches the image region of a preset size, as the third area to be processed corresponding to the second video frame; wherein the image region of the preset size includes a first preset image region and a second preset image region, the width of the second preset image region is greater than the width of the first preset image region, and the height of the second preset image region is greater than the height of the first preset image region;

[0315] Calculating a ratio of a second area to be processed corresponding to the second video frame to a third area to be processed corresponding to the second video frame as an area ratio corresponding to the second video frame;

[0316] An average value of the area ratios corresponding to the second video frames corresponding to the candidate object is determined as an evaluation value of the candidate object for the third stability evaluation sub-item.

[0317] The area ratio corresponding to the second video frame with sequence number j in the video frame set with target ID i is obtained based on formula (10):

[0318]

[0319] in, It is the area ratio corresponding to the second video frame with serial number j in the video frame set with target ID i. The area that does not meet the threshold is the second area to be processed corresponding to the second video frame, and the area that meets the threshold is the third area to be processed corresponding to the second video frame.

[0320] The average value of the area ratio of the video frame set with target ID i can be calculated based on formula (11):

[0321]

[0322] in, is the average value of the area ratio of the video frame set with target ID i, E n dId is the sequence number of the last video frame in the video frame set with target ID i, S tart Id is the sequence number of the first video frame in the video frame set with target ID i, is the area ratio of the candidate object in the j-th video frame with target ID i, and j is the sequence number of the video frame in the video frame set with target ID i.

[0323] The evaluation value of the candidate object for the third stability evaluation sub-item can be calculated based on formula (12):

[0324]

[0325] Among them, score3 c is the evaluation value of the candidate object for the third stability evaluation sub-item, and Ω is the set of target IDs corresponding to the set of video frames containing the candidate object.

[0326] See also Figure 8 , Figure 8 A schematic diagram of the relationship between a first image area corresponding to a candidate object and an image area of ​​a preset size provided in an embodiment of the present application. The height of the first preset image area is minh, and the width is minw. The height of the second preset image area is maxh, and the width is maxw. The height of the first image area corresponding to the candidate object is h, and the width is w, and its area can be expressed as U The area of ​​the image area filled with horizontal lines can be represented by A1, and the area of ​​the image area filled with vertical lines can be represented by A2 express.

[0327] In the second video frame with sequence number j in the video frame set with target ID i, the relationship between the first image area and the image area of ​​the preset size is as follows: Figure 8 As shown, the area ratio corresponding to the second video frame can be calculated based on formula (13):

[0328]

[0329] in, is the area ratio corresponding to the second video frame, A1+A2 is the second area to be processed corresponding to the second video frame, U is the third area to be processed corresponding to the second video frame.

[0330] In one embodiment, the evaluation value of a candidate object for the stability evaluation item may be negatively correlated with the evaluation value for the first stability evaluation sub-item, the evaluation value for the second stability evaluation sub-item, and the evaluation value for the third stability evaluation sub-item. For example, the evaluation value of a candidate object for the stability evaluation item may be calculated based on formula (14):

[0331]

[0332] Among them, score3 is the evaluation value of the candidate object for the stability evaluation item, score3 a score3 is the evaluation value of the candidate object for the first stability evaluation sub-item, bscore3 is the evaluation value of the candidate object for the second stability evaluation sub-item. c is the evaluation value of the candidate object for the third stability evaluation sub-item, and p is a preset parameter, which can be 0.5 or 1.

[0333] In the embodiment of the present application, the stability of the candidate object in each corresponding second video frame can be determined based on the position coordinates of the candidate object in each corresponding second video frame and the area of ​​the image region occupied. Thus, the candidate object with a relatively stable position in the video image can be selected, which can make the two-dimensional image resource after implantation more stable in the video image. Thus, the implantation effect of the two-dimensional image resource can be better.

[0334] In one embodiment, see Fig. 9 , Fig. 9 A flowchart of calculating the evaluation value of a candidate object for a preset evaluation item is provided in an embodiment of the present application. A pit position corresponds to a candidate object, and the position of the candidate object in a video frame can be called a pit position.

[0335] Step S901: duration filtering, that is, for each designated object contained in the video image, based on each second video frame corresponding to the designated object, obtain the appearance duration of the designated object in the video image; determine whether the appearance duration of the designated object is greater than the preset duration; if the appearance duration of the designated object is greater than the preset duration, determine the designated object as an alternative object.

[0336] Step S902: Calculate the pit detection score score1, that is, calculate the evaluation value of the candidate object for the completeness evaluation item.

[0337] Step S903: calculating the pit clarity score score2, that is, calculating the evaluation value of the candidate object for the clarity evaluation item.

[0338] Step S904: calculating the pit stability score score3, that is, calculating the evaluation value of the candidate object for the stability evaluation item.

[0339] Step S905: Calculate the total score of the pit, that is, calculate the evaluation value of the candidate object for the preset evaluation items.

[0340] The evaluation value of the candidate object for the preset evaluation item may be the sum of the evaluation value of the candidate object for the completeness evaluation item, the evaluation value of the candidate object for the clarity evaluation item, and the evaluation value of the candidate object for the stability evaluation item.

[0341] In one embodiment, before determining the video frames in the video frame set including the same designated object as the second video frames corresponding to the designated object based on the similarity between the image areas occupied by the designated object in the video frames, the implantation position determination method further includes:

[0342] Step 1: Based on the shot segmentation algorithm, determine the shot to which each video frame in the video image belongs.

[0343] Based on the similarity between the image areas occupied by the designated objects in the video frames, video frames in a set of video frames including the designated objects as the same object are determined as second video frames corresponding to the designated objects, including:

[0344] Step 2: For each shot, based on the similarity between the image areas occupied by the specified object in the video frame, from the video frame sets belonging to the shot, determine the video frame set that contains the specified object as the same object as the video frame set corresponding to the specified object.

[0345] Step three: Determine the video frames in the video frame set corresponding to the designated object as the second video frames corresponding to the designated object.

[0346] In the embodiment of the present application, each video frame in the video image can be divided according to the shot to which it belongs based on a shot segmentation algorithm. The shot segmentation algorithm can be a pixel comparison method, a histogram comparison method, an edge comparison method or a block matching method.

[0347] Since a specified object in a video image often only appears in one shot, for each shot, the video frame sets belonging to the shot can be associated, that is, from the video frame sets belonging to the shot, the video frame sets containing the same specified object are determined as the video frame sets corresponding to the specified object. There is no need to compare the video frame sets contained in the entire video image, which can further improve the efficiency of determining the implantation position.

[0348] In one embodiment, after the shot is segmented, the start frame number (StartFrame), the end frame number (EndFrame) and the shot number (ShotId) of each shot can be obtained.

[0349] In one embodiment, see Fig.10 , Fig.10 A flowchart for clustering a set of video frames is provided in an embodiment of the present application.

[0350] Step S1001: randomly extracting a preset number of video frames corresponding to each target ID in the same shot, wherein the preset number may be 5 or 6.

[0351] Step S1002: crop the video frame to extract the target part according to the detection frame. The detection frame is the target frame in the above embodiment.

[0352] Step S1003: using the trained deep learning network to calculate the similarity between the images, that is, using the deep learning network to calculate the similarity between the images corresponding to the extracted target parts.

[0353] Step S1004: Cluster the target IDs according to similarity. For example, the K-means clustering algorithm or the AGNES clustering algorithm can be used to cluster the target IDs in combination with similarity. After clustering the target IDs, the clustering results can be obtained, as shown in Table (2). The information recorded in Table (2) includes: a target ID set, the data type is List (list type), which contains the target IDs of the video frame set of the same specified object. The implantation position category, the data type is Str (string type). Duration, the data type is List (list type), the cumulative time from the start of the implantation position to the end of the implantation position.

[0354] Table (2)

[0355]

[0356] See also Fig.11 , Fig.11 A schematic diagram of a video frame set clustering result provided in an embodiment of the present application. Fig.11 As shown, the lens with lens number k includes four types of objects: buildings, billboards, street lamp posts and electric poles, and green belts. Among them, the building class includes: building 1 and building 2. The video frames in the video frame set with target IDs 0, 5, and 6 include building 1, and the video frames in the video frame set with target IDs 10 and 11 include building 2. The billboard class includes: billboard 1 and billboard 2. The video frames in the video frame set with target IDs 1 and 3 include billboard 1, and the video frames in the video frame set with target IDs 5, 6, and 7 include billboard 2. The street lamp posts and electric poles class includes street lamp posts and electric poles 1. The video frames in the video frame set with target IDs 7 and 8 include street lamp posts and electric poles 1. The green belt class includes: green belt 1 and green belt 2. The video frames in the video frame set with target ID 2 include green belt 1, and the video frames in the video frame set with target IDs 12, 13, and 15 include green belt 2.

[0357] In one embodiment, see Fig.12 , Fig.12 This is a sixth flow chart of the implantation position determination method provided in an embodiment of the present application.

[0358] Step S1201: input video, that is, obtain the video image that needs to be embedded with two-dimensional image resources.

[0359] Step S1202: Perform target detection and tracking, that is, based on the target detection algorithm and the target tracking algorithm, determine a set of video frames containing the same specified object, that is, steps S601 to S609 in the above embodiment.

[0360] Step S1203: shot segmentation, that is, based on a shot segmentation algorithm, determining the shot to which each video frame in the video image belongs.

[0361] It is understandable that step S1202 and step S1203 may be performed asynchronously, in parallel or sequentially. Based on the detection and tracking results obtained in step S1202 and the shots to which each video frame belongs in the video image obtained in step S1203, the pit positions are aggregated.

[0362] Step S1204: Pit position aggregation, that is, for each shot, based on the similarity between the image areas occupied by the designated object in the video frame, from the video frame sets belonging to the shot, a video frame set containing the designated object as the same object is determined as the video frame set corresponding to the designated object. The video frames in the video frame set corresponding to the designated object are determined as the second video frames corresponding to the designated object.

[0363] Step S1205: scoring the pit position, that is, determining the candidate objects based on the designated objects contained in the video image, and for each candidate object contained in the video image, calculating the evaluation value of the candidate object for the preset evaluation items based on the second video frames corresponding to the candidate object, to obtain the object evaluation value of the candidate object.

[0364] Step S1206: Output the pit information, that is, determine the target object based on the object evaluation value of each candidate object, and provide the target object and the object evaluation value corresponding to the target object to the user. For example, the candidate objects can be sorted in order from high to low according to the object evaluation value of each candidate object, and then the candidate object with the highest object evaluation value can be determined as the target object. Alternatively, multiple candidate objects with the highest object evaluation values ​​can be selected as the target object. Subsequently, the multiple candidate objects and their corresponding object evaluation values ​​can be provided to the user, so that the user can further filter the multiple candidate objects.

[0365] Corresponding to the above method embodiment, the present application embodiment also provides an implantation position determination device, see Fig.13 , Fig.13 A schematic diagram of the structure of an implantation position determination device provided in an embodiment of the present application, the device comprising:

[0366] The video image acquisition module 1301 is used to acquire the video image that needs to be embedded with the two-dimensional image resource.

[0367] The first determination module 1302 is used to determine a video frame containing a specified object in the video image based on a target detection algorithm as a first video frame. When a two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-and-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold.

[0368] The embedding position determination module 1303 is used to determine the embedding position of the two-dimensional image resource in the video image based on the position of the designated object in the first video frame.

[0369] Based on the above processing, the designated object in the video image can be determined. Since when the two-dimensional image resource is implanted at the position of the designated object in the first video frame, the intersection and union ratio of the image area occupied by the two-dimensional image resource and the image area occupied by the designated object is greater than the preset threshold, that is, the two-dimensional image resource can be implanted at the position of the designated object. Accordingly, the implantation position of the two-dimensional image resource in the video image can be determined according to the position of the designated object in the first video frame. Based on this, the automatic detection of the implantation position by the electronic device can reduce the labor cost and improve the efficiency of determining the implantation position compared with manually browsing the video image to determine the implantation position.

[0370] In one embodiment, the first determining module 1302 includes:

[0371] A first determination submodule is used to determine, based on a target detection algorithm, video frames of the same object as the designated objects contained in the video image as the second video frames corresponding to the designated object;

[0372] The implantation position determination module 1303 includes:

[0373] The implantation position determination submodule is used to determine the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame.

[0374] In one embodiment, the first determining submodule includes:

[0375] A first determining unit, configured to determine a current video frame to be processed in the video image according to an order between video frames in the video image;

[0376] A designated object detection unit is used to detect whether the current video frame to be processed contains a designated object based on a target detection algorithm;

[0377] A first judgment unit is used to judge whether the specified object is determined in a previous video frame of the current video frame to be processed if it is determined based on the target detection algorithm that the current video frame to be processed contains the specified object;

[0378] A second judgment unit is used to judge whether the specified object detected in the current video frame to be processed and the specified object determined in the previous video frame are the same object if the specified object is determined in the previous video frame of the current video frame to be processed;

[0379] a second determining unit, configured to determine that the current video frame to be processed and the previous video frame belong to a set of video frames containing the same specified object if the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame; and trigger the first determining unit;

[0380] The third determining unit is used to determine the video frames in the video frame set including the designated object as the same object as the second video frames corresponding to the designated object based on the similarity between the image areas occupied by the designated object in the video frames.

[0381] In one embodiment, the apparatus further comprises:

[0382] a shot determination module, configured to determine the shot to which each video frame in the video image belongs based on a shot segmentation algorithm before determining the video frames in the video frame set containing the same designated object as the second video frames corresponding to the designated object based on the similarity between the image areas occupied by the designated object in the video frames;

[0383] The third determining unit is specifically configured to determine, for each shot, based on the similarity between the image areas occupied by the designated objects in the video frames, a set of video frames containing the designated objects as the same object from among the sets of video frames belonging to the shot as the set of video frames corresponding to the designated object;

[0384] The video frames in the video frame set corresponding to the designated object are determined as the second video frames corresponding to the designated object.

[0385] In one embodiment, the apparatus further comprises:

[0386] A second determination module is used to determine the video frame containing the specified object determined last time as the current third video frame if the specified object detected in the current video frame to be processed is not the same object as the specified object determined in the previous video frame, or if the specified object is not determined in the previous video frame of the current video frame to be processed, or if it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object;

[0387] A designated object tracking module, used to determine whether the designated object determined in the current third video frame is tracked in the current video frame to be processed based on a target tracking algorithm;

[0388] A video frame set determination module is used to determine that the current video frame to be processed and the current third video frame belong to a video frame set containing the same specified object if the specified object determined in the current third video frame is tracked in the current video frame to be processed based on the target tracking algorithm; and trigger the first determination unit.

[0389] In one embodiment, the apparatus further comprises:

[0390] A first judgment module is used for, when it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object, and before determining the video frame containing the specified object determined last time as the current third video frame, judging whether there are a preset number of continuous fourth video frames before the current video frame to be processed; wherein the fourth video frame represents the video frame determined not to contain the specified object;

[0391] The second determination module is specifically configured to determine the video frame containing the specified object determined last time as the current third video frame when there is no preset number of consecutive fourth video frames before the current video frame to be processed;

[0392] When there are a preset number of continuous fourth video frames before the current video frame to be processed, it is determined that the current video frame to be processed does not include the specified object, and the first determining unit is triggered.

[0393] In one embodiment, the apparatus further comprises:

[0394] The object evaluation value calculation module is used to calculate the evaluation value of each candidate object included in the video image based on each second video frame corresponding to the candidate object for a preset evaluation item before determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame, so as to obtain the object evaluation value of the candidate object; wherein the candidate object is determined based on the designated object included in the video image;

[0395] The preset evaluation items include at least one of the following: a completeness evaluation item, a clarity evaluation item, and a stability evaluation item;

[0396] The completeness evaluation item is used to represent: the maximum value of the completeness of the candidate object in each corresponding second video frame;

[0397] The clarity evaluation item is used to represent: the proportion of the foreground in the first image area corresponding to the candidate object; the first image area corresponding to the candidate object represents: the image area occupied by the candidate object in each corresponding second video frame;

[0398] The stability evaluation item is used to characterize: the change amplitude of the first image region corresponding to the candidate object;

[0399] The implantation position determination submodule is specifically used to determine the target object from each candidate object based on the object evaluation value of each candidate object;

[0400] Based on the position of the target object in the corresponding second video frame, an implantation position of the two-dimensional image resource in the video image is determined.

[0401] In one embodiment, the evaluation value of a candidate object for the completeness evaluation item is calculated in the following manner:

[0402] For each second video frame corresponding to the candidate object, obtaining a detection value corresponding to the second video frame as the completeness of the candidate object in the second video frame; wherein the detection value corresponding to the second video frame represents a probability of determining that the second video frame contains the candidate object;

[0403] For each video frame set corresponding to the candidate object, calculating an average value of the completeness of the candidate object in each second video frame included in the video frame set as the average completeness of the candidate object in the video frame set;

[0404] The maximum value of the average completeness of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the completeness evaluation item.

[0405] In one embodiment, the evaluation value of a candidate object for the clarity evaluation item is calculated in the following manner:

[0406] For each second video frame corresponding to the candidate object, calculating the proportion of the foreground in the first image area corresponding to the candidate object in the second video frame as the clarity of the candidate object in the second video frame;

[0407] For each video frame set corresponding to the candidate object, calculating an average value of the clarity of the candidate object in each second video frame included in the video frame set as the average clarity of the candidate object in the video frame set;

[0408] The maximum value of the average definition of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the definition evaluation item.

[0409] In one embodiment, the stability evaluation item corresponding to a candidate object includes at least one of the following: a first stability evaluation sub-item, a second stability evaluation sub-item, and a third stability evaluation sub-item;

[0410] The evaluation value of a candidate object for the first stability evaluation sub-item is calculated in the following way:

[0411] For each second video frame corresponding to the candidate object, obtaining the coordinates of the center point of the first image region corresponding to the candidate object in the second video frame as the coordinates to be processed corresponding to the second video frame; and calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0412] For each video frame set corresponding to the candidate object, calculate the standard deviation of the coordinates to be processed corresponding to each second video frame included in the video frame set as the first standard deviation corresponding to the video frame set;

[0413] Calculating an average value of first areas to be processed corresponding to each second video frame included in the video frame set as an average area corresponding to the video frame set;

[0414] Calculating a ratio of a first standard deviation corresponding to the video frame set to an average area corresponding to the video frame set as the central point stability corresponding to the video frame set;

[0415] Determine an average value of the central point stability corresponding to each set of video frames corresponding to the candidate object as an evaluation value of the candidate object for the first stability evaluation sub-item;

[0416] The evaluation value of a candidate object for the second stability evaluation sub-item is calculated in the following way:

[0417] For each second video frame corresponding to the candidate object, calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame;

[0418] For each video frame set corresponding to the candidate object, calculate the standard deviation of the first area to be processed corresponding to each second video frame included in the video frame set as the second standard deviation corresponding to the video frame set;

[0419] Determine an average value of second standard deviations corresponding to each video frame set corresponding to the candidate object as an evaluation value of the candidate object for the second stability evaluation sub-item;

[0420] The evaluation value of a candidate object for the third stability evaluation sub-item is calculated as follows:

[0421] For each second video frame corresponding to the candidate object, determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that does not match the image region of a preset size, as the second area to be processed corresponding to the second video frame, and determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that matches the image region of the preset size, as the third area to be processed corresponding to the second video frame; wherein the image region of the preset size includes a first preset image region and a second preset image region, the width of the second preset image region is greater than the width of the first preset image region, and the height of the second preset image region is greater than the height of the first preset image region;

[0422] Calculating a ratio of a second area to be processed corresponding to the second video frame to a third area to be processed corresponding to the second video frame as an area ratio corresponding to the second video frame;

[0423] An average value of the area ratios corresponding to the second video frames corresponding to the candidate object is determined as an evaluation value of the candidate object for the third stability evaluation sub-item.

[0424] In one embodiment, the apparatus further comprises:

[0425] an appearance duration acquisition module, for calculating the evaluation value of each candidate object for a preset evaluation item based on each second video frame corresponding to the candidate object for each candidate object included in the video image, and obtaining the object evaluation value of the candidate object, and for each designated object included in the video image, obtaining the appearance duration of the designated object in the video image based on each second video frame corresponding to the designated object;

[0426] The second judging module is used to judge whether the appearance time of the specified object is greater than a preset time;

[0427] The candidate object determination module is used to determine the specified object as a candidate object if the appearance duration of the specified object is greater than a preset duration.

[0428] The present application also provides an electronic device, such as Fig.14 As shown, it includes a processor 1401, a communication interface 1402, a memory 1403 and a communication bus 1404, wherein the processor 1401, the communication interface 1402, and the memory 1403 communicate with each other through the communication bus 1404.

[0429] Memory 1403, used for storing computer programs;

[0430] The processor 1401 is used to implement the following steps when executing the program stored in the memory 1403:

[0431] Acquire the video image that needs to be embedded with the two-dimensional image resource;

[0432] Based on the target detection algorithm, a video frame containing the specified object in the video image is determined as the first video frame; wherein when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-over-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold;

[0433] Based on the position of the designated object in the first video frame, an implantation position of the two-dimensional image resource in the video image is determined.

[0434] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0435] The communication interface is used for communication between the above terminal and other devices.

[0436] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0437] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0438] In another embodiment provided in the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the implantation position determination method described in any one of the above embodiments is implemented.

[0439] In another embodiment provided by the present application, a computer program product comprising instructions is also provided, which, when executed on a computer, enables the computer to execute the implantation position determination method described in any one of the above embodiments.

[0440] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0441] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0442] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, and storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0443] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A method for determining an implantation position, characterized in that: The method comprises: Acquire the video image that needs to be embedded with the two-dimensional image resource; Based on the target detection algorithm, a video frame containing the specified object in the video image is determined as the first video frame; wherein when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-over-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold; Determining, based on the position of the designated object in the first video frame, an implantation position of the two-dimensional image resource in the video image; The step of determining, based on the target detection algorithm, a video frame containing a specified object in the video image as the first video frame comprises: Based on the target detection algorithm, determining that the designated objects contained in the video image are video frames of the same object as the second video frames corresponding to the designated object; The step of determining, based on the position of the designated object in the first video frame, the implantation position of the two-dimensional image resource in the video image comprises: Determining an implantation position of the two-dimensional image resource in the video image based on a position of each designated object in the corresponding second video frame; Before determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame, the method further includes: For each candidate object included in the video image, based on each second video frame corresponding to the candidate object, calculate the evaluation value of the candidate object for the preset evaluation item to obtain the object evaluation value of the candidate object; wherein the candidate object is determined based on the designated object included in the video image; The preset evaluation items include at least one of the following: a completeness evaluation item, a clarity evaluation item, and a stability evaluation item; The completeness evaluation item is used to represent: the maximum completeness of the candidate object in each corresponding second video frame; The clarity evaluation item is used to represent: the proportion of the foreground in the first image area corresponding to the candidate object; the first image area corresponding to the candidate object represents: the image area occupied by the candidate object in each corresponding second video frame; The stability evaluation item is used to characterize: the change amplitude of the first image region corresponding to the candidate object; The step of determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame includes: Determine a target object from among the candidate objects based on the object evaluation value of each candidate object; Based on the position of the target object in the corresponding second video frame, an implantation position of the two-dimensional image resource in the video image is determined.

2. The method according to claim 1, characterized in that The method of determining, based on the target detection algorithm, that the designated objects contained in the video image are video frames of the same object as the second video frames corresponding to the designated objects includes: Determining a current video frame to be processed in the video image according to the order of the video frames in the video image; Based on the target detection algorithm, detect whether the current video frame to be processed contains the specified object; If it is determined based on the target detection algorithm that the current video frame to be processed contains the specified object, determining whether the specified object is determined in a video frame before the current video frame to be processed; If the designated object is determined in a video frame before the current video frame to be processed, determining whether the designated object detected in the current video frame to be processed and the designated object determined in the previous video frame are the same object; If the specified object detected in the current video frame to be processed is the same object as the specified object determined in the previous video frame, then determining that the current video frame to be processed and the previous video frame belong to a set of video frames containing the same specified object; and returning to execute the step of determining the current video frame to be processed in the video image according to the order between the video frames in the video image; Based on the similarity between the image regions occupied by the designated objects in the video frames, the video frames in the video frame set including the designated objects as the same object are determined as the second video frames corresponding to the designated objects.

3. The method according to claim 2, characterized in that Before determining, based on the similarity between the image areas occupied by the designated objects in the video frames, the video frames in the video frame set including the designated objects as the same object as the second video frames corresponding to the designated objects, the method further includes: Based on a shot segmentation algorithm, determining the shot to which each video frame in the video image belongs; The method of determining, based on the similarity between the image areas occupied by the designated objects in the video frames, the video frames in the video frame set including the designated objects as the same object as the second video frames corresponding to the designated objects includes: For each shot, based on the similarity between the image areas occupied by the designated object in the video frames, from the video frame sets belonging to the shot, a set of video frames containing the designated object as the same object is determined as the set of video frames corresponding to the designated object; The video frames in the video frame set corresponding to the designated object are determined as the second video frames corresponding to the designated object.

4. The method according to claim 2, characterized in that: The method further comprises: If the specified object detected in the current video frame to be processed is not the same object as the specified object determined in the previous video frame, or if the specified object is not determined in the previous video frame of the current video frame to be processed, or if it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object, then determine the video frame containing the specified object determined last time as the current third video frame; Based on the target tracking algorithm, determining whether the specified object determined in the current third video frame is tracked in the current video frame to be processed; If, based on the target tracking algorithm, the specified object determined in the current third video frame is tracked in the current video frame to be processed, it is determined that the current video frame to be processed and the current third video frame belong to a set of video frames containing the same specified object; and the process returns to execute the step of determining the current video frame to be processed in the video image according to the order between the video frames in the video image.

5. The method according to claim 4, characterized in that In the case where it is determined based on the target detection algorithm that the current video frame to be processed does not contain the specified object, before determining the video frame containing the specified object determined last time as the current third video frame, the method further includes: Determine whether there are a preset number of continuous fourth video frames before the current video frame to be processed; wherein the fourth video frame represents a video frame determined not to contain the specified object; The step of determining the last determined video frame containing the specified object as the current third video frame includes: If there are no preset number of consecutive fourth video frames before the current video frame to be processed, determine the video frame containing the specified object determined last time as the current third video frame; When there are a preset number of consecutive fourth video frames before the current video frame to be processed, it is determined that the current video frame to be processed does not contain the specified object, and the step of determining the current video frame to be processed in the video image according to the order between the video frames in the video image is returned to be executed.

6. The method according to claim 1, characterized in that The evaluation value of a candidate object for the completeness evaluation item is calculated as follows: For each second video frame corresponding to the candidate object, obtaining a detection value corresponding to the second video frame as the completeness of the candidate object in the second video frame; wherein the detection value corresponding to the second video frame represents a probability of determining that the second video frame contains the candidate object; For each video frame set corresponding to the candidate object, calculating an average value of the completeness of the candidate object in each second video frame included in the video frame set as the average completeness of the candidate object in the video frame set; The maximum value of the average completeness of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the completeness evaluation item.

7. The method according to claim 1, characterized in that The evaluation value of a candidate object for the clarity evaluation item is calculated as follows: For each second video frame corresponding to the candidate object, calculating the proportion of the foreground in the first image area corresponding to the candidate object in the second video frame as the clarity of the candidate object in the second video frame; For each video frame set corresponding to the candidate object, calculating an average value of the clarity of the candidate object in each second video frame included in the video frame set as the average clarity of the candidate object in the video frame set; The maximum value of the average definition of the candidate object in each video frame set corresponding to the candidate object is determined as the evaluation value of the candidate object for the definition evaluation item.

8. The method according to claim 1, characterized in that The stability evaluation item corresponding to one candidate object includes at least one of the following: a first stability evaluation sub-item, a second stability evaluation sub-item, and a third stability evaluation sub-item; The evaluation value of a candidate object for the first stability evaluation sub-item is calculated in the following way: For each second video frame corresponding to the candidate object, obtaining the coordinates of the center point of the first image region corresponding to the candidate object in the second video frame as the coordinates to be processed corresponding to the second video frame; and calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame; For each video frame set corresponding to the candidate object, calculate the standard deviation of the coordinates to be processed corresponding to each second video frame included in the video frame set as the first standard deviation corresponding to the video frame set; Calculating an average value of first areas to be processed corresponding to each second video frame included in the video frame set as an average area corresponding to the video frame set; Calculating a ratio of a first standard deviation corresponding to the video frame set to an average area corresponding to the video frame set as the central point stability corresponding to the video frame set; Determine an average value of the central point stability corresponding to each set of video frames corresponding to the candidate object as an evaluation value of the candidate object for the first stability evaluation sub-item; The evaluation value of a candidate object for the second stability evaluation sub-item is calculated in the following way: For each second video frame corresponding to the candidate object, calculating the area of ​​the first image region corresponding to the candidate object in the second video frame as the first area to be processed corresponding to the second video frame; For each video frame set corresponding to the candidate object, calculate the standard deviation of the first to-be-processed area corresponding to each second video frame included in the video frame set as the second standard deviation corresponding to the video frame set; Determine an average value of second standard deviations corresponding to each video frame set corresponding to the candidate object as an evaluation value of the candidate object for the second stability evaluation sub-item; The evaluation value of a candidate object for the third stability evaluation sub-item is calculated as follows: For each second video frame corresponding to the candidate object, determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that does not match the image region of a preset size, as the second area to be processed corresponding to the second video frame, and determine the area of ​​a portion of the first image region corresponding to the candidate object in the second video frame that matches the image region of the preset size, as the third area to be processed corresponding to the second video frame; wherein the image region of the preset size includes a first preset image region and a second preset image region, the width of the second preset image region is greater than the width of the first preset image region, and the height of the second preset image region is greater than the height of the first preset image region; Calculating a ratio of a second area to be processed corresponding to the second video frame to a third area to be processed corresponding to the second video frame as an area ratio corresponding to the second video frame; An average value of the area ratios corresponding to the second video frames corresponding to the candidate object is determined as an evaluation value of the candidate object for the third stability evaluation sub-item.

9. The method according to claim 1, characterized in that: Before calculating, for each candidate object included in the video image, an evaluation value of the candidate object for a preset evaluation item based on each second video frame corresponding to the candidate object to obtain the object evaluation value of the candidate object, the method further includes: For each designated object included in the video image, based on each second video frame corresponding to the designated object, obtain the appearance duration of the designated object in the video image; Determine whether the appearance duration of the specified object is greater than a preset duration; If the appearance duration of the designated object is greater than the preset duration, the designated object is determined as a candidate object.

10. An implantation position determination device, characterized in that: The device comprises: A video image acquisition module, used to acquire video images that need to be embedded with two-dimensional image resources; A first determination module is used to determine, based on a target detection algorithm, a video frame containing a specified object in the video image as a first video frame; wherein, when the two-dimensional image resource is implanted at the position of the specified object in the first video frame, an intersection-over-union ratio of an image area occupied by the two-dimensional image resource and an image area occupied by the specified object is greater than a preset threshold; An implantation position determination module, used to determine an implantation position of the two-dimensional image resource in the video image based on the position of the designated object in the first video frame; The first determining module includes: A first determination submodule is used to determine, based on a target detection algorithm, video frames of the same object as the designated objects contained in the video image as the second video frames corresponding to the designated object; The implantation position determination module comprises: An implantation position determination submodule, used to determine an implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame; The device also includes: The object evaluation value calculation module is used to calculate the evaluation value of each candidate object included in the video image based on each second video frame corresponding to the candidate object for a preset evaluation item before determining the implantation position of the two-dimensional image resource in the video image based on the position of each designated object in the corresponding second video frame, so as to obtain the object evaluation value of the candidate object; wherein the candidate object is determined based on the designated object included in the video image; The preset evaluation items include at least one of the following: a completeness evaluation item, a clarity evaluation item, and a stability evaluation item; The completeness evaluation item is used to represent: the maximum completeness of the candidate object in each corresponding second video frame; The clarity evaluation item is used to represent: the proportion of the foreground in the first image area corresponding to the candidate object; the first image area corresponding to the candidate object represents: the image area occupied by the candidate object in each corresponding second video frame; The stability evaluation item is used to characterize: the change amplitude of the first image region corresponding to the candidate object; The implantation position determination submodule is specifically used to determine the target object from each candidate object based on the object evaluation value of each candidate object; Based on the position of the target object in the corresponding second video frame, an implantation position of the two-dimensional image resource in the video image is determined.

11. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 9 when executing a program stored in a memory.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 9 are implemented.

Citation Information

Patent Citations

  • Method for implanting advertisement into video and computer equipment

    CN110163640A

  • Information implantation area identification method and device, storage medium and electronic equipment

    CN112101075A

  • Dynamic advertisement implantation position detection method and device

    CN112752151A