CN112749685A - Video classification method, apparatus and medium - Google Patents

Video classification method, apparatus and medium Download PDF

Info

Publication number
CN112749685A
CN112749685A CN202110119275.7A CN202110119275A CN112749685A CN 112749685 A CN112749685 A CN 112749685A CN 202110119275 A CN202110119275 A CN 202110119275A CN 112749685 A CN112749685 A CN 112749685A
Authority
CN
China
Prior art keywords
video
preset
category
video frame
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110119275.7A
Other languages
Chinese (zh)
Other versions
CN112749685B (en
Inventor
崔东林
王加明
王明凯
于天宝
贠挺
陈国庆
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110119275.7A priority Critical patent/CN112749685B/en
Publication of CN112749685A publication Critical patent/CN112749685A/en
Application granted granted Critical
Publication of CN112749685B publication Critical patent/CN112749685B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/41Higher-level, semantic clustering, classification or understanding of video scenes, e.g. detection, labelling or Markovian modelling of sport events or news items
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/75Clustering; Classification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/46Extracting features or characteristics from the video content, e.g. video fingerprints, representative shots or key frames

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Computational Linguistics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure provides a video classification method, device and medium, which relate to the technical field of artificial intelligence, in particular to the technical field of computer vision and big data processing. The implementation scheme is as follows: performing frame extraction on a target video to obtain a plurality of target video frames; inputting the target video frames into a target classification model, and obtaining a first class prediction score of each target video frame in the target videos output by the target classification model, wherein the first class prediction score can represent the probability that the target video frame belongs to a first video class; determining a first preset score threshold and a first preset video frame number related to the first video category; and for the plurality of target video frames, in response to determining that the number of one or more target video frames for which the corresponding first class prediction score is not less than the first preset score threshold is not less than the first preset video frame number, determining the class of the target video to be the first video class.

Description

Video classification method, apparatus and medium
Technical Field
The present disclosure relates to the field of artificial intelligence technologies, and in particular, to the field of computer vision and big data processing technologies, and in particular, to a video classification method and apparatus, an electronic device, a computer-readable storage medium, and a computer program product.
Background
Artificial intelligence is the subject of research that makes computers simulate some human mental processes and intelligent behaviors (such as learning, reasoning, thinking, planning, etc.), both at the hardware level and at the software level. The artificial intelligence hardware technology generally comprises technologies such as a sensor, a special artificial intelligence chip, cloud computing, distributed storage, big data processing and the like, and the artificial intelligence software technology mainly comprises a computer vision technology, a voice recognition technology, a natural language processing technology, machine learning/deep learning, a big data processing technology, a knowledge graph technology and the like.
With the rapid development of the internet technology, the application scenes of short videos are continuously enriched, and massive short videos are uploaded to an internet platform, so that the life of people is enriched. The Internet platform can classify the uploaded short videos to improve the recommendation effect and further improve the user experience.
The approaches described in this section are not necessarily approaches that have been previously conceived or pursued. Unless otherwise indicated, it should not be assumed that any of the approaches described in this section qualify as prior art merely by virtue of their inclusion in this section. Similarly, unless otherwise indicated, the problems mentioned in this section should not be considered as having been acknowledged in any prior art.
Disclosure of Invention
The present disclosure provides a video classification method, apparatus, electronic device, computer-readable storage medium, and computer program product.
According to an aspect of the present disclosure, there is provided a video classification method, including: performing frame extraction on a target video to obtain a plurality of target video frames; inputting the target video frames into a target classification model, and obtaining a first class prediction score of each target video frame in the target videos output by the target classification model, wherein the first class prediction score can represent the probability that the target video frame belongs to a first video class; determining a first preset score threshold and a first preset video frame number related to the first video category; and for the plurality of target video frames, in response to determining that the number of one or more target video frames for which the corresponding first class prediction score is not less than the first preset score threshold is not less than the first preset video frame number, determining the class of the target video to be the first video class.
According to another aspect of the present disclosure, there is provided a video classification apparatus including: the frame extracting unit is configured to extract frames of the target video to obtain a plurality of target video frames; a target classification model configured to process the input plurality of target video frames to output a first class prediction score for each of the plurality of target video frames, the first class prediction score being capable of characterizing a probability that the target video frame belongs to a first video class; a first determining unit configured to determine a first preset score threshold and a first preset video frame number related to the first video category; and a second determination unit configured to determine, for the plurality of target video frames, a category of the target video as the first video category in response to determining that a number of one or more target video frames for which the respective first category prediction score is not less than the first preset score threshold is not less than the first preset video frame number.
According to another aspect of the present disclosure, there is provided an electronic device including: a memory, a processor and a computer program stored on the memory, wherein the processor is configured to execute the computer program to implement the steps of the above-described method.
According to another aspect of the present disclosure, a non-transitory computer readable storage medium is provided, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described above.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program realizes the steps of the above-described method when executed by a processor.
According to one or more embodiments of the present disclosure, it is possible to accurately and quickly determine whether a video is a preset video category by determining a preset score threshold value of a video category level and a preset video frame number, thereby being able to predict scores for categories, belonging to a preset video category, of a plurality of video frames of the video based on a target classification model.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the embodiments and, together with the description, serve to explain the exemplary implementations of the embodiments. The illustrated embodiments are for purposes of illustration only and do not limit the scope of the claims. Throughout the drawings, identical reference numbers designate similar, but not necessarily identical, elements.
FIG. 1 illustrates a schematic diagram of an exemplary system in which various methods described herein may be implemented, according to an embodiment of the present disclosure;
fig. 2 shows a flow diagram of a video classification method according to an embodiment of the present disclosure;
FIGS. 3 and 4 show flowcharts of methods of determining a preset score threshold and a preset video frame number according to embodiments of the present disclosure;
FIG. 5 shows a flow diagram of a video classification method according to an embodiment of the present disclosure;
FIG. 6 shows a flowchart of a method of training a target classification model according to an embodiment of the present disclosure;
fig. 7 shows a block diagram of a structure of a video classification apparatus according to an embodiment of the present disclosure;
FIG. 8 illustrates a block diagram of an exemplary electronic device that can be used to implement embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, the timing relationship, or the importance relationship of the elements, and such terms are used only to distinguish one element from another. In some examples, a first element and a second element may refer to the same instance of the element, and in some cases, based on the context, they may also refer to different instances.
The terminology used in the description of the various described examples in this disclosure is for the purpose of describing particular examples only and is not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the elements may be one or more. Furthermore, the term "and/or" as used in this disclosure is intended to encompass any and all possible combinations of the listed items.
Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
Fig. 1 illustrates a schematic diagram of an exemplary system 100 in which various methods and apparatus described herein may be implemented in accordance with embodiments of the present disclosure. Referring to fig. 1, the system 100 includes one or more client devices 101, 102, 103, 104, 105, and 106, a server 120, and one or more communication networks 110 coupling the one or more client devices to the server 120. Client devices 101, 102, 103, 104, 105, and 106 may be configured to execute one or more applications.
In embodiments of the present disclosure, the server 120 may run one or more services or software applications capable of performing the video classification methods of the present disclosure.
In some embodiments, the server 120 may also provide other services or software applications that may include non-virtual environments and virtual environments. In certain embodiments, these services may be provided as web-based services or cloud services, for example, provided to users of client devices 101, 102, 103, 104, 105, and/or 106 under a software as a service (SaaS) model.
In the configuration shown in fig. 1, server 120 may include one or more components that implement the functions performed by server 120. These components may include software components, hardware components, or a combination thereof, which may be executed by one or more processors. A user operating a client device 101, 102, 103, 104, 105, and/or 106 may, in turn, utilize one or more client applications to interact with the server 120 to take advantage of the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from system 100. Accordingly, fig. 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.
The user may use client devices 101, 102, 103, 104, 105, and/or 106 to display videos according to the video classification results. The client device may provide an interface that enables a user of the client device to interact with the client device. The client device may also output information to the user via the interface. Although fig. 1 depicts only six client devices, those skilled in the art will appreciate that any number of client devices may be supported by the present disclosure.
Client devices 101, 102, 103, 104, 105, and/or 106 may include various types of computer devices, such as portable handheld devices, general purpose computers (such as personal computers and laptop computers), workstation computers, wearable devices, gaming systems, thin clients, various messaging devices, sensors or other sensing devices, and so forth. These computer devices may run various types and versions of software applications and operating systems, such as Microsoft Windows, Apple iOS, UNIX-like operating systems, Linux, or Linux-like operating systems (e.g., Google Chrome OS); or include various Mobile operating systems, such as Microsoft Windows Mobile OS, iOS, Windows Phone, Android. Portable handheld devices may include cellular telephones, smart phones, tablets, Personal Digital Assistants (PDAs), and the like. Wearable devices may include head mounted displays and other devices. The gaming system may include a variety of handheld gaming devices, internet-enabled gaming devices, and the like. The client device is capable of executing a variety of different applications, such as various Internet-related applications, communication applications (e.g., email applications), Short Message Service (SMS) applications, and may use a variety of communication protocols.
Network 110 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including but not limited to TCP/IP, SNA, IPX, etc. By way of example only, one or more networks 110 may be a Local Area Network (LAN), an ethernet-based network, a token ring, a Wide Area Network (WAN), the internet, a virtual network, a Virtual Private Network (VPN), an intranet, an extranet, a Public Switched Telephone Network (PSTN), an infrared network, a wireless network (e.g., bluetooth, WIFI), and/or any combination of these and/or other networks.
The server 120 may include one or more general purpose computers, special purpose server computers (e.g., PC (personal computer) servers, UNIX servers, mid-end servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and/or combination. The server 120 may include one or more virtual machines running a virtual operating system, or other computing architecture involving virtualization (e.g., one or more flexible pools of logical storage that may be virtualized to maintain virtual storage for the server). In various embodiments, the server 120 may run one or more services or software applications that provide the functionality described below.
The computing units in server 120 may run one or more operating systems including any of the operating systems described above, as well as any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and/or middle tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, and the like.
In some implementations, the server 120 may include one or more applications to analyze and consolidate data feeds and/or event updates received from users of the client devices 101, 102, 103, 104, 105, and 106. Server 120 may also include one or more applications to display data feeds and/or real-time events via one or more display devices of client devices 101, 102, 103, 104, 105, and 106.
In some embodiments, the server 120 may be a server of a distributed system, or a server incorporating a blockchain. The server 120 may also be a cloud server, or a smart cloud computing server or a smart cloud host with artificial intelligence technology. The cloud Server is a host product in a cloud computing service system, and is used for solving the defects of high management difficulty and weak service expansibility in the traditional physical host and Virtual Private Server (VPS) service.
The system 100 may also include one or more databases 130. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 130 may be used to store information such as audio files and video files. The data store 130 may reside in various locations. For example, the data store used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The data store 130 may be of different types. In certain embodiments, the data store used by the server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data to and from the database in response to the command.
In some embodiments, one or more of the databases 130 may also be used by applications to store application data. The databases used by the application may be different types of databases, such as key-value stores, object stores, or regular stores supported by a file system.
The system 100 of fig. 1 may be configured and operated in various ways to enable application of the various methods and apparatus described in accordance with the present disclosure.
With the rapid development of the internet technology, the application scenes of short videos are continuously enriched, and massive short videos are uploaded to an internet platform. Aiming at the short videos uploaded to the Internet platform, the platform classifies the short videos and displays the short videos based on classification results.
The video category may be determined based on the video scene. Illustratively, the video categories may include the following sensitive video categories: a firearm video category that includes firearm scenes, a regulatory tool category that includes regulatory tool scenes, an explosion fire video category that includes explosion fire scenes, a riot party video category that includes riot party scenes, a bloody smell video category that includes bloody smell scenes, a uniform video category that includes police uniforms, a military video category that includes forces, and a weapon video category that includes weapons. For sensitive video categories, the platform may not be exposed. Videos that do not include the sensitive scenes described above may be determined to be of the normal video category. It will be appreciated that the video categories are not limited to only including the sensitive video category and the normal video category, and may also include, for example, the technology video category, the entertainment video category, and so forth.
In the related technology, video classification is completed manually, and in the face of massive videos, manual review cost is high and efficiency is low.
In order to solve the technical problem, the present disclosure provides a video classification method, which first performs frame extraction on a target video to be classified to obtain a plurality of target video frames, and inputs the plurality of target video frames into a target classification model to obtain a category prediction score of each target video frame output by the target classification model, where the target video frame belongs to a preset video category. The method also determines a preset score threshold and a preset video frame number associated with the preset video category, and may determine the category of the target video as the preset video category in response to determining that the number of one or more target video frames for which the corresponding category prediction score is not less than the preset score threshold is not less than the preset video frame number. Therefore, by determining the preset score threshold value and the preset video frame number of the video category level, the category prediction score of a plurality of video frames of the video belonging to the preset video category can be determined based on the target classification model, and whether the video is the preset video category or not can be accurately and quickly determined.
By the aid of the technical scheme, the sensitive videos uploaded to the internet platform can be quickly identified, the sensitive videos can not be displayed, and safety risks of the platform are reduced. It should be noted that, by using the technical solution of the present disclosure, it can also be quickly identified whether the video uploaded to the internet platform is of another video category (for example, a science video category and an entertainment video category), and for each video category, only the relevant preset score threshold and the relevant preset video frame number of the video category need to be determined.
The video classification method disclosed by the invention can be suitable for various internet platforms, such as hundred-degree libraries and mobile phone hundred-degree libraries, and is used for realizing video classification.
A video classification method according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.
Fig. 2 is a flowchart illustrating a video classification method according to an embodiment of the present disclosure. As shown in fig. 2, the video classification method may include: step S201, frame extraction is carried out on a target video to obtain a plurality of target video frames; step S202, inputting the target video frames into a target classification model, and obtaining a first class prediction score of each target video frame in the target videos output by the target classification model, wherein the first class prediction score can represent the probability that the target video frame belongs to a first video class; step S203, determining a first preset score threshold value and a first preset video frame number related to the first video category; step S204, for the plurality of target video frames, in response to determining that the number of one or more target video frames corresponding to the first class prediction score is not less than the first preset score threshold is not less than the first preset video frame number, determining that the class of the target video is the first video class. Thus, class prediction is performed on a plurality of target video frames of the target video through the target classification model, and a class prediction score of each target video frame belonging to the first video class can be obtained. By determining the preset score threshold and the preset video frame number related to the first video category, whether the target video is the first video category can be accurately and quickly determined based on the category prediction scores corresponding to the target video frames.
According to some embodiments, the target video may be a video uploaded by a user to an internet platform, a video captured from the internet, or a video downloaded from a third-party service or software application, and the like, without limitation. The length (e.g., the number of frames included) of the target video is not limited herein, and may be set according to the actual requirement of the internet platform, for example, a video segment with a set length may be intercepted from an uploaded video, a grabbed video or a downloaded video as the target video.
According to some embodiments, the target video may be uniformly decimated, but not limited to, every set duration (e.g., 1 s). After the target video frame is obtained, the target video frame may be preprocessed by scaling, cropping, flipping, etc. to fit the target classification model. The preprocessing can also include normalizing the values of all pixels of each target video frame, so that the pixel values of the whole target video frame can be normalized to be in a range of 0-1, the target video frames have similar distribution, and the calculation amount of the model is greatly reduced. The normalization may be, for example: the average of all pixel values for the entire video frame is calculated, the average is subtracted from each pixel value and the variance is taken.
The target classification model may select a heavyweight network model, such as AlexNet, VGGNet, or ResNet. The target classification model may also select a lightweight network model (e.g., MobileNet), which is particularly suitable for a scene in which the video classification method is applied to the terminal.
The first video category may be, but is not limited to, any set sensitive video category, and may also be other video categories (e.g., science video category, entertainment video category), and it may be determined whether the category of the target video is the first video category based on a first preset score threshold and a first preset video frame number related to the first video category and a first category prediction score of the target classification model for each target video frame by using the technical solution of the present disclosure.
In this disclosure, except for a special statement, each of the plurality of target video frames refers to a plurality of target video frames obtained by frame extraction of a target video.
According to some embodiments, for a plurality of target video frames, the category of the target video may be determined not to be the first video category in response to determining that the number of one or more target video frames for which the respective first category prediction score is less than the first preset score threshold s is less than a first preset video frame number k.
Illustratively, the first preset video frame number k may be any positive integer of 1, 2, 3 …, etc. The first preset score threshold s may be set according to an application requirement, and may be, for example, but not limited to, any value in the interval of [0.2,0.8 ].
How to determine the preset video frame number and the preset score threshold value of the video category level will be described in detail below.
According to some embodiments, as shown in fig. 3, the step S203 of determining the first preset score threshold and the first preset video frame number related to the first video category may include: step S301, acquiring a plurality of positive sample videos and a plurality of negative sample videos of the first video category, wherein each positive sample video comprises at least one positive sample frame, and all frames of each negative sample video are negative sample frames; step S302, performing frame extraction on each positive sample video in the positive sample videos to obtain a plurality of positive sample video frames, and performing frame extraction on each negative sample video in the negative sample videos to obtain a plurality of negative sample video frames; step S303, inputting a plurality of positive sample video frames included in each of the plurality of positive sample videos into the target classification model, and obtaining a first class prediction score of each positive sample video frame output by the target classification model; step S304, inputting a plurality of negative sample video frames included in each of the plurality of negative sample videos into the target classification model, and obtaining a first class prediction score of each negative sample video frame output by the target classification model; and step S305, determining a first preset score threshold value and a first preset video frame number related to the first video category based on a preset recall rate and a preset false detection rate, and the first category prediction score of each positive sample video frame in the positive sample videos and the first category prediction score of each negative sample video frame in the negative sample videos. Therefore, by setting a preset recall rate and a preset false retrieval rate and utilizing the target classification model to predict the corresponding first class prediction scores of the positive type positive sample video frames and the corresponding first class prediction scores of the negative type negative sample video frames, a first preset score threshold value and a first preset video frame number related to the first video class can be determined, so that the recall rate and the false retrieval rate determined by the target classification model can meet the preset recall rate and the preset false retrieval rate, and the accuracy of the video classification result is improved.
A positive sample frame may refer to: and determining that a certain video frame is a positive sample frame of the first video category when the certain video frame comprises a scene corresponding to the first video category. Taking the first video category as an example of the sensitive video category, in a case that a certain video frame includes a sensitive scene corresponding to the sensitive video category (for example, gun, pipe cutter, explosion fire, riot gathering, bloody smell, police uniform, army, and large weapon), the video frame is determined to be a positive sample frame of the first video category.
Negative sample frames may refer to: and under the condition that a certain video frame does not comprise a scene corresponding to the first video category, determining that the video frame is a negative sample frame of the first video category. Taking the first video category as the sensitive video category as an example, in the case that a certain video frame does not include a sensitive scene corresponding to the sensitive video category (for example, gun, knife, explosion fire, riot gathering, bloody smell, police uniform, army, and large weapon), the video frame is determined to be a negative sample frame of the first video category.
In the case where at least one video frame of a certain video is a positive sample frame of a first video category, it may be determined that the video is a positive sample video of the first video category. Similarly, in the case that all video frames of a certain video are negative sample frames of the first video category, the video may be determined to be a negative sample video of the first video category.
Multiple positive sample videos of each of multiple video categories may be obtained through manual annotation to establish a positive sample video set for each video category. A plurality of negative sample videos of a plurality of video categories can be acquired in a random downloading mode to establish a negative sample video set of each video category. For example, one negative sample video set may be shared for a plurality of sensitive video categories, that is, a plurality of negative sample videos in the negative sample video set are negative sample videos of each sensitive video category. Illustratively, the number of negative sample videos included in the negative sample video set can be much larger than the number of positive sample videos included in each positive sample video set, so that the manual labeling work can be reduced, and the efficiency is improved. For example, each positive sample video set may include 300 positive sample videos, and each negative sample video set may include 10000 negative sample videos.
According to some embodiments, the positive sample video may be uniformly decimated, but not limited to, every set duration (e.g., 1 s). Likewise, the negative sample video may be, but is not limited to, decimated every set duration (e.g., 1 s). After the positive sample video frame and the negative sample video are obtained, the positive sample video frame and the negative sample video may be subjected to preprocessing such as scaling, cropping, flipping, etc., to fit the target classification model. The preprocessing can also include, for example, normalizing the values of all pixels of each positive sample video frame and normalizing the values of all pixels of each negative sample video frame, so that the pixel values of the whole positive sample video frame and the pixel values of the whole negative sample video frame can be normalized to the range of 0-1, and the calculation amount of the model is greatly reduced.
According to some embodiments, as shown in FIG. 4, step S305Determining a first preset score threshold and a first preset video frame number related to the first video category based on a preset recall rate and a preset false detection rate, and a first category prediction score of each positive sample video frame in the plurality of positive sample videos and a first category prediction score of each negative sample video frame in the plurality of negative sample videos may include: step S401, setting a plurality of initial score thresholds and a plurality of initial video frame numbers; step S402, determining the recall quantity of at least one positive sample video belonging to the first video category in the plurality of positive sample videos based on the combination of any initial score threshold value in the plurality of initial score threshold values and any initial video frame number in the plurality of initial video frame numbers and the first category prediction score of each positive sample video frame; and step S403, determining a recall rate corresponding to a combination of any one of the initial score thresholds and any one of the initial video frame numbers based on the recall number and the total number of the positive sample videos. Thereby, by setting a plurality of initial score thresholds s0、s1… … and a plurality of initial video frame numbers k0、k1… …, the recall rate of the positive sample video corresponding to any initial score threshold and any initial video frame number combination can be determined. The plurality may include two or more.
For example, the value range of the initial score thresholds may be, but is not limited to, 0.2, 0.8. For example, the plurality of initial score thresholds may be an arithmetic series. Taking the value interval of [0.2,0.8] as an example, the value can be taken once every 0.02, so as to obtain a plurality of initial score thresholds.
Illustratively, the plurality of initial video frame numbers may include any number of positive integers (e.g., 1, 2, 3).
According to some embodiments, the preset recall rate may be, for example, greater than 90%, and the preset false positive rate may be, for example, less than 1%.
The recall may refer to a recall of a video of the first video category by the target classification model, and specifically may be: inputting a plurality of video frames obtained by extracting frames of a certain positive sample video of a first video category into a target classification model, acquiring a first category prediction score of each video frame output by the target classification model, and determining that the positive sample video is recalled into the first video category by the target classification model in response to determining that the number of at least one video frame of which the corresponding first category prediction score is not less than the initial score threshold is not less than the initial video frame number for any combination of the initial score threshold and the initial video frame number; and in response to determining that the number of at least one video frame for which the corresponding first-category prediction score is not less than the initial score threshold is less than the initial video frame number, it may be determined that the positive sample video has not been recalled by the target classification model as the first video category.
The number of recalls refers to: for any combination of initial score threshold and initial video frame number, a number of positive sample videos are input into the target classification network model, which can be recalled by the target classification model as the number of positive sample videos of the first video category.
Including s with multiple initial score thresholds0、s1、s2The plurality of initial video frames includes k0、k1、k2For example, for an initial score threshold s0And initial video frame number k0For each positive sample video, in response to determining that the respective first class prediction score is not less than s0Is not less than k0Determining that the positive sample video belongs to a first video category and is recalled by the target classification model; and in response to determining that the corresponding first class prediction score is not less than s0Is less than k0It may be determined that the positive sample video does not belong to the first video category and is not recalled by the target classification model. Thereby enabling the determination of an initial score threshold s0And initial video frame number k0The corresponding number of recalls combined. Further, a ratio between the number of recalls and the total number of the plurality of positive sample videos may be determined as the recall rate.
Using the above method, an initial score threshold s may be determined0And initial video frame number k1Combination of (2), initial scoreNumber threshold s0And initial video frame number k2Combination of (1), initial score threshold s1And initial video frame number k0Combination of (1), initial score threshold s1And initial video frame number k1Combination of (1), initial score threshold s1And initial video frame number k2Combination of (1), initial score threshold s2And initial video frame number k0Combination of (1), initial score threshold s2And initial video frame number k1Combination of (1), initial score threshold s2And initial video frame number k2The combinations of (a) and (b) each correspond to a recall rate.
According to some embodiments, as shown in fig. 4, the step S305 of determining a first preset score threshold and a first preset video frame number related to the first video category based on a preset recall rate and a preset false detection rate, and the first category prediction score of each positive sample video frame in the plurality of positive sample videos and the first category prediction score of each negative sample video frame in the plurality of negative sample videos may further include: step S404, determining the false detection number of at least one negative sample video belonging to the first video category in the negative sample videos based on the combination of any initial score threshold value in the initial score threshold values and any initial video frame number in the initial video frame numbers and the first category prediction score of each negative sample video frame; and step S405, determining the false detection rate corresponding to the combination of any initial score threshold value in the plurality of initial score threshold values and any initial video frame number in the plurality of initial video frame numbers based on the false detection number and the total number of the plurality of negative sample videos. Thereby, by setting a plurality of initial score thresholds s0、s1… … and a plurality of initial video frame numbers k0、k1… …, the false positive rate of the corresponding negative sample video (i.e. negative sample video) of any initial score threshold and any initial video frame number combination can be determined.
The false detection number is: and aiming at the combination of any initial score threshold and any initial video frame number, inputting a plurality of negative sample videos into the target classification model, and recalling the negative sample videos into the first video category by the target classification model.
Continuing to include s with multiple initial score thresholds0、s1、s2The plurality of initial video frames includes k0、k1、k2For example, for an initial score threshold s0And initial video frame number k0For each negative sample video, in response to determining that the respective first class prediction score is not less than s0Is not less than k0Determining that the negative sample video belongs to a first video category, and performing false detection on the negative sample video as the first video category by a target classification model; and in response to determining that the corresponding first class prediction score is not less than s0Is less than k, of the at least one negative sample video frame0It may be determined that the negative sample video does not belong to the first video category and is not falsely detected as the first video category by the target classification model. Thereby enabling the determination of an initial score threshold s0And initial video frame number k0The corresponding number of false positives. Further, a ratio between the number of false detections and the total number of the plurality of negative sample videos may be determined as a false detection rate.
Using the above method, an initial score threshold s may be determined0And initial video frame number k1Combination of (1), initial score threshold s0And initial video frame number k2Combination of (1), initial score threshold s1And initial video frame number k0Combination of (1), initial score threshold s1And initial video frame number k1Combination of (1), initial score threshold s1And initial video frame number k2Combination of (1), initial score threshold s2And initial video frame number k0Combination of (1), initial score threshold s2And initial video frame number k1Combination of (1), initial score threshold s2And initial video frame number k2The respective false detection rates of the combinations of (1).
It should be noted that the above is only an example to determine how to determine the recall rate and the false positive rate of each combination of any initial score threshold and any initial video frame number, and is not limited thereto.
After the recall rate and the false positive rate corresponding to any combination of the initial score threshold and any combination of the initial video frame numbers are determined, a first preset score threshold and a first preset video frame number related to the first video category may be determined based on the recall rate and the false positive rate corresponding to any combination of the initial score threshold and any combination of the initial video frame numbers, and a preset recall rate and a preset false positive rate.
According to some embodiments, as shown in fig. 4, the step S305 of determining the first preset score threshold and the first preset video frame number related to the first video category based on the preset recall rate and the preset false detection rate, and the first category prediction score of each positive sample video frame and the first category prediction score of each negative sample video frame may further include: step S406, determining at least one combination in which the corresponding recall rate is greater than the preset recall rate and the corresponding false positive rate is less than the preset false positive rate from the combination of any initial score threshold value in the plurality of initial score threshold values and any initial video frame number in the plurality of initial video frame numbers; and step S407, determining a first preset score threshold and a first preset video frame number related to the first video category based on the initial score threshold and the initial video frame number corresponding to each combination in the at least one combination. Therefore, a first preset score threshold value and a first preset video frame number related to the first video category, which enable the recall rate to be large enough and the false detection rate to be small enough, can be obtained, the recall rate of the target classification model for the first video category is improved, and the false detection rate of the first video category is reduced. For example, the preset recall rate may be greater than 90%, and the preset false detection rate may be less than 1%, for example.
It should be noted that the execution sequence of steps S402 to S403 and steps S404 to 405 is not limited, and both steps may be executed simultaneously. That is, the order of determining the recall rate and determining the false positive rate is not limited, and the recall rate and the false positive rate may be determined at the same time.
For example, in step S407, a combination with the largest recall rate and the smallest false detection rate in the at least one combination may be determined, and an initial score threshold corresponding to the combination may be determined as a first preset score threshold, and an initial video frame number corresponding to the combination may be determined as a first preset video frame number. It is understood that step S407 is not limited to be implemented in one manner, for example, a weighted average of initial score thresholds corresponding to the at least one combination may be determined as a first preset score threshold, and a weighted average of initial video frame numbers corresponding to the at least one combination may be determined as a first preset video frame number.
By specifically describing how to determine the first preset score threshold and the first preset video frame number related to the first video category in combination with the exemplary embodiment, it can be achieved that the recall rate of the target classification model for the first video category is sufficiently high and the false positive rate is sufficiently small. It will be appreciated that the manner of determining the first predetermined score threshold and the first predetermined video frame number associated with the first video category is not limited to the above.
By the method, the first preset score threshold and the first preset video frame number related to different video categories can be determined, so that the identification accuracy of each video category can be improved. In this case, according to some embodiments, the output of the target classification model may further include a second class prediction score for each target video frame of the plurality of target videos, the first class prediction score being capable of characterizing a probability that the target video frame belongs to a second video class, wherein the second video class is different from the first video class. Illustratively, as shown in fig. 5, the method may further include: step S507, determining a second preset score threshold value and a second preset video frame number related to the second video category; and step S509, determining, for the plurality of target video frames, that the category of the target video is the second video category in response to determining that the number of one or more target video frames of which the corresponding second category prediction score is not less than the second preset score threshold is not less than the second preset video frame number. Therefore, multi-classification prediction can be realized, and the accuracy of video category prediction can be improved by combining the corresponding preset score threshold and the preset video frame number for different video categories.
Steps S501 to S503, and S505 in fig. 5 may respectively correspond to steps S201 to S204 in fig. 2, where step S502 may further include obtaining a second class prediction score of each target video frame in the plurality of target videos output by the target classification model. The execution sequence between S503-504 and S507-S508 is not limited, and the two can be parallel.
For example, based on the output of the target classification model, it may be determined that the target video is recalled by both the first video category and the second video category. Determining the category of the target video as one of the first video category and the second video category based on the output result of the target classification model may also be achieved by adjusting corresponding parameters (e.g., a preset score threshold and a preset video frame number associated with each video category).
According to some embodiments, in case of implementing multi-classification prediction, the method may further comprise: and in response to determining that the category of the target video is not the first video category and the second video category, determining that the target video is a third video category so as to be applicable to the requirements of a specific scene. By taking the first video category and the second video category as the sensitive video categories as an example, the prediction of the multiple video categories can be realized by using the above technical scheme, and in response to determining that the target video is not any sensitive video category, the target video is determined to be a normal video (i.e., the third video category) without belonging to the sensitive video. Accordingly, it may be determined that the target video belongs to a sensitive video in response to determining that the target video is of any one of the sensitive video categories.
According to some embodiments, as shown in fig. 5, in the case that steps S503 to 504 are performed first, and the first video category and the second video category are sensitive video categories, after step S504 is performed (for the plurality of target video frames, it is determined whether the number of one or more target video frames whose corresponding first category prediction score is not less than the first preset score threshold is not less than the first preset video frame number), the category of the target video frame may be determined to be the first video category (step S505), in response to determining that the number of one or more target video frames whose corresponding first category prediction score is not less than the first preset score threshold is not less than the second preset video frame number, the target video may be directly determined to be a sensitive video, steps S507 to S510 are not performed; and in response to determining that the number of the one or more target video frames for which the corresponding first category prediction score is not less than the first preset score threshold is less than the second preset video frame number, determining that the category of the target video frames is not the first video category (step S506), continuing to perform the steps of: step S507, determining a second preset score threshold value and a second preset video frame number related to the second video category; step S508, determining whether the number of one or more target video frames corresponding to the second category prediction score not less than the second preset score threshold is not less than the second preset video frame number; step S509, for the plurality of target video frames, in response to determining that the number of one or more target video frames corresponding to the second category prediction score not smaller than the second preset score threshold is not smaller than the second preset video frame number, determining that the category of the target video is the second video category, and further determining that the target video is a sensitive video; and in response to determining that the number of the one or more target video frames of which the corresponding second category prediction score is not less than the second preset score threshold is less than the second preset video frame number, determining that the category of the target video is not the second video category (step S510), and further determining that the target video is the third video category (step S511), that is, the non-sensitive video (normal video). The types of the sensitive video are not limited herein, and may include only two types, or may include more than two types, and the target video may be determined to be the sensitive video or the normal video by using the above steps.
The above describes in detail how to predict the category of the input target video using the target classification model.
According to some embodiments, as shown in fig. 6, the training process of the target classification model may include: s601, performing frame extraction on a sample video to obtain a plurality of sample video frames, and labeling the real type of each sample video frame; step S602, inputting the plurality of sample video frames into the target classification model, and obtaining the sample prediction category and the prediction score of each sample video frame in the plurality of sample videos output by the target classification model; step S603, calculating a loss value based on the real categories of the sample video frames and the corresponding sample prediction categories and prediction scores of the sample video frames; and step S604, adjusting parameters of the target classification model based on the loss value. The above steps may be iterated until the training of the target classification model is completed. The condition for ending the iteration may be, for example, that the calculated loss value is smaller than a set value, or that the number of iterations reaches a set number.
For example, in the training process, the model parameters may be continuously updated, but not limited to, by a random gradient descent, so that the model converges.
Illustratively, a verification set can be obtained, in the training process, the model can also be verified by using the verification set, and the optimal model on the verification set is selected as the final model.
According to some embodiments, sample video may be uniformly decimated, but not limited to, every set duration (e.g., 1 s). After obtaining the sample video frame, the sample video frame may be preprocessed by scaling, cropping, flipping, etc. to fit the target classification model. The preprocessing can also include normalizing the values of all pixels of each sample video frame, so that the pixel values of the whole sample video frame can be normalized to be in a range of 0-1, the sample video frames have similar distribution, the optimization process of gradient descent is facilitated, the model can be rapidly converged, and the calculation amount of the model can be greatly reduced. The normalization may be, for example: the average of all pixel values for the entire video frame is calculated, the average is subtracted from each pixel value and the variance is taken.
According to the embodiment of the disclosure, a video classification device is also provided. As shown in fig. 7, the video classification apparatus 700 may include: a frame extracting unit 701 configured to extract a frame of a target video to obtain a plurality of target video frames; a target classification model 702 configured to process the input plurality of target video frames to output a first class prediction score for each of the plurality of target video frames, the first class prediction score being capable of characterizing a probability that the target video frame belongs to a first video class; a first determining unit 703 configured to determine a first preset score threshold and a first preset video frame number related to the first video category; and a second determining unit 704 configured to determine, for the plurality of target video frames, a category of the target video as the first video category in response to determining that a number of one or more target video frames for which the respective first category prediction score is not less than the first preset score threshold is not less than the first preset video frame number.
Here, the operations of the above units 701 to 704 of the video classification apparatus 700 are similar to the operations of the steps S201 to S204 described above, and are not repeated herein.
According to some embodiments, the first determining unit may include: an obtaining subunit configured to obtain a plurality of positive sample videos and a plurality of negative sample videos of the first video category, each positive sample video including at least one positive sample frame, all frames of each negative sample video being negative sample frames. Wherein the frame-extracting unit is further configured to extract a frame of each of the plurality of positive sample videos to obtain a plurality of positive sample video frames, and extract a frame of each of the plurality of negative sample videos to obtain a plurality of negative sample video frames. Wherein the target classification model is further configured to process a plurality of positive sample video frames included in each of the plurality of input positive sample videos to output a first class prediction score for each positive sample video frame. Wherein the target classification model is further configured to process a plurality of negative sample video frames included in each of the plurality of input negative sample videos to output a first class prediction score for each negative sample video frame; and the determining subunit is configured to determine a first preset score threshold and a first preset video frame number related to the first video category based on a preset recall rate and a preset false detection rate, and the first category prediction score of each positive sample video frame in the plurality of positive sample videos and the first category prediction score of each negative sample video frame in the plurality of negative sample videos.
According to some embodiments, the determining the sub-unit may comprise: a setting subunit configured to set a plurality of initial score thresholds and a plurality of initial video frame numbers; a first determining subunit configured to determine a recall number of at least one positive sample video belonging to the first video category in the plurality of positive sample videos based on a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers, and a first category prediction score of each positive sample video frame; and a second determining subunit configured to determine, based on the number of recalls and the total number of the plurality of positive sample videos, a recall rate corresponding to a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers.
According to some embodiments, the determining the subunit may further comprise: a third determining subunit configured to determine, based on a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers, and the first class prediction score of each negative sample video frame, a false detection number of at least one negative sample video belonging to the first video class in the plurality of negative sample videos; and a fourth determining subunit, configured to determine, based on the false detection number and the total number of the negative sample videos, a false detection rate corresponding to a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers.
According to some embodiments, the determining subunit may further comprise: a fifth determining subunit, configured to determine, from a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers, at least one combination in which the corresponding recall rate is greater than the preset recall rate and the corresponding false positive rate is less than the preset false positive rate; and a sixth determining subunit configured to determine a first preset score threshold and a first preset video frame number related to the first video category based on the corresponding initial score threshold and initial video frame number of each of the at least one combination.
According to an embodiment of the present disclosure, there is also provided an electronic apparatus including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the video classification method described above.
There is also provided, in accordance with an embodiment of the present disclosure, a non-transitory computer-readable storage medium having stored thereon computer instructions for causing the computer to perform the above-described video classification method.
There is also provided, in accordance with an embodiment of the present disclosure, a computer program product, including a computer program, wherein the computer program, when executed by a processor, implements the above-described video classification method.
Referring to fig. 8, a block diagram of a structure of an electronic device 800, which may be a server or a client of the present disclosure, which is an example of a hardware device that may be applied to aspects of the present disclosure, will now be described. Electronic device is intended to represent various forms of digital electronic computer devices, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The calculation unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
A number of components in the device 800 are connected to the I/O interface 805, including: an input unit 806, an output unit 807, a storage unit 808, and a communication unit 809. The input unit 806 may be any type of device capable of inputting information to the device 800, and the input unit 806 may receive input numeric or character information and generate key signal inputs related to user settings and/or function controls of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and/or a remote control. Output unit 807 can be any type of device capable of presenting information and can include, but is not limited to, a display, speakers, a video/audio output terminal, a vibrator, and/or a printer. The storage unit 808 may include, but is not limited to, a magnetic disk, an optical disk. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunications networks, and may include, but is not limited to, modems, network cards, infrared communication devices, wireless communication transceivers and/or chipsets, such as bluetooth (TM) devices, 1302.11 devices, WiFi devices, WiMax devices, cellular communication devices, and/or the like.
Computing unit 801 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and the like. The calculation unit 801 executes the respective methods and processes described above, for example, steps S201 to S204. For example, in some embodiments, the video classification method may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto device 800 via ROM 802 and/or communications unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the video classification method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the video classification method in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be performed in parallel, sequentially or in different orders, and are not limited herein as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved.
Although embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it is to be understood that the above-described methods, systems and apparatus are merely exemplary embodiments or examples and that the scope of the present invention is not limited by these embodiments or examples, but only by the claims as issued and their equivalents. Various elements in the embodiments or examples may be omitted or may be replaced with equivalents thereof. Further, the steps may be performed in an order different from that described in the present disclosure. Further, various elements in the embodiments or examples may be combined in various ways. It is important that as technology evolves, many of the elements described herein may be replaced with equivalent elements that appear after the present disclosure.

Claims (20)

1. A video classification method, comprising:
performing frame extraction on a target video to obtain a plurality of target video frames;
inputting the target video frames into a target classification model, and obtaining a first class prediction score of each target video frame in the target videos output by the target classification model, wherein the first class prediction score can represent the probability that the target video frame belongs to a first video class;
determining a first preset score threshold and a first preset video frame number related to the first video category; and
for the plurality of target video frames, in response to determining that the number of one or more target video frames for which the corresponding first class prediction score is not less than the first preset score threshold is not less than the first preset video frame number, determining the class of the target video to be the first video class.
2. The method of claim 1, wherein said determining a first preset score threshold and a first preset video frame number associated with a first video category comprises:
obtaining a plurality of positive sample videos and a plurality of negative sample videos of the first video category, wherein each positive sample video comprises at least one positive sample frame, and all frames of each negative sample video are negative sample frames;
performing frame extraction on each positive sample video in the plurality of positive sample videos to obtain a plurality of positive sample video frames, and performing frame extraction on each negative sample video in the plurality of negative sample videos to obtain a plurality of negative sample video frames;
inputting a plurality of positive sample video frames included in each of the plurality of positive sample videos into the target classification model, and obtaining a first class prediction score of each positive sample video frame output by the target classification model;
inputting a plurality of negative sample video frames included in each of the plurality of negative sample videos into the target classification model, and obtaining a first class prediction score of each negative sample video frame output by the target classification model; and
and determining a first preset score threshold value and a first preset video frame number related to the first video category based on a preset recall rate and a preset false detection rate, and the first category prediction score of each positive sample video frame in the positive sample videos and the first category prediction score of each negative sample video frame in the negative sample videos.
3. The method of claim 2, wherein determining the first video category-related first preset score threshold and first preset video frame number based on a preset recall rate and a preset false positive rate, and the first category prediction score for each positive sample video frame and the first category prediction score for each negative sample video frame comprises:
setting a plurality of initial score thresholds and a plurality of initial video frame numbers;
determining a recall number of at least one of the plurality of positive sample videos that belongs to the first video category based on a combination of any of the plurality of initial score thresholds and any of the plurality of initial video frame numbers, and a first category prediction score for each positive sample video frame; and
and determining the recall rate corresponding to the combination of any initial score threshold value in the initial score threshold values and any initial video frame number in the initial video frame numbers based on the recall number and the total number of the positive sample videos.
4. The method of claim 3, wherein determining the first video category-related first preset score threshold and first preset video frame number based on a preset recall rate and a preset false positive rate, and the first category prediction score for each positive sample video frame and the first category prediction score for each negative sample video frame further comprises:
determining the false detection number of at least one negative sample video belonging to the first video category in the negative sample videos based on the combination of any initial score threshold in the initial score thresholds and any initial video frame number in the initial video frame numbers and the first category prediction score of each negative sample video frame; and
and determining the false detection rate corresponding to the combination of any initial score threshold value in the initial score threshold values and any initial video frame number in the initial video frame numbers based on the false detection number and the total number of the negative sample videos.
5. The method of claim 4, wherein determining the first video category-related first preset score threshold and first preset video frame number based on a preset recall rate and a preset false positive rate, and the first category prediction score for each positive sample video frame and the first category prediction score for each negative sample video frame further comprises:
determining at least one combination in which the corresponding recall rate is greater than the preset recall rate and the corresponding false positive rate is less than the preset false positive rate from the combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers; and
and determining a first preset score threshold and a first preset video frame number related to the first video category based on the initial score threshold and the initial video frame number corresponding to each combination in the at least one combination.
6. The method of claim 3, wherein the plurality of initial score thresholds are an arithmetic series.
7. The method of claim 3, wherein the one or more initial score thresholds have a span of [0.2,0.8 ].
8. The method of claim 3, wherein the plurality of initial video frame numbers comprises 1, 2, 3.
9. The method of any of claims 1-8, wherein the output of the target classification model further comprises a second class prediction score for each target video frame in the plurality of target videos, the first class prediction score being capable of characterizing a probability that the target video frame belongs to a second video class, the second video class being different from the first video class,
wherein the method further comprises:
determining a second preset score threshold and a second preset video frame number related to the second video category;
for the plurality of target video frames, in response to determining that the number of one or more target video frames for which the respective second category prediction score is not less than the second preset score threshold is not less than the second preset video frame number, determining that the category of the target video is the second video category.
10. The method of claim 9, wherein the method further comprises:
in response to determining that the category of the target video is not the first video category and the second video category, determining that the target video is a third video category.
11. The method according to any one of claims 1-8, wherein the method further comprises:
normalizing the values of all pixels of each target video frame before inputting the plurality of target video frames into the target classification model.
12. The method of any of claims 1-8, wherein the training process of the object classification model comprises:
performing frame extraction on the sample video to obtain a plurality of sample video frames, and labeling the real category of each sample video frame;
inputting the plurality of sample video frames into the target classification model, and obtaining the sample prediction category and the prediction score of each sample video frame in the plurality of sample videos output by the target classification model;
calculating a loss value based on the real categories of the plurality of sample video frames and the respective sample prediction categories and prediction scores thereof of the plurality of sample video frames;
adjusting parameters of the target classification model based on the loss values.
13. A video classification apparatus comprising:
the frame extracting unit is configured to extract frames of the target video to obtain a plurality of target video frames;
a target classification model configured to process the input plurality of target video frames to output a first class prediction score for each of the plurality of target video frames, the first class prediction score being capable of characterizing a probability that the target video frame belongs to a first video class;
a first determining unit configured to determine a first preset score threshold and a first preset video frame number related to the first video category; and
a second determination unit configured to determine, for the plurality of target video frames, a category of the target video as the first video category in response to determining that a number of one or more target video frames for which the respective first category prediction score is not less than the first preset score threshold is not less than the first preset video frame number.
14. The apparatus of claim 13, wherein the first determining unit comprises:
an acquisition subunit configured to acquire a plurality of positive sample videos and a plurality of negative sample videos of the first video category, each positive sample video including at least one positive sample frame, all frames of each negative sample video being negative sample frames,
wherein the frame-extracting unit is further configured to extract a frame of each positive sample video of the plurality of positive sample videos to obtain a plurality of positive sample video frames, and extract a frame of each negative sample video of the plurality of negative sample videos to obtain a plurality of negative sample video frames;
wherein the target classification model is further configured to process a plurality of positive sample video frames included in each of the input plurality of positive sample videos to output a first class prediction score for each positive sample video frame,
wherein the target classification model is further configured to process a plurality of negative sample video frames included in each of the plurality of input negative sample videos to output a first class prediction score for each negative sample video frame; and
the determining subunit is configured to determine a first preset score threshold and a first preset video frame number related to the first video category based on a preset recall rate and a preset false detection rate, and the first category prediction score of each positive sample video frame in the plurality of positive sample videos and the first category prediction score of each negative sample video frame in the plurality of negative sample videos.
15. The apparatus of claim 14, wherein the determining subunit comprises:
a setting subunit configured to set a plurality of initial score thresholds and a plurality of initial video frame numbers; and
a first determining subunit configured to determine a recall number of at least one positive sample video belonging to the first video category in the plurality of positive sample videos based on a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers, and a first category prediction score of each positive sample video frame;
a second determining subunit, configured to determine, based on the number of recalls and the total number of the plurality of positive sample videos, a recall rate corresponding to a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers.
16. The apparatus of claim 15, wherein the determining subunit further comprises:
a third determining subunit configured to determine, based on a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers, and the first class prediction score of each negative sample video frame, a false detection number of at least one negative sample video belonging to the first video class in the plurality of negative sample videos; and
and the fourth determining subunit is configured to determine, based on the false detection number and the total number of the negative sample videos, a false detection rate corresponding to a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers.
17. The apparatus of claim 16, wherein the determining subunit further comprises:
a fifth determining subunit, configured to determine, from a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frame numbers, at least one combination in which the corresponding recall rate is greater than the preset recall rate and the corresponding false positive rate is less than the preset false positive rate; and
a sixth determining subunit configured to determine a first preset score threshold and a first preset video frame number related to the first video category based on the corresponding initial score threshold and initial video frame number of each of the at least one combination.
18. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-12.
19. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-12.
20. A computer program product comprising a computer program, wherein the computer program realizes the method of any one of claims 1-12 when executed by a processor.
CN202110119275.7A 2021-01-28 2021-01-28 Video classification method, apparatus and medium Active CN112749685B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110119275.7A CN112749685B (en) 2021-01-28 2021-01-28 Video classification method, apparatus and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110119275.7A CN112749685B (en) 2021-01-28 2021-01-28 Video classification method, apparatus and medium

Publications (2)

Publication Number Publication Date
CN112749685A true CN112749685A (en) 2021-05-04
CN112749685B CN112749685B (en) 2023-11-03

Family

ID=75653362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110119275.7A Active CN112749685B (en) 2021-01-28 2021-01-28 Video classification method, apparatus and medium

Country Status (1)

Country Link
CN (1) CN112749685B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113436100A (en) * 2021-06-28 2021-09-24 北京百度网讯科技有限公司 Method, apparatus, device, medium and product for repairing video
CN113627534A (en) * 2021-08-11 2021-11-09 百度在线网络技术(北京)有限公司 Method and device for identifying type of dynamic image and electronic equipment
CN114302171A (en) * 2021-12-28 2022-04-08 新瑞鹏宠物医疗集团有限公司 Video auditing method and device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190163981A1 (en) * 2017-11-28 2019-05-30 Baidu Online Network Technology (Beijing) Co., Ltd. Method and apparatus for extracting video preview, device and computer storage medium
CN109947989A (en) * 2019-03-18 2019-06-28 北京字节跳动网络技术有限公司 Method and apparatus for handling video
CN110070067A (en) * 2019-04-29 2019-07-30 北京金山云网络技术有限公司 The training method of video classification methods and its model, device and electronic equipment
CN110929780A (en) * 2019-11-19 2020-03-27 腾讯科技(深圳)有限公司 Video classification model construction method, video classification device, video classification equipment and media
WO2020087974A1 (en) * 2018-10-30 2020-05-07 北京字节跳动网络技术有限公司 Model generation method and device
CN111626202A (en) * 2020-05-27 2020-09-04 北京百度网讯科技有限公司 Method and device for identifying video

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190163981A1 (en) * 2017-11-28 2019-05-30 Baidu Online Network Technology (Beijing) Co., Ltd. Method and apparatus for extracting video preview, device and computer storage medium
WO2020087974A1 (en) * 2018-10-30 2020-05-07 北京字节跳动网络技术有限公司 Model generation method and device
CN109947989A (en) * 2019-03-18 2019-06-28 北京字节跳动网络技术有限公司 Method and apparatus for handling video
CN110070067A (en) * 2019-04-29 2019-07-30 北京金山云网络技术有限公司 The training method of video classification methods and its model, device and electronic equipment
WO2020221278A1 (en) * 2019-04-29 2020-11-05 北京金山云网络技术有限公司 Video classification method and model training method and apparatus thereof, and electronic device
CN110929780A (en) * 2019-11-19 2020-03-27 腾讯科技(深圳)有限公司 Video classification model construction method, video classification device, video classification equipment and media
CN111626202A (en) * 2020-05-27 2020-09-04 北京百度网讯科技有限公司 Method and device for identifying video

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113436100A (en) * 2021-06-28 2021-09-24 北京百度网讯科技有限公司 Method, apparatus, device, medium and product for repairing video
CN113436100B (en) * 2021-06-28 2023-11-28 北京百度网讯科技有限公司 Method, apparatus, device, medium, and article for repairing video
CN113627534A (en) * 2021-08-11 2021-11-09 百度在线网络技术(北京)有限公司 Method and device for identifying type of dynamic image and electronic equipment
CN114302171A (en) * 2021-12-28 2022-04-08 新瑞鹏宠物医疗集团有限公司 Video auditing method and device and storage medium
CN114302171B (en) * 2021-12-28 2024-04-09 新瑞鹏宠物医疗集团有限公司 Video auditing method, device and storage medium

Also Published As

Publication number Publication date
CN112749685B (en) 2023-11-03

Similar Documents

Publication Publication Date Title
CN112749685B (en) Video classification method, apparatus and medium
CN112749758B (en) Image processing method, neural network training method, device, equipment and medium
CN114511758A (en) Image recognition method and device, electronic device and medium
CN114004985B (en) Character interaction detection method, neural network, training method, training equipment and training medium thereof
CN114445667A (en) Image detection method and method for training image detection model
CN113256583A (en) Image quality detection method and apparatus, computer device, and medium
CN113810765B (en) Video processing method, device, equipment and medium
CN113723305A (en) Image and video detection method, device, electronic equipment and medium
CN115600646B (en) Language model training method, device, medium and equipment
CN114219046B (en) Model training method, matching method, device, system, electronic equipment and medium
CN113596011B (en) Flow identification method and device, computing device and medium
CN113656843B (en) Information verification method, device, equipment and medium
CN114547252A (en) Text recognition method and device, electronic equipment and medium
CN113486853B (en) Video detection method and device, electronic equipment and medium
CN114842476A (en) Watermark detection method and device and model training method and device
CN115359309A (en) Training method, device, equipment and medium of target detection model
CN114429678A (en) Model training method and device, electronic device and medium
CN112905743A (en) Text object detection method and device, electronic equipment and storage medium
CN114140851B (en) Image detection method and method for training image detection model
CN114120420B (en) Image detection method and device
CN114882571A (en) Method for acquiring image information and method for training image detection model
CN114550269A (en) Mask wearing detection method, device and medium
CN113139095A (en) Video retrieval method and device, computer equipment and medium
CN113627330A (en) Method and device for identifying target type dynamic image and electronic equipment
CN114550264A (en) Model training method, face recognition device, face recognition equipment and face recognition medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant