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

Video classification method, apparatus and medium Download PDF

Info

Publication number
CN112749685B
CN112749685B CN202110119275.7A CN202110119275A CN112749685B CN 112749685 B CN112749685 B CN 112749685B CN 202110119275 A CN202110119275 A CN 202110119275A CN 112749685 B CN112749685 B CN 112749685B
Authority
CN
China
Prior art keywords
video
preset
category
target
frames
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.)
Active
Application number
CN202110119275.7A
Other languages
Chinese (zh)
Other versions
CN112749685A (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

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 disclosure provides a video classification method, device and medium, relates to the technical field of artificial intelligence, and particularly relates to the technical field of computer vision and big data processing. The implementation scheme is as follows: extracting frames of the target video to obtain a plurality of target video frames; inputting the target video frames into a target classification model, and acquiring 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 determining, for the plurality of target video frames, that the category of the target video is 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 not less than the first preset score threshold is not less than the first preset video frame number.

Description

Video classification method, apparatus and medium
Technical Field
The present disclosure relates to the field of artificial intelligence, and in particular, to the field of computer vision and big data processing technologies, and in particular, to a video classification method, apparatus, electronic device, computer readable storage medium, and computer program product.
Background
Artificial intelligence is the discipline of studying the process of making a computer mimic certain mental processes and intelligent behaviors (e.g., learning, reasoning, thinking, planning, etc.) of a person, both hardware-level and software-level techniques. 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, a machine learning/deep learning technology, a big data processing technology, a knowledge graph technology and the like.
Along with the rapid development of internet technology, the application scenes of short videos are continuously enriched, and massive short videos are uploaded to an internet platform, so that the lives of people are enriched. The Internet platform can classify the uploaded short videos so as 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, the problems mentioned in this section should not be considered as having been recognized in any prior art unless otherwise indicated.
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: extracting frames of the target video to obtain a plurality of target video frames; inputting the target video frames into a target classification model, and acquiring 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 determining, for the plurality of target video frames, that the category of the target video is 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 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 a video classification apparatus, including: the frame extraction 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 plurality of target video frames input 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 determining unit configured to determine, for the plurality of target video frames, that the category of the target video is 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 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 method described above.
According to another aspect of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon a computer program, wherein the computer program when executed by a processor implements the steps of the above-described method.
According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program, wherein the computer program, when executed by a processor, implements the steps of the above-described method.
According to one or more embodiments of the present disclosure, by determining the preset score threshold and the preset video frame number at the video category level, it is possible to accurately and rapidly determine whether the video is a preset video category based on the category prediction score of the target classification model for the plurality of video frames of the video belonging to the preset video category.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The accompanying drawings illustrate exemplary embodiments and, together with the description, serve to explain exemplary implementations of the embodiments. The illustrated embodiments are for exemplary purposes only and do not limit the scope of the claims. Throughout the drawings, identical reference numerals 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, in accordance with an embodiment of the present disclosure;
FIG. 2 illustrates a flow chart of a video classification method according to an embodiment of the disclosure;
FIGS. 3 and 4 illustrate a flow chart of a method of determining a preset score threshold and a preset video frame number in accordance with an embodiment of the present disclosure;
FIG. 5 illustrates a flow chart of a video classification method according to an embodiment of the disclosure;
FIG. 6 illustrates a training method flow diagram of a target classification model according to an embodiment of the disclosure;
fig. 7 shows a block diagram of a video classification device according to an embodiment of the 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 in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one 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, the use of the terms "first," "second," and the like to describe various elements is not intended to limit the positional relationship, timing relationship, or importance relationship of the elements, unless otherwise indicated, and such terms are merely used 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, they may also refer to different instances based on the description of the context.
The terminology used in the description of the various illustrated 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, the elements may be one or more if the number of the elements is not specifically limited. Furthermore, the term "and/or" as used in this disclosure encompasses 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 an embodiment 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 an embodiment 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, server 120 may also provide other services or software applications that may include non-virtual environments and virtual environments. In some 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 that are executable by one or more processors. A user operating client devices 101, 102, 103, 104, 105, and/or 106 may in turn utilize one or more client applications to interact with server 120 to utilize the services provided by these components. It should be appreciated 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 the present disclosure may support any number of client devices.
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 the like. 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, tablet computers, personal Digital Assistants (PDAs), and the like. Wearable devices may include head mounted displays and other devices. The gaming system may include various 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 number of available protocols, including but not limited to TCP/IP, SNA, IPX, etc. For example only, the 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 that involves virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain virtual storage devices of the server). In various embodiments, 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. 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, etc.
In some implementations, server 120 may include one or more applications to analyze and consolidate data feeds and/or event updates received from users of 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 implementations, the server 120 may be a server of a distributed system or a server that incorporates a blockchain. The server 120 may also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology. The cloud server is a host product in a cloud computing service system, so as to solve the defects of large management difficulty and weak service expansibility in the traditional physical host and virtual private server (VPS, virtual Private Server) 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 databases 130 may be used to store information such as audio files and video files. The data store 130 may reside in a variety of 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 some embodiments, the data store used by server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve the databases and data from the databases in response to the commands.
In some embodiments, one or more of 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 conventional stores supported by the 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.
Along with the rapid development of internet technology, 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. For sensitive video categories, the platform may not be exposed. Videos that do not include sensitive scenes may be determined as normal video categories. It will be appreciated that video categories are not limited to including only sensitive video categories and normal video categories, but may also include, for example, technical video categories, entertainment video categories, and the like.
In the related technology, the video classification is completed by manpower, and the manual auditing cost is higher and the efficiency is lower in the face of massive videos.
In order to solve the above technical problems, the present disclosure provides a video classification method, which firstly 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 class prediction score of each target video frame output by the target classification model, wherein the class prediction score belongs to a preset video class. The method also determines a preset score threshold and a preset video frame number associated with a preset video category, and may determine that the category of the target video is 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, whether the video is the preset video category can be accurately and rapidly determined based on the category prediction scores of the target classification model for the video frames belonging to the preset video category.
By utilizing the technical scheme disclosed by the invention, the sensitive video uploaded to the Internet platform can be rapidly identified, the sensitive video can not be displayed, and the safety risk of the platform is reduced. It should be noted that, by using the technical solution of the present disclosure, whether the video uploaded to the internet platform is of other video categories (for example, a technical video category and an entertainment video category) can be quickly identified, and only the relevant preset score threshold and the relevant preset video frame number of the video category need to be determined for each video category.
The video classification method disclosed by the invention can be applied to various internet platforms, such as hundred-degree libraries and mobile phones, and is used for realizing video classification.
The video classification method of the embodiments 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 the target video so as to obtain a plurality of target video frames; step S202, inputting the target video frames into a target classification model, and acquiring 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 and a first preset video frame number related to a first video category; step S204, for the plurality of target video frames, determining that the category of the target video is the first video category 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 first preset video frame number. Thus, the class prediction is performed on the plurality of target video frames of the target video through the target classification model, and the 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 rapidly 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 to the internet platform by a user, a video captured from the internet, a video downloaded from a third party service or software application, or the like, which is not limited herein. The length of the target video (for example, the number of frames included) 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 taken from the uploaded video, the captured video or the downloaded video as the target video.
According to some embodiments, the target video may be uniformly decimated, but not limited to, every set period of time (e.g., 1 s). After the target video frame is obtained, the target video frame may be subjected to preprocessing such as scaling, clipping, flipping, etc. to adapt to the target classification model. The preprocessing may further include, for example, normalizing the values of all pixels of each target video frame, so that the pixel values of the entire target video frame may be normalized to a range of 0 to 1, so that the target video frames have similar distribution, and the calculation amount of the model is greatly reduced. Normalization may be, for example: the average of all pixel values of the entire video frame is calculated, each pixel value is subtracted from the average and the variance is taken.
The target classification model may select a heavyweight network model, such as AlexNet, VGGNet or ResNet. The object classification model may also select a lightweight network model (e.g., mobileNet), particularly suitable for use in a scenario where the video classification method is applied to a terminal.
The first video category may be, but not limited to, any set sensitive video category, but may also be other video categories (e.g., technical video category, entertainment video category), and by using the technical solution of the present disclosure, it may be determined whether the category of the target video is the first video category based on the first preset score threshold and the first preset video frame number related to the first video category, and the first category prediction score of the target classification model for each target video frame.
In this disclosure, unless specifically stated otherwise, a plurality of target video frames refer 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, it may be determined that the category of the target video is not 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 the 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 fraction threshold s may be set according to the application requirement, 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 at the video category level will be described in detail below.
According to some embodiments, as shown in fig. 3, step S203, determining the first preset score threshold and the first preset video frame number related to the first video category may include: step 301, 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, frame extraction is carried out on each positive sample video in the positive sample videos to obtain a plurality of positive sample video frames, and frame extraction is carried out 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 respectively included in 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 respectively included in 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 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. Therefore, the first class prediction scores corresponding to the positive class positive sample video frames and the first class prediction scores corresponding to the negative class negative sample video frames are predicted by using the target classification model, and accordingly a first preset score threshold value and a first preset video frame number related to the first video class can be determined, and the recall rate and the false detection rate determined by using the target classification model can meet the preset recall rate and the preset false detection rate, and accuracy of video classification results is improved.
A positive sample frame may refer to: in the case that a certain video frame includes a scene corresponding to the first video category, the video frame is determined to be a positive sample frame of the first video category. Taking the first video category as the sensitive video category as an example, when a certain video frame includes a sensitive scene corresponding to the sensitive video category (in the case of determining that the video frame is a positive sample frame of the first video category).
Negative sample frames may refer to: and determining that the video frame is a negative sample frame of the first video category in the case that the video frame does not comprise the scene corresponding to the first video category. Taking the first video category as a sensitive video category as an example, when a certain video frame does not include a sensitive scene corresponding to the sensitive video category, determining that the video frame is 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, the video may be determined to be a positive sample video of the first video category. Likewise, in the case where all video frames of a certain video are negative sample frames of a first video category, the video may be determined to be a negative sample video of the first video category.
Multiple positive sample videos for each of the multiple video categories may be acquired by manual annotation to create a positive sample video set for each video category. Multiple negative sample videos of each of the multiple video categories can be acquired by means of random downloading to establish a negative sample video set of each video category. For example, for multiple sensitive video categories, one negative-sample video set may be shared, i.e., multiple negative-sample videos in the negative-sample video set are negative-sample videos for each sensitive video category. By way of example, the number of negative sample videos included in the negative sample video set may be far greater than the number of positive sample videos included in each positive sample video set, so that the work of manual labeling 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 period of time (e.g., 1 s). Likewise, negative sample video may be decimated, but not limited to, every set period of time (e.g., 1 s). After the positive sample video frames and the negative sample video are obtained, the positive sample video frames and the negative sample video may be subjected to preprocessing such as scaling, clipping, flipping, etc. to adapt to the object classification model. The preprocessing may further include 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 may be normalized to a range of 0-1, which greatly reduces the calculation amount of the model.
According to some embodiments, as shown in fig. 4, step S305, 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 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 include: step S401, setting a plurality of initial score thresholds and a plurality of initial video frame numbers; step S402, determining the recall number 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 one of the plurality of initial score thresholds and any one of the plurality of initial video frames 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 plurality of initial score thresholds and any one of the plurality of initial video frames based on the recall number and the total number of the plurality of positive sample videos. Thus, by setting a plurality of initial score thresholds s 0 、s 1 … … and a plurality of initial video frame numbers k 0 、k 1 … …, the recall 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.
Illustratively, the multiple initial score threshold value interval may be, for example, but not limited to [0.2,0.8]. For example, the plurality of initial score thresholds may be an arithmetic progression. 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 frames may include any number of positive integers (e.g., 1, 2, 3).
According to some embodiments, the preset recall may be, for example, greater than 90% and the preset false detection rate may be, for example, less than 1%.
The recall may refer to recall, by the object classification model, a video of the first video category, and may specifically be: inputting a plurality of video frames obtained by frame extraction of a certain positive sample video of a first video category into a target classification model, obtaining a first category prediction score of each video frame output by the target classification model, and responding to the fact that the number of at least one video frame with the corresponding first category prediction score not smaller than an initial score threshold is not smaller than the initial video frame number aiming at the combination of any initial score threshold and initial video frame number, determining that the positive sample video is recalled into the first video category by the target classification model; 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, determining that the positive sample video was not recalled by the target classification model as the first video category.
The number of recalls refers to: for any combination of an initial score threshold and any initial video frame number, a plurality of positive sample videos are input into the target classification network model, and 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 thresholds 0 、s 1 、s 2 The plurality of initial video frames includes k 0 、k 1 、k 2 For example, for an initial score threshold s 0 And an initial video frame number k 0 For each positive sample video, in response to determining that the respective first class prediction score is not less than s 0 At least one positive sample of (2)The number of the video frames is not less than k 0 The positive sample video can be determined to belong to a first video category and recalled by the target classification model; and in response to determining that the corresponding first class prediction score is not less than s 0 The number of at least one positive sample video frame of (a) is less than k 0 It 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 determination of an initial score threshold s 0 And an initial video frame number k 0 Corresponding recall amounts are combined. Further, a ratio between the number of recalls and the total number of the plurality of positive sample videos may be determined as a recall rate.
Using the method described above, an initial score threshold s can be determined 0 And an initial video frame number k 1 Is a combination of the initial score threshold s 0 And an initial video frame number k 2 Is a combination of the initial score threshold s 1 And an initial video frame number k 0 Is a combination of the initial score threshold s 1 And an initial video frame number k 1 Is a combination of the initial score threshold s 1 And an initial video frame number k 2 Is a combination of the initial score threshold s 2 And an initial video frame number k 0 Is a combination of the initial score threshold s 2 And an initial video frame number k 1 Is a combination of the initial score threshold s 2 And an initial video frame number k 2 Each corresponding recall.
According to some embodiments, as shown in fig. 4, step S305, 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 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 plurality of negative-sample videos based on the combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frames and the first category prediction score of each negative-sample video frame; step S405, And determining 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 frames based on the number of false detections and the total number of the plurality of negative sample videos. Thus, by setting a plurality of initial score thresholds s 0 、s 1 … … and a plurality of initial video frame numbers k 0 、k 1 … …, a false positive rate of a corresponding negative sample video (i.e., negative sample video) can be determined for any initial score threshold and any initial number of video frames.
The number of false detections means: for any combination of an initial score threshold and any initial video frame number, a plurality of negative sample videos are input into the target classification model and recalled by the target classification model as the number of negative sample videos of the first video category.
Continuing to include s with a plurality of initial score thresholds 0 、s 1 、s 2 The plurality of initial video frames includes k 0 、k 1 、k 2 For example, for an initial score threshold s 0 And an initial video frame number k 0 For each negative-sample video, in response to determining that the respective first-class prediction score is not less than s 0 The number of at least one negative-sample video frame of (a) is not less than k 0 The negative sample video can be determined to belong to a first video category, and is misdetected as the first video category by the target classification model; and in response to determining that the corresponding first class prediction score is not less than s 0 The number of at least one negative-sample video frame of (a) is less than k 0 The negative sample video may be determined not to belong to the first video category and not to be false detected as the first video category by the target classification model. Thereby enabling determination of an initial score threshold s 0 And an initial video frame number k 0 Corresponding false detection numbers are combined. Further, a ratio between the number of false positives and the total number of the plurality of negative sample videos may be determined as the false positive rate.
Using the method described above, an initial score threshold s can be determined 0 And an initial video frame number k 1 Is a combination of the initial score threshold s 0 And an initial video frame number k 2 Is a combination of the initial score threshold s 1 And an initial video frame number k 0 Is a combination of the initial score threshold s 1 And an initial video frame number k 1 Is a combination of the initial score threshold s 1 And an initial video frame number k 2 Is a combination of the initial score threshold s 2 And an initial video frame number k 0 Is a combination of the initial score threshold s 2 And an initial video frame number k 1 Is a combination of the initial score threshold s 2 And an initial video frame number k 2 Respectively, the respective false detection rates.
It should be noted that the foregoing is merely illustrative of how to determine the recall and the false detection rate of each combination of any initial score threshold and any initial video frame number, and is not limited thereto.
After determining the recall and false detection rates respectively corresponding to the combination of any initial score threshold and any initial video frame number, a first preset score threshold and a first preset video frame number associated with the first video category may be determined based on the recall and false detection rates respectively corresponding to the combination of any initial score threshold and any initial video frame number, and the preset recall and false detection rates.
According to some embodiments, as shown in fig. 4, step S305, 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 of the recall ratio being greater than the preset recall ratio and the false detection ratio being less than the preset false detection ratio from any one of the plurality of initial score thresholds and any one of 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, the first preset score threshold and the first preset video frame number related to the first video category with the large enough recall rate and the small enough false detection rate 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 may be greater than 90%, for example, 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 may be executed simultaneously. That is, the order of determining the recall rate and the false detection rate is not limited, and the recall rate and the false detection rate may be determined at the same time.
For example, in step S407, a combination having the largest recall rate and the smallest false detection rate among the at least one combination may be determined, and an initial score threshold corresponding to the combination is determined as a first preset score threshold, and an initial video frame number corresponding to the combination is determined as a first preset video frame number. It is to be understood that step S407 is not limited to the implementation in one of the above ways, for example, the weighted average of the initial score thresholds corresponding to each of the at least one combination may be determined as the first preset score threshold, and the weighted average of the initial video frames corresponding to each of the at least one combination may be determined as the first preset video frame number.
The above describes in detail, by means of an exemplary embodiment, how to determine the first preset score threshold and the first preset video frame number related to the first video category, it is possible to achieve that the recall rate of the target classification model for the first video category is sufficiently high and the false detection rate is sufficiently small. It will be appreciated that the manner of determining the first predetermined score threshold and the first predetermined number of video frames associated with the first video category is not limited to one of the above.
By the method, the first preset score threshold value and the first preset video frame number related to different video categories can be determined, so that the identification accuracy of the video of each video category can be improved. In this case, according to some embodiments, the output of the object classification model may further comprise a second class prediction score for each object video frame of the plurality of object videos, the first class prediction score being capable of characterizing a probability that the object 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 comprise: step S507, determining a second preset score threshold and a second preset video frame number related to a second video category; and step S509, for the plurality of target video frames, determining 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 whose corresponding second class 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 respective corresponding preset score threshold values and preset video frame numbers for different video categories.
Steps S501 to S503 and S505 in fig. 5 may correspond to steps S201 to 204 in fig. 2, respectively, where step S502 may further include obtaining a second class prediction score of each of the plurality of target video frames output by the target classification model. The execution sequence between S503-504 and S507-S508 is not limited, and the two may be parallel.
Illustratively, based on the output of the object classification model, it may be determined that the object 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 accomplished by adjusting corresponding parameters (e.g., a preset score threshold and a preset number of video frames associated with each video category).
In the case of implementing multi-classification prediction, according to some embodiments, the method may further include: 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, thereby being able to adapt to the needs of the particular scene. Taking the first video category and the second video category as sensitive video categories as examples, the prediction of a plurality of video categories can be realized by using the technical scheme, and the target video can be determined not to belong to the sensitive video in response to the determination that the target video is not any sensitive video category and is a normal video (namely, a third video category). Accordingly, it may be determined that the target video belongs to the sensitive video in response to determining that the target video is any of the sensitive video categories.
According to some embodiments, as shown in fig. 5, in the case where steps S503 to 504 are performed before and the first video category and the second video category are the sensitive video category, 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) it may be determined that the category of the target video frame is the first video category (step S505), and steps S507 to S510 may not be performed 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; and 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 less than the second preset video frame number, determining that the class of the target video frame is not the first video class (step S506), continuing to perform the steps of: step S507, determining a second preset score threshold and a second preset video frame number related to a second video category; step S508, for the plurality of target video frames, determining whether the number of one or more target video frames whose corresponding second class prediction score is 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 whose corresponding second class prediction score is not less than the second preset score threshold is not less than the second preset video frame number, determining that the class of the target video is the second video class, and further determining that the target video is a sensitive video; and in response to determining that the number of one or more target video frames whose corresponding second class prediction score is not less than the second preset score threshold is less than the second preset video frame number, determining that the class of the target video is not the second video class either (step S510), and further determining that the target video is the third video class (step S511), i.e., the non-sensitive video (normal video). The method is not limited herein, and the categories of the sensitive video include only two, or may include more than two, and the target video may be determined to be the sensitive video or the normal video by the steps described above.
The above specifically describes how the target classification model is utilized to predict the category of the input target video.
According to some embodiments, as shown in fig. 6, the training process of the object classification model may include: step S601, frame extraction is carried out on the sample video to obtain a plurality of sample video frames, and the true category of each sample video frame is marked; step S602, inputting the plurality of sample video frames into the target classification model, and obtaining a sample prediction category and a 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 plurality of sample video frames and the sample prediction categories and the prediction scores thereof corresponding to the plurality of sample video frames; step S604, adjusting parameters of the target classification model based on the loss value. The above steps may be iterated until 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, model parameters may be continuously updated during training, but not limited to, by random gradient descent, such that the model converges.
For example, a verification set may be obtained, and during the training process, the verification set may also be used to verify the model, and an optimal model on the verification set may be selected as a final model.
According to some embodiments, the sample video may be uniformly decimated, but not limited to, every set period of time (e.g., 1 s). After obtaining the sample video frames, the sample video frames may be pre-processed for scaling, cropping, flipping, etc. to fit the target classification model. The preprocessing may further include, for example, normalizing the values of all pixels of each sample video frame, so that the pixel values of the entire sample video frame may be normalized to a range of 0 to 1, so that the sample video frame has a similar distribution, which is more beneficial to the gradient descent optimization process, enables the model to converge rapidly, and greatly reduces the calculation amount of the model. Normalization may be, for example: the average of all pixel values of the entire video frame is calculated, each pixel value is subtracted from the average and the variance is taken.
According to an embodiment of the present disclosure, there is also provided a video classification apparatus. As shown in fig. 7, the video classification apparatus 700 may include: the frame extraction unit 701 is configured to extract frames of the target video to obtain a plurality of target video frames; a target classification model 702 configured to process the plurality of target video frames input 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, that the category of the target video is 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 not less than the first preset score threshold is not less than the first preset video frame number.
Here, the operations of the units 701 to 704 of the video classification device 700 are similar to the operations of the steps S201 to S204 described above, and are not repeated here.
According to some embodiments, the first determining unit may comprise: 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. The frame extraction unit may be further configured to extract frames from each of the plurality of positive sample videos to obtain a plurality of positive sample video frames, and extract frames from each of the plurality of negative sample videos to obtain a plurality of negative sample video frames. Wherein the object classification model may be further configured to process a plurality of positive sample video frames each included in the plurality of positive sample video inputs to output a first class prediction score for each positive sample video frame. Wherein the object classification model may be further configured to process a plurality of negative-sample video frames each included in the plurality of negative-sample videos input to output a first class prediction score for each negative-sample video frame; and a determining subunit configured to determine a first preset score threshold and a first preset video frame number associated with the first video category based on a preset recall rate and a preset false detection rate, and a first class prediction score for each positive sample video frame of the plurality of positive sample videos and a first class prediction score for each negative sample video frame of the plurality of negative sample videos.
According to some embodiments, the determining subunit may comprise: a setting subunit configured to set a plurality of initial score thresholds and a plurality of initial video frame numbers; a first determination subunit configured to determine a recall number of at least one positive sample video of the plurality of positive sample videos that belongs to the first video category based on a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frames, and a first category prediction score for 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 frames.
According to some embodiments, the determining 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 frames, and a first class prediction score for each negative-sample video frame, a number of false detections of at least one negative-sample video of the plurality of negative-sample videos that belongs to the first video class; and a fourth determining subunit configured to determine, based on the number of false detections and the total number of the plurality of 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 frames.
According to some embodiments, the determining subunit may further comprise: a fifth determining subunit configured to determine, from among the combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frames, at least one combination of the respective recall being greater than the preset recall and the respective false-positive rate being 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 associated with the first video category based on the respective initial score threshold and the initial video frame number for each of the at least one combination.
There is also provided, in accordance with an embodiment of the present disclosure, an electronic device 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 storing computer instructions for causing the computer to perform the above-described video classification method.
According to an embodiment of the present disclosure, there is also provided a computer program product comprising a computer program, wherein the computer program, when executed by a processor, implements the above-mentioned video classification method.
Referring to fig. 8, a block diagram of an electronic device 800 that 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 devices are 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 telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary 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 computing 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 the bus 804.
Various components in device 800 are connected to 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, the input unit 806 may receive input numeric or character information and generate key signal inputs related to user settings and/or function control of the electronic device, and may include, but is not limited to, a mouse, a keyboard, a touch screen, a trackpad, a trackball, a joystick, a microphone, and/or a remote control. The output unit 807 may be any type of device capable of presenting information and may include, but is not limited to, a display, speakers, video/audio output terminals, vibrators, and/or printers. The storage unit 808 may include, but is not limited to, magnetic disks, optical disks. The communication unit 809 allows the device 800 to exchange information/data with other devices over computer networks, 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.
The computing unit 801 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The calculation unit 801 performs 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 on a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program may be loaded and/or installed onto device 800 via ROM 802 and/or communication unit 809. When a computer program is loaded into RAM 803 and executed by 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 by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On 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, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code 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 code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. 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. The 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 pointing device (e.g., a mouse or 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 may 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 input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background 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 background, 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 a client and a server. The client and server are typically 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 appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel, sequentially or in a different order, provided that the desired results of the disclosed aspects are achieved, and are not limited herein.
Although embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it is to be understood that the foregoing 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 following the grant and their equivalents. Various elements of the embodiments or examples may be omitted or replaced with equivalent elements thereof. Furthermore, the steps may be performed in a different order than described in the present disclosure. Further, various elements of 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 by equivalent elements that appear after the disclosure.

Claims (17)

1. A method of video classification, comprising:
extracting frames of the target video to obtain a plurality of target video frames;
inputting the target video frames into a target classification model, and acquiring 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
responsive to determining, for the plurality of target video frames, that a number of one or more target video frames for which the respective 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,
wherein determining the first preset score threshold and the first preset video frame number related to the first video category includes:
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;
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;
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 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.
2. The method of claim 1, wherein determining the first preset score threshold and the first preset video frame number associated with the first video category based on a preset recall rate and a preset false detection rate, and a first category prediction score for each positive sample video frame and a 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 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 frames and a first category prediction score for each positive sample video frame; and
And determining 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 frames based on the number of recalls and the total number of the plurality of positive sample videos.
3. The method of claim 2, wherein determining the first preset score threshold and the first preset video frame number associated with the first video category based on a preset recall rate and a preset false detection rate, and a first category prediction score for each positive sample video frame and a first category prediction score for each negative sample video frame further comprises:
determining a false detection number of at least one negative sample video belonging to the first video category in the plurality of negative 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 frames and a first category prediction score for each negative sample video frame; and
and determining 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 frames based on the number of false detections and the total number of the plurality of negative sample videos.
4. The method of claim 3, wherein determining the first preset score threshold and the first preset video frame number associated with the first video category based on a preset recall rate and a preset false detection rate, and a first category prediction score for each positive sample video frame and a first category prediction score for each negative sample video frame further comprises:
determining, from a combination of any of the plurality of initial score thresholds and any of the plurality of initial video frames, at least one combination of the respective recall being greater than the preset recall and the respective false positive rate being less than the preset false positive rate; and
and determining 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.
5. The method of claim 2, wherein the plurality of initial score thresholds are an arithmetic series.
6. The method of claim 2, wherein the one or more initial score thresholds have a value interval of [0.2,0.8].
7. The method of claim 2, wherein the plurality of initial video frames comprises 1, 2, 3.
8. The method of any of claims 1-7, wherein the output of the object classification model further comprises a second class prediction score for each object video frame of the plurality of object videos, the first class prediction score being capable of characterizing a probability that the object 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 a second video category;
for the plurality of target video frames, determining 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 for 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.
9. The method of claim 8, 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, the target video is determined to be a third video category.
10. The method of any of claims 1-7, wherein the method further comprises:
The values of all pixels of each target video frame are normalized prior to inputting the plurality of target video frames into the target classification model.
11. The method of any of claims 1-7, wherein the training process of the target classification model comprises:
extracting frames from 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 a sample prediction category and a 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 the prediction scores thereof of the plurality of sample video frames;
and adjusting parameters of the target classification model based on the loss value.
12. A video classification apparatus comprising:
the frame extraction 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 plurality of target video frames input 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,
wherein the first determining unit includes:
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,
the frame extraction unit is further configured to extract frames of each positive sample video in the plurality of positive sample videos to obtain a plurality of positive sample video frames, and extract frames of each negative sample video in the plurality of negative sample videos to obtain a plurality of negative sample video frames;
wherein the object classification model is further configured to process a plurality of positive sample video frames each included in the plurality of positive sample video inputs to output a first class prediction score for each positive sample video frame,
Wherein the object classification model is further configured to process a plurality of negative-sample video frames included in each of the plurality of negative-sample videos input to output a first class prediction score for each negative-sample video frame; and
a determining subunit configured to determine a first preset score threshold and a first preset video frame number associated with the first video category based on a preset recall rate and a preset false detection rate, and a first class prediction score for each positive sample video frame of the plurality of positive sample videos and a first class prediction score for each negative sample video frame of the plurality of negative sample videos.
13. The apparatus of claim 12, wherein the determination 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 determination subunit configured to determine a recall number of at least one positive sample video of the plurality of positive sample videos that belongs to the first video category based on a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frames, and a first category prediction score for 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 corresponding to a combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frames.
14. The apparatus of claim 13, wherein the determination 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 frames, and a first class prediction score for each negative-sample video frame, a number of false detections of at least one negative-sample video of the plurality of negative-sample videos that belongs to the first video class; and
and a fourth determining subunit configured to determine, based on the number of false detections and the total number of the plurality of 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 frames.
15. The apparatus of claim 14, wherein the determination subunit further comprises:
A fifth determining subunit configured to determine, from among the combination of any one of the plurality of initial score thresholds and any one of the plurality of initial video frames, at least one combination of the respective recall being greater than the preset recall and the respective false-positive rate being less than the preset false-positive rate; and
a sixth determination subunit configured to determine a first preset score threshold and a first preset video frame number associated with the first video category based on each of the at least one combination combining a respective initial score threshold and initial video frame number.
16. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the method comprises the steps of
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-11.
17. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-11.
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 CN112749685A (en) 2021-05-04
CN112749685B true 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)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN113963287A (en) * 2021-09-15 2022-01-21 北京百度网讯科技有限公司 Scoring model obtaining and video identifying method, device and storage medium
CN114302171B (en) * 2021-12-28 2024-04-09 新瑞鹏宠物医疗集团有限公司 Video auditing method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107995536B (en) * 2017-11-28 2020-01-21 百度在线网络技术(北京)有限公司 Method, device and equipment for extracting video preview and computer storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN112749685A (en) 2021-05-04

