Video intelligent analysis method, device, electronic device and storage medium
By adjusting image acquisition parameters and comparing detection results in intelligent video analysis technology, the problem of misidentification in complex scenes is solved and the accuracy and reliability of video analysis are improved.
Patent Information
- Application Number
- CN202311524998.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-15
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2043-11-15
AI Technical Summary
Existing video intelligent analysis technology often misidentifies when faced with complex scenes, resulting in reduced accuracy and reliability of video analysis.
Perform target detection processing by acquiring the first video stream of the target scene collected by the video image acquisition device, adjusting the image acquisition parameters to make the target object located in the preset image area, and then acquire the second video stream for target detection processing, and compare the two detection results Compare and ensure that the detection results are consistent before obtaining the video analysis results.
It effectively improves the accuracy of video analysis and reduces the probability of misrecognition, especially when the target object is too small or the pixels are too low, reducing background interference and improving the accuracy of target detection.
Smart Images

Figure CN117726969B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video surveillance technology, and in particular to a video intelligent analysis method, device, electronic device, and computer-readable storage medium. Background Art
[0002] With the continuous development of video surveillance technology, video intelligent analysis technology is increasingly being used in security, transportation, artificial intelligence and other fields. Video intelligent analysis technology is an intelligent monitoring technology based on target behavior. Different from traditional motion detection (VMD-Video Motion Detection) technology, video intelligent analysis technology first separates the background and target in the scene, identifies the real target, removes background interference (such as leaf shaking, water waves, light changes, etc.), and then analyzes and tracks the target and target behavior that appear in the camera scene. However, the existing video intelligent analysis technology often misidentifies when facing complex scenes, resulting in reduced accuracy and reliability of video analysis.
[0003] It can be seen that the video intelligent analysis method in the existing technology still needs to be improved. Summary of the invention
[0004] The embodiments of the present application provide a video intelligent analysis method and device, an electronic device and a storage medium, which can improve the accuracy of video analysis.
[0005] In a first aspect, an embodiment of the present application provides a video intelligent analysis method, including:
[0006] Acquire a first video stream of a target scene acquired by a video image acquisition device;
[0007] Performing target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image;
[0008] Adjusting the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image;
[0009] Acquire a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters;
[0010] Performing object detection processing on the second video stream to obtain a second detection result;
[0011] The first detection result and the second detection result are compared, and a video analysis result is obtained according to the comparison result.
[0012] In a second aspect, an embodiment of the present application provides a video intelligent analysis device, including:
[0013] A first video stream acquisition module, used to acquire a first video stream of a target scene acquired by a video image acquisition device;
[0014] A first target detection module is used to perform target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image;
[0015] A video image acquisition device adjustment module, used for adjusting the image acquisition parameters of the video image acquisition device, so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image;
[0016] A second video stream acquisition module, used to acquire a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters;
[0017] A second object detection module, used to perform object detection processing on the second video stream to obtain a second detection result;
[0018] The video analysis module is used to compare the first detection result with the second detection result, and obtain a video analysis result according to the comparison result.
[0019] In a third aspect, an embodiment of the present application further discloses an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the video intelligent analysis method described in the embodiment of the present application when executing the computer program.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the video intelligent analysis method disclosed in the embodiment of the present application are performed.
[0021] The video intelligent analysis method disclosed in the embodiment of the present application obtains a first video stream of a target scene acquired by a video image acquisition device; performs target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image; adjusts the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image; obtains a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters; performs target detection processing on the second video stream to obtain a second detection result; compares the first detection result with the second detection result, and only when the two video image detection results are consistent, obtains a video analysis result based on the detection results, thereby effectively improving the accuracy of video analysis.
[0022] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] Figure 1 It is a flow chart of the video intelligent analysis method disclosed in the embodiment of the present application;
[0025] Figure 2 It is a schematic diagram of the location information of the target object in the video image of the first video stream in the video intelligent analysis method disclosed in the embodiment of the present application;
[0026] Figure 3 It is a schematic diagram of the location information of the target object in the video image of the second video stream in the video intelligent analysis method disclosed in the embodiment of the present application;
[0027] Figure 4 It is a schematic diagram of an image acquisition scene in the video intelligent analysis method disclosed in an embodiment of the present application;
[0028] Figure 5 It is a schematic diagram of the principle of calculating image acquisition parameters in the video intelligent analysis method disclosed in the embodiment of the present application;
[0029] Figure 6 It is a structural diagram of a video intelligent analysis device disclosed in an embodiment of the present application;
[0030] Figure 7 A block diagram schematically shows an electronic device for executing the method according to the present application; and
[0031] Figure 8 A storage unit for holding or carrying a program code for implementing the method according to the present application is schematically shown. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] The embodiment of the present application discloses a video intelligent analysis method, such as Figure 1 As shown, the method includes: steps 110 to 160.
[0034] Step 110: Acquire a first video stream of a target scene captured by a video image capture device.
[0035] Optionally, the video image acquisition device is an image acquisition device that can automatically adjust the focal length, the zoom factor, the pitch angle, and the left and right movement angle. For example, the video image acquisition device can be a pan-tilt camera.
[0036] In specific implementation, the video image acquisition device is set at the position of capturing the target scene, and the shooting range can be adjusted by adjusting the left and right moving angles and the up and down moving angles (ie, the pitch angles), and the shooting range can be adjusted by adjusting the zoom factor.
[0037] During the specific implementation process, the video image acquisition device acquires a video stream of the target scene in the current field of view according to the default image acquisition parameters, which is recorded as the "first video stream" in the embodiment of the present application. For example, the video image acquisition device acquires several continuous image frames of the target scene in the default field of view according to the preset frame rate and magnification, and stores and transmits them in the form of the first video stream.
[0038] Step 120: Perform target detection processing on the first video stream to obtain a first detection result.
[0039] Wherein, the first detection result includes: positioning information of the target object in the target scene in the video image.
[0040] Optionally, the target thing includes: a target object and / or a target behavior.
[0041] Optionally, the target object includes but is not limited to one or more of the following targets: human face, objects, pedestrians, backpacks, animals, bicycles, tricycles, motorcycles, cars, vans, trucks, buses, bulldozers, excavators, helmets, smoke, fire, fire extinguishers, etc. The target behavior includes but is not limited to one or more of the following targets: smoking, making phone calls, playing with mobile phones, climbing over fences, climbing, sleeping on duty, leaving the post, fire extinguishers, falling to the ground, not wearing reflective vests, etc.
[0042] In the embodiments of the present application, a video intelligent analysis algorithm in the prior art may be used to perform target detection processing to detect the target object and / or target behavior included in the video stream of the target scene.
[0043] The video intelligent analysis algorithm can detect, identify and track targets in continuous multi-frame video images, and output the type of the target and the location information of the target in the video image. The location information includes the location coordinates of the positioning frame of the target in the video image.
[0044] Optionally, the video intelligent analysis algorithm can be a video analysis algorithm independently trained for each target object or target behavior, or a video analysis algorithm comprehensively trained for all target objects and target things that need to be detected. The training method and expression form of the video intelligent analysis algorithm are not limited in the embodiments of the present application.
[0045] Optionally, performing target detection processing on the first video stream to obtain a first detection result includes: performing interval sampling on the first video stream to obtain a preset number of sampled image frames; performing target detection and tracking on the preset number of sampled image frames respectively to obtain a target detection result corresponding to each sampled image frame, wherein the target detection result includes: the type of target object detected in the sampled image frame and the positioning information of the target object in the corresponding sampled image frame; in response to the target detection result indicating that: the target object of the target type is detected in a preset proportion of the sampled image frames, obtaining a first detection result according to the target type and the positioning information of the target object of the target type in the sampled image frame, wherein the target type is selected from: the type of target object detected in the sampled image frame.
[0046] In an embodiment of the present application, the first video stream is sampled at intervals to obtain a preset number of sampled image frames, and then target detection is performed based on the sampled video image frames (ie, sampled image frames).
[0047] In the embodiments of the present application, the interval sampling means that the sampling interval can be flexibly configured while ensuring that the recognition rate can meet different detection requirements.
[0048] Optionally, the first video stream is sampled at intervals to obtain a preset number of sampled image frames, including: sampling N frames of the first video stream every M frames to obtain N frames of sampled image frames. The preset number is N, and M and N are natural numbers greater than 1. The values of M and N are determined according to the specific scenario. For example, in a face recognition detection scenario, 25 frames of full frame recognition can be used, that is, no interval sampling is performed. For another example, in a vehicle recognition detection scenario, 5 frames of video images can be extracted every 25 frames for recognition.
[0049] In some other embodiments of the present application, the first video stream is sampled at intervals to obtain a preset number of sampled image frames, including: sampling N frames of the first video stream at intervals of a preset duration to obtain N sampled image frames. For example, in a fireworks recognition scenario, a frame of video image may be extracted every 2 seconds for target detection.
[0050] Next, for the sampled image frames sampled from the first video stream in sequence, a preset video intelligent analysis algorithm is used to perform target detection, tracking and identification, and the type of target object included in each of the sampled image frames and the position coordinates of the positioning frame of the target object in the corresponding sampled image frame are output.
[0051] Afterwards, based on the types of target objects detected in each sampled image frame, it can be finally determined what type of target objects are included in the target scene, as well as the position coordinates of the positioning box of the target object in the video image. In some embodiments of the present application, the target detection results output for each sampled image frame can be summarized to obtain a summary result, and then the detection result is judged based on the summary result. For example, when the summary result shows that in N consecutive sampled image frames, 70% or more of the target detection results of the sampled image frames have detected a certain type (referred to as "target type" in the embodiment of the present application) of target objects (such as fireworks), it can be considered that the target object (such as fireworks) has been detected in the target scene. Furthermore, the position coordinates of the detection box of the target object in the last sampled image frame can be used as the positioning information of the target object. The positional relationship between the target object and the video image can be as follows: Figure 2 On the contrary, when the summary result shows that less than 70% of the sampled image frames detected a certain type of target object (such as fireworks) in N consecutive sampled image frames, it can be considered that the target object (such as fireworks) was not detected in the target scene.
[0052] After determining that one or some types of target objects are detected in the target scene, the type of the detected target object (ie, the target type) and the positioning information may be stored in the cache of the video analysis system as a first detection result.
[0053] Optionally, the first detection result may include: the type of the target object, positioning information, and may also include: a sampled image frame in which the target object is detected, a timestamp of the sampled image frame, representation information of the video image acquisition device, etc.
[0054] Step 130, adjusting the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image.
[0055] Next, the target objects detected in the above steps are further confirmed and detected to reduce the probability of misidentification.
[0056] In an embodiment of the present application, the target detection results of the previous steps are verified by adjusting the image acquisition parameters of a video image acquisition device (such as a pan-tilt camera), taking an enlarged image of the detected target object again, and further performing target object detection based on the enlarged image.
[0057] In order to maximize the magnification of the image of the detected target object, optionally, the image acquisition parameters of the video image acquisition device can be adjusted to place the image of the target object in a preset image area at the center of the video image captured by the video image acquisition device.
[0058] Optionally, adjusting the image acquisition parameters of the video image acquisition device includes: calculating target image acquisition parameters of the video image acquisition device based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, wherein the target image acquisition parameters ensure that when the video image acquisition device acquires the video image based on the target image acquisition parameters, the target object is located in a preset image area of the video image; and adjusting the image acquisition parameters of the video image acquisition device to the target image acquisition parameters.
[0059] To implement this method, it is first necessary to calculate the values to which the image acquisition parameters of the video image acquisition device need to be adjusted based on the position coordinates and size of the positioning frame of the target object in the first detection result and the size of the video image, that is, to calculate the target image acquisition parameters of the video image acquisition device.
[0060] As mentioned above, the positioning information includes: the position coordinates and size of the positioning frame of the target object in the target scene in the video image. In an embodiment of the present application, the preset image area includes: a rectangular image area located at the center of the video image and having a size greater than or equal to a specified size threshold.
[0061] Optionally, the imaging characteristics of the video image acquisition device include a pre-fitted correspondence between the field of view angle matched by the video image acquisition device and the lens magnification.
[0062] Optionally, the target image acquisition parameters of the video image acquisition device are calculated based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, including: obtaining the corresponding relationship between the field of view angle matched by the video image acquisition device and the lens zoom; based on the center position coordinates of the positioning frame, the size of the video image, and the corresponding relationship, respectively calculating the horizontal rotation angle and the vertical rotation angle corresponding to moving the positioning frame to the center position of the video image; according to the size ratio relationship between the positioning frame and the video image, and the corresponding relationship, calculating the lens zoom corresponding to enlarging the size of the positioning frame to be greater than or equal to the specified size threshold; converting the horizontal rotation angle and the vertical rotation angle into the P value and T value of the corresponding ONVIF protocol respectively; using the lens zoom, the P value, and the T value as the target image acquisition parameters of the video image acquisition device. Among them, the P value (i.e., Pan) of the ONVIF (Open Network Video Interface Forum) protocol represents the horizontal rotation angle, and the T value (i.e., Tilt) represents the vertical rotation angle.
[0063] The corresponding relationship includes: a first corresponding relationship between a horizontal field angle and a lens magnification, and a second corresponding relationship between a vertical field angle and a lens magnification.
[0064] Among them, the specified size threshold can be determined according to the size of the video image captured by the video image acquisition device and the size of the positioning frame, as well as the target detection requirements. The specified size threshold is a size that is larger than the positioning frame and smaller than the video image. For example: the specified size threshold can be a size that is larger than the positioning frame and smaller than the size of the largest rectangular frame of the video image. For another example, the specified size threshold is a size that is larger than the positioning frame and smaller than 2 / 3 of the largest rectangular frame of the video image. For another example, the specified size threshold is a size when the positioning frame is proportionally enlarged to a width or height that coincides with the edge of the video image.
[0065] In the prior art, when a pan / tilt or omnidirectional camera is controlled in all directions, such as horizontal rotation control, vertical rotation control, and lens zoom control, it is usually necessary to adjust the PTZ parameters (abbreviation of Pan / Tilt / Zoom, pan / tilt control parameters) of the pan / tilt or camera. The PTZ parameters include: P value, T value, and Z value (i.e. Zoom) indicating the lens zoom, i.e. the zoom factor.
[0066] Combine the following Figure 3 The video graphics effect diagram shown, Figure 4 The image acquisition schematic and Figure 5 The schematic diagram of the rotation angle calculation principle shown in FIG. 1 illustrates an example of the principle of calculating the target image acquisition parameters.
[0067] like Figure 4 As shown, the horizontal field of view (FOV) of the video image acquisition device set on the high pole is a, and the vertical field of view is b. When the lens of the video image acquisition device moves toward the target object in the field of view, that is, when the lens magnification increases, the field of view will become smaller. In some embodiments of the present application, the first correspondence between the lens magnification and the horizontal field of view angle, and the second correspondence between the lens magnification and the vertical field of view angle can be fitted by an algorithm through field measurement of the corresponding data between the lens magnification and the actual field of view range (that is, the field of view angle) collected by the video image acquisition device. The first correspondence relationship and the second correspondence relationship obtained by fitting constitute the correspondence relationship between the field of view angle matched by the video image acquisition device and the lens magnification.
[0068] In some embodiments of the present application, in order to use the image acquisition parameters of the video image acquisition device, such as Figure 2 The target object 210 in the video image shown in the figure is presented in a larger image at the center of the video image, for example, Figure 3 The imaging effect shown can be achieved by first adjusting the horizontal rotation angle and the vertical rotation angle of the video image acquisition device, so that after the horizontal rotation angle and the vertical rotation angle are adjusted, when the video image acquisition device continues to acquire video images based on the adjusted image acquisition parameters, the target object is located at the center of the video image that continues to be acquired, and then adjusting the lens magnification to reduce the field of view angle, so that the target object 210 occupies a larger image area in the video image.
[0069] First, the target object is calculated by Figure 2 To move the area shown in FIG. 1 to the center of the video image, the video image acquisition device needs to move the horizontal rotation angle and the vertical rotation angle.
[0070] In some embodiments of the present application, based on the center position coordinates of the positioning frame, the size of the video image and the corresponding relationship, the horizontal rotation angle and the vertical rotation angle corresponding to moving the positioning frame to the center position of the video image are calculated respectively, including: based on the horizontal direction coordinates of the center position of the positioning frame, the width of the video image and the first corresponding relationship, calculating the horizontal rotation angle corresponding to moving the positioning frame to the center position of the video image; and, based on the vertical direction coordinates of the center position of the positioning frame, the height of the video image and the second corresponding relationship, calculating the vertical rotation angle corresponding to moving the positioning frame to the center position of the video image.
[0071] Optionally, based on the horizontal coordinates of the center position of the positioning frame, the width of the video image and the first corresponding relationship, the horizontal rotation angle corresponding to moving the positioning frame to the center position of the video image is calculated, including: calculating a first horizontal movement distance of the positioning frame based on the horizontal coordinates of the center position of the positioning frame and the width of the video image; calculating a first tangent value of the horizontal field of view angle a' after the positioning frame is moved according to the ratio of the first movement distance to half the width of the video image and the half-angle tangent value of the current horizontal field of view angle a; and calculating the horizontal rotation angle according to the first tangent value using an inverse tangent function and an angle conversion function.
[0072] For example, the horizontal rotation angle delt_x can be calculated by the following formula:
[0073] delt_x=rad2deg(atan((x-Img_W / 2) / (Img_W / 2)*tan(deg2rad(fov_h / 2))));
[0074] Wherein, x represents the horizontal coordinate of the center point of the positioning frame, fov_h represents the current horizontal field of view, and Img_W represents the width of the video image. Wherein, fov_h is determined according to the first corresponding relationship and the current lens zoom value. When capturing a video image, the current lens zoom value is known, either as a default value or as an adjusted value.
[0075] Optionally, based on the horizontal coordinates of the center position of the positioning frame, the width of the video image and the first corresponding relationship, the horizontal rotation angle corresponding to moving the positioning frame to the center position of the video image is calculated, including: based on the vertical coordinates of the center position of the positioning frame and the height of the video image, a second moving distance of the positioning frame in the vertical direction is calculated; based on the ratio of the second moving distance to half the height of the video image and the half-angle tangent value of the current vertical field of view angle b, a second tangent value of the vertical field of view angle b' after the positioning frame is moved is calculated; based on the second tangent value, the vertical rotation angle is calculated using an inverse tangent function and an angle conversion function.
[0076] For example, the vertical rotation angle delt_y can be calculated by the following formula:
[0077] delt_y=rad2deg(atan((y-Img_H / 2) / (Img_H / 2)*tan(deg2rad(fov_v / 2))));
[0078] Wherein, y represents the vertical coordinate of the center point of the positioning frame, fov_v represents the current vertical field of view, and Img_H represents the height of the video image. Wherein, fov_v is determined according to the second corresponding relationship and the current lens zoom value. When capturing a video image, the current lens zoom value is known, either as a default value or as an adjusted value.
[0079] In the embodiment of the present application, the aforementioned steps obtain the angle change value of the video image acquisition device. In order to set the image acquisition parameters of the video image acquisition device through the ONVIF protocol, in the embodiment of the present application, it is also necessary to convert the calculated horizontal rotation angle and vertical rotation angle into the P value and T value corresponding to the ONVIF protocol according to the pre-established angle conversion relationship.
[0080] Next, the lens magnification corresponding to enlarging the size of the positioning frame to be greater than or equal to the specified size threshold is calculated.
[0081] In the embodiment of the present application, the lens is pushed toward the target, that is, the field of view is narrowed, and the image area occupied by the target in the visual image can be enlarged. For the target, the horizontal and vertical dimensions of the positioning frame are enlarged in proportion. In order to make the image of the target as large as possible without exceeding the range of the video image, the horizontal length of the positioning frame of the target (such as Figure 2 The first ratio is calculated based on the width w1 of the positioning frame in the middle and the horizontal length of the video image (such as Img_W), and the vertical length of the positioning frame of the target object (such as Figure 2The second ratio is calculated by the width h1 of the positioning frame in the middle and the vertical length of the video image (such as Img_H), and the direction corresponding to the larger ratio of the first ratio and the second ratio is selected as the calculation direction. Afterwards, the screen ratio of the target object to the entire video image is calculated according to the size of the positioning frame and the size of the video image in the calculation direction, so as to calculate the number of lens zooms that need to be driven to enlarge the video image acquisition device.
[0082] For example, the lens zoom Fov_w can be calculated by the following formula:
[0083] Fov_w=rad2deg(2*atan((l / Img_L)*tan(deg2rad(fov_l) / 2)));
[0084] Where l represents the length of the positioning frame in the calculation direction, Img_L represents the screen length of the video image in the calculation direction, and fov_l represents the field of view corresponding to the current lens zoom in the calculation direction. The calculation direction can be horizontal or vertical, and the calculation direction is determined according to the length ratio of the positioning frame and the video image in the horizontal direction and the vertical direction.
[0085] For example, when the length ratio of the positioning frame to the video image in the horizontal direction is greater than the length ratio in the vertical direction, l is taken as the length of the positioning frame in the horizontal direction, Img_L is taken as the screen length of the video image in the horizontal direction, and fov_l is taken as the field of view angle corresponding to the current lens zoom in the horizontal direction. For another example, when the length ratio of the positioning frame to the video image in the vertical direction is greater than the length ratio in the horizontal direction, l is taken as the length of the positioning frame in the vertical direction, Img_L is taken as the screen length of the video image in the vertical direction, and fov_l is taken as the field of view angle corresponding to the current lens zoom in the vertical direction.
[0086] In the embodiment of the present application, the process of adjusting the lens zoom may be repeatedly performed multiple times until the image of the target object in the video image is adjusted to the most appropriate size.
[0087] Afterwards, the determined lens zoom Fov_w is converted into a Z value corresponding to the ONVIF protocol. Then, the converted P value, T value and Z value corresponding to the ONVIF protocol are used as target image acquisition parameters. Based on the target image acquisition parameters, the PTZ parameter value of the video image acquisition device is reset, and the video image acquisition device is controlled to perform video image acquisition based on the reset PTZ parameter value.
[0088] Step 140: Acquire a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters.
[0089] Next, a second video stream captured by the video image capture device based on the adjusted image capture parameters is obtained.
[0090] Step 150: Perform target detection processing on the second video stream to obtain a second detection result.
[0091] Afterwards, target detection is performed based on the second video stream to obtain a detection result, which is recorded as a "second detection result".
[0092] In the embodiment of the present application, the second video stream can be sampled in the same sampling manner as the first video stream, and target detection can be performed based on the sampled image frames. When performing target detection, the video analysis algorithm described above can be used to perform target detection, tracking, and recognition and other target detection processing means.
[0093] Optionally, target detection processing is performed on the second video stream to obtain a second detection result, including: performing interval sampling on the second video stream to obtain a preset number of sampled image frames; performing target detection and tracking on the preset number of sampled image frames respectively to obtain a target detection result corresponding to each sampled image frame, wherein the target detection result includes: the type of target object detected in the sampled image frame and the positioning information of the target object in the corresponding sampled image frame; in response to the target detection result indicating that: the target object of the target type is detected in a preset proportion of the sampled image frames, a second detection result is obtained according to the target type and the positioning information of the target object of the target type in the sampled image frame, wherein the target type is selected from: the type of target object detected in the sampled image frame.
[0094] For the specific implementation of performing interval sampling on the second video stream to obtain a preset number of sampled image frames, refer to the above-mentioned specific implementation of performing interval sampling on the first video stream to obtain a preset number of sampled image frames, which will not be repeated here.
[0095] For the specific implementation method of performing target detection and tracking on the preset number of sampled image frames respectively to obtain the target detection result corresponding to each sampled image frame, please refer to the processing method of the sampled image frames of the first video stream in the previous text, which will not be repeated here.
[0096] Furthermore, when a certain type of target object (such as fireworks) is detected in the sampled image frames of the second video stream exceeding a preset proportion (such as greater than or equal to 70%), it can be considered that the target object of this type is detected in the second video stream, and further, the positioning information of the target object of this type in the video image frame (such as the position coordinates and size of the positioning box) and the type value are stored as the second detection result. Optionally, the second detection result may also include a sampled image frame in which the target object (such as fireworks) is detected in the second video stream, the timestamp of the sampled image frame, the identification of the video image acquisition device that acquires the sampled image frame, and other information.
[0097] Step 160: compare the first detection result and the second detection result, and obtain a video analysis result according to the comparison result.
[0098] Next, the consistency of the first detection result obtained by detecting the video image collected before the image acquisition parameters are adjusted and the second detection result obtained by detecting the video image collected after the image acquisition parameters are adjusted (such as after the lens is advanced) is further compared, so as to obtain the final video analysis result based on the comparison result.
[0099] As mentioned above, the first detection result includes the type of target object detected according to the first video stream, and the second detection result includes the type of target object detected according to the second video stream. Optionally, the first detection result and the second detection result are compared to obtain a video analysis result based on the comparison result, including: performing a consistency comparison between the type of target object in the first detection result and the type of target object in the second detection result to obtain a comparison result; in response to the comparison result indicating that the type of target object in the first detection result is the same as the type of target object in the second detection result, a video analysis result is obtained in which the target object is detected in the video stream captured by the video image acquisition device; in response to the comparison result indicating that the type of target object in the first detection result is different from the type of target object in the second detection result, a video analysis result is obtained in which the first detection result is a misidentified one.
[0100] For example, when both the first detection result and the second detection result include a certain type of target object (such as the aforementioned target object "fireworks"), it can be considered that the target object of this type (such as fireworks) is detected in the video stream collected by the video image acquisition device; if the target object (such as the aforementioned target object "fireworks") is included only in the first detection result, but not in the second detection result, it can be considered that the first detection result is a misjudgment, that is, the target object of this type (such as fireworks) is not detected in the video stream collected by the video image acquisition device. The video image acquisition device needs to be restored to the default image acquisition parameters, continue to collect the video stream of the target scene, and perform the video analysis operations of steps 110 to 160.
[0101] In application scenarios such as monitoring or target object recognition, the default image acquisition parameters of the video image acquisition device often have a relatively large field of view, so it can capture images of larger target scenes, which also results in smaller images of target objects in the captured video images. Therefore, there may be situations where target detection and recognition errors occur due to complex backgrounds of video images and small images of target objects. In an embodiment of the present application, after detecting a target object, the lens of the video image acquisition device is advanced toward the detected target object, and a quasi-close-up image or close-up image of the target object is captured to reduce background interference and highlight the target object, thereby improving the detection accuracy of the target object.
[0102] The video intelligent analysis method disclosed in the embodiment of the present application obtains a first video stream of a target scene acquired by a video image acquisition device; performs target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image; adjusts the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image; obtains a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters; performs target detection processing on the second video stream to obtain a second detection result; compares the first detection result with the second detection result, and only when the two video image detection results are consistent, obtains a video analysis result based on the detection results, thereby effectively improving the accuracy of video analysis.
[0103] Traditional video analysis algorithms aim to improve the algorithm's recognition accuracy by adding pictures of complex scenes and small targets to train the algorithm. This can improve the algorithm's detection rate, but it will also increase the algorithm's false detection rate. In terms of improving the recognition rate of complex scenes and small targets, the effect is not ideal. The video intelligent analysis method disclosed in the embodiment of the present application can solve this problem well. Even if the target scene is complex for the first time and is misidentified, it will not affect the final result. The video intelligent analysis method disclosed in the embodiment of the present application, by advancing and enlarging the target object according to the first recognition result, makes the target object picture clearer and there is less interference in the video image, which solves the problem of misidentification caused by the target object being too small and the pixel being too low.
[0104] Furthermore, the video intelligent analysis method disclosed in the embodiment of the present application does not need to collect a large number of image samples for each scene, which reduces the requirements for the video analysis algorithm, can save the cost of video analysis algorithm training, and shortens the training time of the video analysis algorithm.
[0105] The present application also discloses a video intelligent analysis device. Figure 6 As shown, the device comprises:
[0106] A first video stream acquisition module 610 is used to acquire a first video stream of a target scene acquired by a video image acquisition device;
[0107] A first target detection module 620 is used to perform target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image;
[0108] The video image acquisition device adjustment module 630 is used to adjust the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image;
[0109] A second video stream acquisition module 640, configured to acquire a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters;
[0110] A second object detection module 650, configured to perform object detection processing on the second video stream to obtain a second detection result;
[0111] The video analysis module 660 is used to compare the first detection result and the second detection result, and obtain a video analysis result according to the comparison result.
[0112] Optionally, the video image acquisition device adjustment module 630 is further used to:
[0113] Calculating target image acquisition parameters of the video image acquisition device based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, wherein the target image acquisition parameters enable the target object to be located in a preset image area of the video image when the video image acquisition device acquires the video image based on the target image acquisition parameters;
[0114] The image acquisition parameters of the video image acquisition device are adjusted to be the target image acquisition parameters.
[0115] Optionally, the positioning information includes: the position coordinates and size of the positioning frame of the target object in the target scene in the video image, the preset image area includes: a rectangular image area located at the center of the video image and having a size greater than or equal to a specified size threshold, and the target image acquisition parameters of the video image acquisition device are calculated based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, including:
[0116] Obtaining the corresponding relationship between the field of view angle matched by the video image acquisition device and the lens magnification;
[0117] Based on the center position coordinates of the positioning frame, the size of the video image and the corresponding relationship, respectively calculating the horizontal rotation angle and the vertical rotation angle corresponding to moving the positioning frame to the center position of the video image;
[0118] According to the size ratio relationship between the positioning frame and the video image, and the corresponding relationship, calculate the lens zoom corresponding to when the size of the positioning frame is enlarged to be greater than or equal to the specified size threshold;
[0119] Convert the horizontal rotation angle and the vertical rotation angle into a P value and a T value corresponding to the ONVIF protocol, respectively;
[0120] The lens magnification, the P value and the T value are used as target image acquisition parameters of the video image acquisition device.
[0121] Optionally, the first target detection module 620 is further configured to:
[0122] Performing interval sampling on the first video stream to obtain a preset number of sampled image frames;
[0123] Performing target detection and tracking on the preset number of sampled image frames respectively to obtain a target detection result corresponding to each sampled image frame, wherein the target detection result includes: the type of the target object detected in the sampled image frame and the positioning information of the target object in the corresponding sampled image frame;
[0124] In response to the target detection result indicating that a target object of a target type is detected in a preset proportion of the sampled image frames, a first detection result is obtained based on the target type and the positioning information of the target object of the target type in the sampled image frames, wherein the target type is selected from: the type of target object detected in the sampled image frames.
[0125] Optionally, the first detection result further includes: the type of the target object; the second detection result includes: the type of the target object; the video analysis module 660 is further configured to:
[0126] Performing a consistency comparison between the type of the target object in the first detection result and the type of the target object in the second detection result to obtain a comparison result;
[0127] In response to the comparison result indicating that the type of the target object in the first detection result is the same as the type of the target object in the second detection result, a video analysis result is obtained in which the target object is detected in the video stream captured by the video image acquisition device;
[0128] In response to the comparison result indicating that the type of the target object in the first detection result is different from the type of the target object in the second detection result, a video analysis result indicating that the first detection result is a misidentification is obtained.
[0129] The video intelligent analysis device disclosed in the embodiment of the present application is used to implement the video intelligent analysis method described in the embodiment of the present application. The specific implementation methods of each module of the device will not be repeated here, and reference can be made to the specific implementation methods of the corresponding steps in the method embodiment.
[0130] The video intelligent analysis device disclosed in the embodiment of the present application obtains a first video stream of a target scene acquired by a video image acquisition device; performs target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image; adjusts the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image; obtains a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters; performs target detection processing on the second video stream to obtain a second detection result; compares the first detection result with the second detection result, and only when the two video image detection results are consistent, obtains a video analysis result based on the detection results, thereby effectively improving the accuracy of video analysis.
[0131] By using the video intelligent analysis device disclosed in the embodiment of the present application, the target object is pushed and enlarged according to the first recognition result, so that the image of the target object is clearer and there is less interference in the video image, which effectively solves the problem of misrecognition caused by the target object being too small or the pixel being too low.
[0132] Furthermore, the video intelligent analysis device disclosed in the embodiment of the present application does not need to collect a large number of image samples for each scene, which reduces the requirements for the video analysis algorithm, can save the cost of video analysis algorithm training, and shortens the training time of the video analysis algorithm.
[0133] Each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0134] The above is a detailed introduction to a video intelligent analysis method and device provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and a core idea. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
[0135] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0136] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the electronic device according to the embodiment of the present application. The present application can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0137] For example, Figure 7 An electronic device that can implement the method according to the present application is shown. The electronic device can be a PC, a mobile terminal, a personal digital assistant, a tablet computer, etc. The electronic device traditionally includes a processor 710 and a memory 720 and a program code 730 stored on the memory 720 and can be run on the processor 710, and the processor 710 implements the method described in the above embodiment when executing the program code 730. The memory 720 can be a computer program product or a computer-readable medium. The memory 720 can be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. The memory 720 has a storage space 7201 for the program code 730 of the computer program for executing any method step in the above method. For example, the storage space 7201 for the program code 730 can include various computer programs for implementing the various steps in the above method respectively. The program code 730 is a computer-readable code. These computer programs can be read from one or more computer program products or written into the one or more computer program products. These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks. The computer program includes a computer readable code, and when the computer readable code is executed on an electronic device, the electronic device is caused to execute the method according to the above embodiment.
[0138] The embodiment of the present application also discloses a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the video intelligent analysis method described in the embodiment of the present application are implemented.
[0139] Such a computer program product may be a computer-readable storage medium, which may have a computer-readable storage medium having a Figure 7 The memory 720 in the electronic device shown in the figure is similar to the storage segment, storage space, etc. The program code can be compressed and stored in the computer-readable storage medium in an appropriate form. The computer-readable storage medium is generally as shown in the reference Figure 8 The portable or fixed storage unit. Generally, the storage unit includes computer readable code 730', which is a code read by a processor. When the code is executed by the processor, each step in the method described above is implemented.
[0140] The term "one embodiment", "embodiment" or "one or more embodiments" herein means that a particular feature, structure or characteristic described in conjunction with the embodiment is included in at least one embodiment of the present application. In addition, please note that the examples of the term "in one embodiment" here do not necessarily all refer to the same embodiment.
[0141] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0142] In the claims, any reference signs placed between brackets shall not be construed as limiting the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present application may be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third etc. does not indicate any order. These words may be interpreted as names.
[0143] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A video intelligent analysis method, characterized in that: The method comprises: Acquire a first video stream of a target scene captured by a video image acquisition device; Performing target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image; Adjusting the image acquisition parameters of the video image acquisition device so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image; Acquire a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters; Performing object detection processing on the second video stream to obtain a second detection result; Comparing the first detection result with the second detection result, and obtaining a video analysis result according to the comparison result; The performing target detection processing on the first video stream to obtain a first detection result includes: Performing interval sampling on the first video stream to obtain a preset number of sampled image frames; Performing target detection and tracking on the preset number of sampled image frames respectively to obtain a target detection result corresponding to each sampled image frame, wherein the target detection result includes: the type of the target object detected in the sampled image frame and the positioning information of the target object in the corresponding sampled image frame; In response to the target detection result indicating that a target object of a target type is detected in a preset proportion of the sampled image frames, a first detection result is obtained based on the target type and the positioning information of the target object of the target type in the sampled image frames, wherein the target type is selected from: the type of target object detected in the sampled image frames.
2. The method according to claim 1, characterized in that The step of adjusting the image acquisition parameters of the video image acquisition device comprises: Calculating target image acquisition parameters of the video image acquisition device based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, wherein the target image acquisition parameters enable the target object to be located in a preset image area of the video image when the video image acquisition device acquires the video image based on the target image acquisition parameters; The image acquisition parameters of the video image acquisition device are adjusted to be the target image acquisition parameters.
3. The method according to claim 2, characterized in that The positioning information includes: the position coordinates and size of the positioning frame of the target object in the target scene in the video image; the preset image area includes: a rectangular image area located at the center of the video image and having a size greater than or equal to a specified size threshold; and the target image acquisition parameters of the video image acquisition device are calculated based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, including: Obtaining the corresponding relationship between the field of view angle matched by the video image acquisition device and the lens magnification; Based on the center position coordinates of the positioning frame, the size of the video image and the corresponding relationship, respectively calculating the horizontal rotation angle and the vertical rotation angle corresponding to moving the positioning frame to the center position of the video image; According to the size ratio relationship between the positioning frame and the video image, and the corresponding relationship, calculate the lens zoom corresponding to when the size of the positioning frame is enlarged to be greater than or equal to the specified size threshold; Convert the horizontal rotation angle and the vertical rotation angle into a P value and a T value corresponding to the ONVIF protocol, respectively; The lens magnification, the P value and the T value are used as target image acquisition parameters of the video image acquisition device.
4. The method according to claim 1, characterized in that: The first detection result further includes: the type of the target object, the second detection result includes: the type of the target object, and the first detection result and the second detection result are compared to obtain a video analysis result according to the comparison result, including: Performing a consistency comparison between the type of the target object in the first detection result and the type of the target object in the second detection result to obtain a comparison result; In response to the comparison result indicating that the type of the target object in the first detection result is the same as the type of the target object in the second detection result, a video analysis result is obtained in which the target object is detected in the video stream captured by the video image acquisition device; In response to the comparison result indicating that the type of the target object in the first detection result is different from the type of the target object in the second detection result, a video analysis result indicating that the first detection result is a misidentification is obtained.
5. A video intelligent analysis device, characterized in that: The device comprises: A first video stream acquisition module, used to acquire a first video stream of a target scene acquired by a video image acquisition device; A first target detection module is used to perform target detection processing on the first video stream to obtain a first detection result, wherein the first detection result includes: positioning information of a target object in the target scene in the video image; A video image acquisition device adjustment module, used for adjusting the image acquisition parameters of the video image acquisition device, so that when the video image acquisition device acquires a video image based on the adjusted image acquisition parameters, the target object is located in a preset image area of the video image; A second video stream acquisition module, used to acquire a second video stream acquired by the video image acquisition device based on the adjusted image acquisition parameters; A second object detection module, used to perform object detection processing on the second video stream to obtain a second detection result; A video analysis module, used to compare the first detection result with the second detection result, and obtain a video analysis result according to the comparison result; The first target detection module is further used to: Performing interval sampling on the first video stream to obtain a preset number of sampled image frames; Performing target detection and tracking on the preset number of sampled image frames respectively to obtain a target detection result corresponding to each sampled image frame, wherein the target detection result includes: the type of the target object detected in the sampled image frame and the positioning information of the target object in the corresponding sampled image frame; In response to the target detection result indicating that a target object of a target type is detected in a preset proportion of the sampled image frames, a first detection result is obtained based on the target type and the positioning information of the target object of the target type in the sampled image frames, wherein the target type is selected from: the type of target object detected in the sampled image frames.
6. The device according to claim 5, characterized in that The video image acquisition device adjustment module is further used for: Calculating target image acquisition parameters of the video image acquisition device based on the positioning information, the size of the video image, and the imaging characteristics of the video image acquisition device, wherein the target image acquisition parameters enable the target object to be located in a preset image area of the video image when the video image acquisition device acquires the video image based on the target image acquisition parameters; The image acquisition parameters of the video image acquisition device are adjusted to be the target image acquisition parameters.
7. The device according to claim 5, characterized in that The first detection result further includes: the type of the target object; the second detection result includes: the type of the target object; the video analysis module is further used to: Performing a consistency comparison between the type of the target object in the first detection result and the type of the target object in the second detection result to obtain a comparison result; In response to the comparison result indicating that the type of the target object in the first detection result is the same as the type of the target object in the second detection result, a video analysis result is obtained in which the target object is detected in the video stream captured by the video image acquisition device; In response to the comparison result indicating that the type of the target object in the first detection result is different from the type of the target object in the second detection result, a video analysis result indicating that the first detection result is a misidentification is obtained.
8. An electronic device comprising a memory, a processor, and a program code stored in the memory and executable on the processor, wherein: When the processor executes the program code, the video intelligent analysis method described in any one of claims 1 to 4 is implemented.
9. A computer-readable storage medium having program code stored thereon, characterized in that: When the program code is executed by a processor, the steps of the video intelligent analysis method described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Target detection method and device, computer equipment and storage medium
CN116994225A