Similar Documents

Publication Publication Date Title
CN112749685B (en) Video classification method, apparatus and medium
CN114648638B (en) Training method of semantic segmentation model, semantic segmentation method and device
CN112749758B (en) Image processing method, neural network training method, device, equipment and medium
CN114511758A (en) Image recognition method and device, electronic device and medium
CN112712498B (en) Vehicle damage assessment method and device executed by mobile terminal, mobile terminal and medium
CN113313650A (en) Image quality enhancement method, device, equipment and medium
CN114445667A (en) Image detection method and method for training image detection model
CN113810765B (en) Video processing method, device, equipment and medium
CN114547252A (en) Text recognition method and device, electronic equipment and medium
CN113723305A (en) Image and video detection method, device, electronic equipment and medium
CN113486853B (en) Video detection method and device, electronic equipment and medium
CN114140852B (en) Image detection method and device
CN114219046B (en) Model training method, matching method, device, system, electronic equipment and medium
CN116152607A (en) Target detection method, method and device for training target detection model
CN113139095B (en) Video retrieval method and device, computer equipment and medium
CN114494797A (en) Method and apparatus for training image detection model
CN114842476A (en) Watermark detection method and device and model training method and device
CN114550269A (en) Mask wearing detection method, device and medium
CN114140851B (en) Image detection method and method for training image detection model
CN114120420B (en) Image detection method and device
CN115512131B (en) Image detection method and training method of image detection model
CN114117046B (en) Data processing method, device, electronic equipment and medium
CN115170536B (en) Image detection method, training method and device of model
CN116881485B (en) Method and device for generating image retrieval index, electronic equipment and medium
CN117218499B (en) Training method of facial expression capturing model, facial expression driving method and device

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