Target detection model training method and device, electronic device and storage medium
By performing video data annotation and loss value calculation on the cloud server, dynamically adjusting the training frequency of neural network model of edge servers, solving the problem of low accuracy of real-time video data detection and achieving more efficient target detection.
Patent Information
- Application Number
- CN202310570519.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-19
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2043-05-19
AI Technical Summary
In the prior art, the difference between real-time video data and sample video data leads to a decrease in the detection accuracy of the object detection model on real-time video data.
By uploading the original video data to the cloud server for object detection, the initial and average label prediction loss values are calculated to dynamically adjust the training frequency of the neural network model, the neural network model is optimized using the labeled video data to train the object detection model.
It improves the detection accuracy of the target detection model on real-time video data, reduces the waste of computing and storage resources of edge servers, and reduces server load.
Smart Images

Figure CN116486213B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method and device for training a target detection model, an electronic device, and a storage medium. Background Art
[0002] To achieve target detection, most target detection methods often train target detection models on edge servers and use them to perform target detection on video streams. However, there are differences between real-time video data and sample video data. If the target detection model trained with sample video data is used to perform target detection on real-time video data, the accuracy of target detection will be reduced. Summary of the Invention
[0003] The main purpose of the embodiments of the present application is to propose a training method and device for a target detection model, an electronic device and a storage medium, aiming to improve the accuracy of target detection.
[0004] To achieve the above objectives, a first aspect of an embodiment of the present application proposes a method for training a target detection model, which is applied to an edge server. The training method includes:
[0005] Obtaining original video data and uploading the original video data to a cloud server; wherein the original video data includes multiple video frames;
[0006] Receiving annotated video data obtained by the cloud server performing target detection on the original video data; wherein the annotated video data includes a plurality of the video frames and original label data of each of the video frames;
[0007] Calculate the initial label prediction loss value between each two adjacent video frames according to the original label data;
[0008] Calculating an average label prediction loss value of the original video data according to the initial label prediction loss value;
[0009] If the average label prediction loss value is greater than a preset loss threshold, inputting the labeled video data into a preset neural network model;
[0010] Parameters of the neural network model are optimized according to the labeled video data to train the neural network model and obtain a target detection model.
[0011] In some embodiments, optimizing parameters of the neural network model based on the labeled video data to train the neural network model to obtain a target detection model includes:
[0012] Performing target detection on video frames in the labeled video data using the neural network model to obtain predicted label data for the video frames;
[0013] Performing loss calculation based on the original label data and the predicted label data to obtain a target loss value;
[0014] Parameters of the neural network model are optimized according to the target loss value to train the neural network model to obtain a target detection model.
[0015] In some embodiments, the neural network model includes a first feature extraction network, a second feature extraction network, and a prediction network. The performing of target detection on the video frames in the labeled video data by the neural network model to obtain predicted label data for the video frames includes:
[0016] Performing feature extraction on the video frame using the first feature extraction network to obtain a first initial feature map, a second initial feature map, and a third initial feature map; wherein the feature map sizes of the first initial feature map, the second initial feature map, and the third initial feature map decrease in sequence;
[0017] Performing feature extraction on the first initial feature map, the second initial feature map, and the third initial feature map through the second feature extraction network to obtain a first intermediate feature map corresponding to the first initial feature map, a second intermediate feature map corresponding to the second initial feature map, and a third intermediate feature map corresponding to the third initial feature map;
[0018] Performing label prediction on the first intermediate feature map through the prediction network to obtain first prediction data, performing label prediction on the second intermediate feature map through the prediction network to obtain second prediction data, and performing label prediction on the third intermediate feature map through the prediction network to obtain third prediction data;
[0019] The predicted label data of the video frame is obtained according to the first prediction data, the second prediction data and the third prediction data.
[0020] In some embodiments, the second feature extraction network includes a spatial pyramid pooling layer and a path aggregation layer, and performing feature extraction on the first initial feature map, the second initial feature map, and the third initial feature map through the second feature extraction network to obtain a first intermediate feature map corresponding to the first initial feature map, a second intermediate feature map corresponding to the second initial feature map, and a third intermediate feature map corresponding to the third initial feature map includes:
[0021] performing pooling processing on the third initial feature map through the spatial pyramid pooling layer to obtain a first pooled feature map;
[0022] Performing feature aggregation on the second initial feature map and the first pooled feature map through the path aggregation layer to obtain a first aggregated feature map;
[0023] Performing feature aggregation on the first initial feature map and the first aggregated feature map through the path aggregation layer to obtain the first intermediate feature map;
[0024] Performing feature aggregation on the first intermediate feature map and the first aggregated feature map through the path aggregation layer to obtain a second intermediate feature map;
[0025] Feature aggregation is performed on the second intermediate feature map and the first pooled feature map through the path aggregation layer to obtain the third intermediate feature map.
[0026] In some embodiments, the original label data includes an original position label, an original confidence label, and an original category label, and the predicted label data includes a predicted position label, a predicted confidence label, and a predicted category label. The loss calculation based on the original label data and the predicted label data to obtain a target loss value includes:
[0027] Performing a first loss calculation based on the original position label and the predicted position label to obtain a positioning loss value;
[0028] Performing a second loss calculation based on the original confidence label and the predicted confidence label to obtain a confidence loss value;
[0029] Perform a third loss calculation based on the original category label and the predicted category label to obtain a classification loss value;
[0030] Target loss is calculated based on the positioning loss value, the confidence loss value, and the classification loss value to obtain the target loss value.
[0031] To achieve the above objectives, a second aspect of an embodiment of the present application proposes a target detection method, which is applied to an edge server. The target detection method includes:
[0032] Get target video data;
[0033] The target video data is input into the target detection model for target detection to obtain a target detection result, which is used to characterize the object category and object position of the target object in the target video data; the target detection model is trained according to the training method of the target detection model described in the first aspect.
[0034] To achieve the above objectives, a third aspect of an embodiment of the present application provides a training device for a target detection model, which is applied to an edge server. The training device includes:
[0035] A first acquisition module is used to acquire original video data and upload the original video data to a cloud server; wherein the original video data includes multiple video frames;
[0036] A receiving module, configured to receive the annotated video data obtained by the cloud server performing target detection on the original video data; wherein the annotated video data includes a plurality of the video frames and the original label data of each of the video frames;
[0037] A first calculation module is used to calculate the initial label prediction loss value between every two adjacent video frames according to the original label data;
[0038] A second calculation module is used to calculate the average label prediction loss value of the original video data according to the initial label prediction loss value;
[0039] An input module, configured to input the labeled video data into a preset neural network model if the average label prediction loss value is greater than a preset loss threshold;
[0040] A training module is used to optimize the parameters of the neural network model according to the labeled video data to train the neural network model and obtain a target detection model.
[0041] To achieve the above objectives, a fourth aspect of the embodiments of the present application provides a target detection device, which is applied to an edge server. The target detection device includes:
[0042] A second acquisition module is used to acquire target video data;
[0043] A target detection module is used to input the target video data into a target detection model for target detection to obtain a target detection result, wherein the target detection result is used to characterize the object category and object position of the target object in the target video data; the target detection model is trained according to the training device of the target detection model as described in the third aspect.
[0044] To achieve the above-mentioned purpose, the fifth aspect of an embodiment of the present application proposes an electronic device, which includes a memory and a processor, and the memory stores a computer program. When the processor executes the computer program, it implements the training method of the target detection model described in the first aspect or the target detection method described in the second aspect.
[0045] To achieve the above-mentioned purpose, the sixth aspect of an embodiment of the present application proposes a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the training method of the target detection model described in the first aspect or the target detection method described in the second aspect.
[0046] The target detection model training method, target detection method, target detection model training device, target detection device, electronic device and computer-readable storage medium proposed in this application are applied to the edge server side, which obtains original video data and uploads the original video data to the cloud server side, wherein the original video data includes multiple video frames. Since the computing resources and storage resources of the edge server side are limited, the original video data, i.e., real-time video data, is uploaded to the cloud server side so that the cloud server side can perform target detection on the real-time video data, thereby saving the computing resources and storage resources of the edge server side. The cloud server side receives the labeled video data obtained by performing target detection on the original video data, wherein the labeled video data includes multiple video frames and the original label data of each video frame. The cloud server side performs target prediction on the original video data instead of the edge server side, thereby reducing the waste of computing resources and storage resources of the edge server. Furthermore, the initial label prediction loss value between each two adjacent video frames is calculated based on the original label data, and the average label prediction loss value of the original video data is calculated based on the initial label prediction loss value. The average label prediction loss value can reflect the degree of change of the original video data. If the average label prediction loss value is greater than the preset loss threshold, it means that the degree of change of the original video data is large, and the neural network model on the edge server side needs to be retrained based on the labeled video data. The labeled video data is input into the preset neural network model, and the parameters of the neural network model are optimized based on the labeled video data to train the neural network model to obtain the target detection model. The average prediction loss value is used to determine whether to train the neural network model. The frequency of training the neural network model on the edge server side can be dynamically adjusted, rather than training the neural network model based on the labeled video data every time, which helps to reduce the server load on the edge server side. By using real-time video data to train the neural network model on the edge server side, the accuracy of target detection by the target detection model can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 This is a flowchart of a method for training a target detection model according to an embodiment of the present application;
[0048] Figure 2 yes Figure 1 Flowchart of step S160 in FIG.
[0049] Figure 3 yes Figure 2 Flowchart of step S210 in FIG.
[0050] Figure 4 yes Figure 3 Flowchart of step S320 in FIG.
[0051] Figure 5 yes Figure 2 Flowchart of step S220 in FIG.
[0052] Figure 6 is a flow chart of the target detection method provided in an embodiment of the present application;
[0053] Figure 7 Schematic diagram of the structure of the training device of the target detection model provided in the embodiment of the present application;
[0054] Figure 8 is a schematic structural diagram of a target detection device provided in an embodiment of the present application;
[0055] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0057] It should be noted that although the device schematics illustrate functional module divisions and the flowcharts illustrate logical sequences, in certain circumstances, the steps shown or described may be performed in a sequence that differs from the module divisions in the device or the sequence in the flowcharts. The terms "first," "second," and so on, in the specification, claims, and drawings, are used to distinguish similar items and are not necessarily used to describe a specific sequence or precedence.
[0058] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0059] First, let’s analyze some of the terms used in this application:
[0060] Artificial intelligence (AI) is a new technical discipline that studies and develops theories, methods, technologies, and application systems for simulating, extending, and expanding human intelligence. A branch of computer science, AI seeks to understand the essence of intelligence and produce new intelligent machines that can respond in a manner similar to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing, and expert systems. AI can simulate the information processes of human consciousness and thinking. It also encompasses the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, to perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results.
[0061] In related technologies, in order to achieve target detection, most target detection methods often train target detection models on edge servers and use the target detection models to perform target detection on video streams. However, there will be differences between real-time video data and sample video data. If the target detection model trained with sample video data is used to perform target detection on real-time video data, the accuracy of target detection will be reduced.
[0062] Based on this, the embodiments of the present application provide a target detection model training method, a target detection method, a target detection model training device, a target detection device, an electronic device and a computer-readable storage medium, aiming to improve the accuracy of target detection.
[0063] The target detection model training method, target detection method, target detection model training device, target detection device, electronic device and computer-readable storage medium provided in the embodiments of the present application are specifically illustrated through the following embodiments. First, the target detection model training method in the embodiments of the present application is described.
[0064] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to achieve optimal results.
[0065] Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interaction systems, and mechatronics. AI software technologies primarily encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0066] The training method of the target detection model provided in the embodiment of the present application relates to the field of artificial intelligence technology. The training method of the target detection model provided in the embodiment of the present application can be applied to the terminal, can also be applied to the server side, and can also be software running in the terminal or the server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application of the training method for the target detection model, etc., but is not limited to the above forms.
[0067] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and the like. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments in which tasks are performed by remote processing devices connected via a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media, including storage devices.
[0068] It should be noted that in each specific embodiment of the present application, when it comes to the need to perform relevant processing based on data related to the user's identity or characteristics, such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of such data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0069] Figure 1 This is an optional flowchart of the target detection model training method provided in the embodiment of the present application. Figure 1The training method is applied to the edge server side, and may include but is not limited to steps S110 to S160.
[0070] Step S110: obtaining original video data and uploading the original video data to a cloud server; wherein the original video data includes multiple video frames;
[0071] Step S120: receiving annotated video data obtained by performing target detection on the original video data by the cloud server; wherein the annotated video data includes multiple video frames and original label data of each video frame;
[0072] Step S130, calculating the initial label prediction loss value between every two adjacent video frames based on the original label data;
[0073] Step S140, calculating the average label prediction loss value of the original video data according to the initial label prediction loss value;
[0074] Step S150: If the average label prediction loss value is greater than a preset loss threshold, the labeled video data is input into a preset neural network model;
[0075] Step S160: Optimize the parameters of the neural network model according to the labeled video data to train the neural network model and obtain a target detection model.
[0076] In the embodiment of the present application, steps S110 to S160 are performed by obtaining the original video data and uploading the original video data to the cloud server, wherein the original video data includes multiple video frames. Since the computing resources and storage resources of the edge server are limited, the original video data, i.e., real-time video data, is uploaded to the cloud server so that the cloud server can perform target detection on the real-time video data, thereby saving the computing resources and storage resources of the edge server. The cloud server receives the labeled video data obtained by performing target detection on the original video data, wherein the labeled video data includes multiple video frames and the original label data of each video frame. The cloud server performs target prediction on the original video data instead of the edge server, thereby reducing the waste of computing resources and storage resources of the edge server. Furthermore, the initial label prediction loss value between each two adjacent video frames is calculated based on the original label data, and the average label prediction loss value of the original video data is calculated based on the initial label prediction loss value. The average label prediction loss value can reflect the degree of change of the original video data. If the average label prediction loss value is greater than the preset loss threshold, it means that the degree of change of the original video data is large, and the neural network model on the edge server side needs to be retrained based on the labeled video data. The labeled video data is input into the preset neural network model, and the parameters of the neural network model are optimized based on the labeled video data to train the neural network model to obtain the target detection model. The average prediction loss value is used to determine whether to train the neural network model. The frequency of training the neural network model on the edge server side can be dynamically adjusted, rather than training the neural network model based on the labeled video data every time, which helps to reduce the server load on the edge server side. By using real-time video data to train the neural network model on the edge server side, the accuracy of target detection by the target detection model can be improved.
[0077] In step S110 of some embodiments, due to limited edge computing resources, such as a weak GPU and limited storage space, edge deployment relies on models with few parameters and shallow layers obtained through model compression. In practical applications, real-time video data will cover different scenes over time, such as lighting, crowd density, and constantly changing scenes. The sample video data used for training is difficult to fully cover all scenes. Due to data drift, that is, the difference between real-time video data and the sample video data used for training, the model will be affected by data drift. When performing target detection using the target detection model trained with sample video data, the target detection accuracy will drop by more than 20%. To address the data drift problem and improve the accuracy of target detection, real-time video data is periodically acquired through continuous learning technology to retrain the target detection model on the edge server to adapt to the continuous changes in video data and ensure that the compressed edge model maintains high target detection accuracy when data features change. The period between two retrainings, i.e., the training cycle, is called the retraining window. The real-time video data accumulated in each retraining window is the original video data. Specifically, the terminal device is connected to the edge server through the local wireless LAN, and the real-time video data in the retraining window is transmitted to the edge server to obtain the original video data. Due to the limited computing resources and storage resources of the edge server, it is impossible to perform effective video analysis on the original video data. The original video data is uploaded to the cloud server, and the video analysis task is handed over to the cloud server for execution. The terminal device can be a device with a camera module, such as a camera, and the original video data includes multiple video frames.
[0078] In step S120 of some embodiments, the operating environment, model training code, sample video data used for training, and other configurations that the model training depends on are packaged into an image, and the image is deployed on the cloud server side so that the cloud server side uses the image to perform model training and obtain a teacher model. The method of manually labeling to obtain video labels is inefficient and cannot adapt to the continuous training of the edge server side. Therefore, a teacher model is used to perform video analysis on the original video data to obtain the original label data of the original video data. Specifically, target detection is performed on each video frame in the original video data based on the teacher model to obtain the original label data of each video frame, and all video frames and the original label data of all video frames are used as labeled video data, and the labeled video data is sent to the edge server side.
[0079] In step S130 of some embodiments, the retraining frequency is fixed, that is, retraining is performed in each retraining window. For fixed or slowly changing videos, this retraining method is not efficient enough in utilizing edge resources. In order to efficiently utilize edge resources, the embodiment of the present application dynamically adjusts the retraining frequency of the edge server side according to the degree and speed of scene changes. The initial label prediction loss value between each two adjacent video frames is calculated based on the original label data of each two adjacent video frames, where the initial label prediction loss value is used to reflect the degree of scene change of adjacent video frames. Specifically, if the original video data is represented as k represents the order of the video frames in the original video data, n+1 represents the number of video frames in the original video data, and I k Represents the kth video frame, and the original label data of the kth video frame is represented as T(I k ), according to the original label data T(I k ) and the original label data T(I k-1 ) Calculate the initial label prediction loss value between the kth video frame and the k-1th video frame. The calculation method of the initial label prediction loss value is shown in formula (1).
[0080] φ k =loss(T(I k ),T(I k-1 )) k≥1 formula (1)
[0081] Among them, loss is the loss function of the neural network model deployed on the edge server; φ k is the initial label prediction loss value, φ k Represents the teacher model's response to the current video frame I k The predicted label and the previous video frame I k-1 The error between the predicted labels.
[0082] φ k The smaller it is, the more similar the predicted labels between adjacent video frames are, that is, the smaller the scene changes between adjacent video frames are; k The larger the value, the greater the difference in predicted labels between adjacent video frames, that is, the greater the degree of scene change between adjacent video frames. It is understandable that a static scene or a slowly changing scene will get a smaller φ k .
[0083] In step S140 of some embodiments, the average label prediction loss value of the original video data is calculated based on the initial label prediction loss value between each two adjacent video frames, wherein the average label prediction loss value is used to reflect the scene change degree of the original video data in the retraining window, that is, the average scene change degree of all video frames in the retraining window. The calculation method of is shown in formula (2).
[0084]
[0085] In step S150 of some embodiments, in order to reduce the server load on the edge server, the retraining frequency is dynamically adjusted based on the average label prediction loss value. If the average label prediction loss value is greater than a preset loss threshold, it indicates that the scene of the original video data within the retraining window has changed significantly. In order to solve the data drift problem, it is necessary to retrain the neural network model, i.e., the student model, on the edge server using the labeled video data. If the average label prediction loss value is less than or equal to the preset loss threshold, it indicates that the scene of the original video data within the retraining window has changed slightly, and the neural network model on the edge server does not need to be retrained. The original video data of the retraining window is then ignored. For example, for a camera placed at an intersection in smart transportation, when the traffic light turns red, the scene is almost motionless, and there is no need to update the model using the data from this window. During busy traffic, the update frequency of the neural network model, i.e., the retraining frequency, will also increase. By adjusting the retraining frequency through dynamic incremental learning, the edge server does not need to retrain using the original video data within each retraining window. Compared with a fixed retraining frequency approach, limited edge resources can be more efficiently utilized.
[0086] See also Figure 2 In some embodiments, step S160 may include but is not limited to steps S210 to S230:
[0087] Step S210, performing target detection on the video frames in the labeled video data using a neural network model to obtain predicted label data of the video frames;
[0088] Step S220, performing loss calculation based on the original label data and the predicted label data to obtain a target loss value;
[0089] Step S230: Optimize the parameters of the neural network model according to the target loss value to train the neural network model and obtain a target detection model.
[0090] In step S210 of some embodiments, target detection is performed on each video frame in the labeled video data using a neural network model to obtain predicted label data for each video frame.
[0091] In step S220 of some embodiments, loss calculation is performed on the original label data and the predicted label data according to the loss function of the neural network model deployed on the edge server to obtain a target loss value. The neural network model may be YOLOv4.
[0092] In step S230 of some embodiments, the parameters of the neural network model are optimized according to the target loss value to train the neural network model. When the target loss value is less than a preset target loss threshold or equal to zero, the training of the neural network model stops and the target detection model is obtained; or, when the current number of iterations is greater than or equal to a preset iteration threshold, the training of the neural network model stops and the target detection model is obtained.
[0093] In the above steps S210 to S230, the neural network model deployed on the edge server is retrained by annotating the video data to obtain a target detection model, which can solve the problem of a significant reduction in target detection accuracy due to data drift and improve the accuracy of target detection by the target detection model.
[0094] See also Figure 3 In some embodiments, the neural network model includes a first feature extraction network, a second feature extraction network, and a prediction network. Step S210 may include, but is not limited to, steps S310 to S340:
[0095] Step S310: extracting features from the video frame using a first feature extraction network to obtain a first initial feature map, a second initial feature map, and a third initial feature map; wherein the feature map sizes of the first initial feature map, the second initial feature map, and the third initial feature map decrease in sequence;
[0096] Step S320, performing feature extraction on the first initial feature map, the second initial feature map, and the third initial feature map through a second feature extraction network to obtain a first intermediate feature map corresponding to the first initial feature map, a second intermediate feature map corresponding to the second initial feature map, and a third intermediate feature map corresponding to the third initial feature map;
[0097] Step S330, performing label prediction on the first intermediate feature map through the prediction network to obtain first prediction data, performing label prediction on the second intermediate feature map through the prediction network to obtain second prediction data, and performing label prediction on the third intermediate feature map through the prediction network to obtain third prediction data;
[0098] Step S340 , obtaining predicted label data of the video frame according to the first predicted data, the second predicted data, and the third predicted data.
[0099] In step S310 of some embodiments, each video frame is scaled to a uniform size dimension of 608×608×3, and the scaled video frames are normalized to obtain preprocessed video frames. Feature extraction is performed on the preprocessed video frames through a first feature extraction network to obtain a first initial feature map, a second initial feature map, and a third initial feature map, wherein the first feature extraction network is a backbone feature extraction network, including a CBM convolution module, a CSP1 module, a CSP2 module, a first CSP8 module, a second CSP8 module, and a CSP4 module, and the feature map sizes of the first initial feature map, the second initial feature map, and the third initial feature map decrease successively. Specifically, the CBM convolution module performs convolution calculations on the preprocessed video frame to obtain a first feature map, the CSP1 module performs feature extraction on the first feature map to obtain a second feature map, the CSP2 module performs feature extraction on the second feature map to obtain a third feature map, the first CSP8 module performs feature extraction on the third feature map to obtain a first initial feature map, the second CSP8 module performs feature extraction on the first initial feature map to obtain a second initial feature map, and the CSP4 module performs feature extraction on the second initial feature map to obtain a third initial feature map. The CBM convolution module includes a convolution layer Conv, a batch normalization layer BN, and an activation function Mish. The convolution layer Conv performs convolution calculations on the preprocessed video frame to obtain a convolution feature map, the batch normalization layer BN performs batch normalization on the convolution feature map to obtain a normalized feature map, and the activation function Mish performs feature mapping on the normalized feature map to obtain a first feature map. The CSPX module consists of a CBM convolution module and X residual components, where X is an integer greater than 0 and its specific value can be set according to actual conditions. For example, the CSP2 module consists of a CBM convolution module and two residual components. The CSPX module can map features into two parts, and these two parts can be merged across stages. This not only reduces the computational complexity of the model, but also achieves richer gradient combinations, thereby improving the accuracy and speed of target detection.
[0100] In step S320 of some embodiments, the second feature extraction network is a strengthened feature extraction network, and feature extraction is performed on the first initial feature map, the second initial feature map, and the third initial feature map through the second feature extraction network, which can further improve the diversity and robustness of the features.
[0101] In step S330 of some embodiments, the prediction network includes three YOLO detection heads of different scales, namely a first detection head, a second detection head, and a third detection head, which respectively perform large-scale, medium-scale, and small-scale predictions, wherein the detection head scales of the first detection head, the second detection head, and the third detection head decrease in sequence. The first detection head performs large-scale target label prediction on the first intermediate feature map to obtain first prediction data, the second detection head performs medium-scale target label prediction on the second intermediate feature map to obtain second prediction data, and the third detection head performs small-scale target label prediction on the third intermediate feature map to obtain third prediction data.
[0102] In step S340 of some embodiments, the first prediction data, the second prediction data, and the third prediction data are used as prediction label data of the video frame to detect large targets, medium targets, and small targets in the video frame, so that the target detection model can recognize targets of different scales and improve the accuracy of target detection performed by the target detection model.
[0103] In the above steps S310 to S340, the common features of the video frames are extracted by the first feature extraction network, and the common features are extracted by the second feature extraction network, which can improve the diversity and robustness of the features. The labels of the video frames are predicted by the prediction network, which can identify objects of different scales in the video frames and improve the accuracy of target detection.
[0104] See also Figure 4 In some embodiments, the second feature extraction network includes a spatial pyramid pooling layer and a path aggregation layer. Step S320 may include, but is not limited to, steps S410 to S450:
[0105] Step S410, performing pooling processing on the third initial feature map through a spatial pyramid pooling layer to obtain a first pooled feature map;
[0106] Step S420: performing feature aggregation on the second initial feature map and the first pooled feature map through a path aggregation layer to obtain a first aggregated feature map;
[0107] Step S430: performing feature aggregation on the first initial feature map and the first aggregated feature map through a path aggregation layer to obtain a first intermediate feature map;
[0108] Step S440: performing feature aggregation on the first intermediate feature map and the first aggregated feature map through a path aggregation layer to obtain a second intermediate feature map;
[0109] Step S450: Perform feature aggregation on the second intermediate feature map and the first pooled feature map through a path aggregation layer to obtain a third intermediate feature map.
[0110] In step S410 of some embodiments, the second feature extraction network further includes a plurality of CBL convolution modules, which perform a convolution operation on the third initial feature map through the first CBL convolution module to obtain a convolution feature map, and perform pooling processing on the convolution feature map through the spatial pyramid pooling layer (SPP) to obtain a first pooled feature map. The first CBL convolution module includes a convolution layer Conv, a batch normalization layer BN, and an activation function Leaky ReLU, which performs a convolution operation on the third initial feature map through the convolution layer Conv to obtain a fourth feature map, performs batch normalization processing on the fourth feature map through the batch normalization layer BN to obtain a batch normalized feature map, and performs feature mapping on the batch normalized feature map through the activation function Leaky ReLU to obtain a convolution feature map. The structures of the other CBL convolution modules are the same as those of the first CBL convolution module and will not be repeated here.
[0111] Feature maps of different scales are fused through the SPP layer. The SPP layer includes the first maximum pooling layer, the second maximum pooling layer and the third maximum pooling layer. The convolution kernel size of the first maximum pooling layer is 5, the convolution kernel size of the second maximum pooling layer is 9, and the convolution kernel size of the third maximum pooling layer is 13. The convolution feature map is maximized by the first maximum pooling layer to obtain the first maximum pooling feature map. The convolution feature map is maximized by the second maximum pooling layer to obtain the second maximum pooling feature map. The convolution feature map is maximized by the third maximum pooling layer to obtain the third maximum pooling feature map. The convolution feature map, the first maximum pooling feature map, the second maximum pooling feature map and the third maximum pooling feature map are feature aggregated, i.e., concat, to obtain the first pooling feature map.
[0112] In step S420 of some embodiments, a convolution operation is performed on the first pooled feature map through a second CBL convolution module to obtain a first intermediate convolution feature map, a convolution operation is performed on the first intermediate convolution feature map through a third CBL convolution module to obtain a second intermediate convolution feature map, the second intermediate convolution feature map is upsampled to obtain a first upsampled feature map, a convolution operation is performed on the second initial feature map through a fourth CBL convolution module to obtain a third intermediate convolution feature map, and feature aggregation is performed on the third intermediate convolution feature map and the first upsampled feature map through a first path aggregation layer, i.e., a concat layer, to obtain a first aggregated feature map.
[0113] In step S430 of some embodiments, a convolution operation is performed on the first initial feature map through the fifth CBL convolution module to obtain a fourth intermediate convolution feature map, a convolution operation is performed on the first aggregated feature map through the sixth CBL convolution module to obtain a fifth intermediate convolution feature map, a convolution operation is performed on the fifth intermediate convolution feature map through the seventh CBL convolution module, the convolved fifth intermediate convolution feature map is upsampled to obtain a second upsampled feature map, the fourth intermediate convolution feature map and the second upsampled feature map are aggregated through the second path aggregation layer, and a convolution operation is performed on the aggregated feature map through the eighth CBL convolution module to obtain a first intermediate feature map.
[0114] In step S440 of some embodiments, a convolution operation is performed on the first intermediate feature map through a CBL convolution module to obtain a sixth intermediate convolution feature map, the fifth intermediate convolution feature map and the sixth intermediate convolution feature map are feature aggregated through a third path aggregation layer, and a convolution operation is performed on the aggregated feature map through a CBL convolution module to obtain a second intermediate feature map.
[0115] In step S450 of some embodiments, a convolution operation is performed on the second intermediate feature map through a CBL convolution module to obtain a seventh intermediate convolution feature map, the first intermediate convolution feature map and the seventh intermediate convolution feature map are feature aggregated through a fourth path aggregation layer, and a convolution operation is performed on the aggregated feature map through a CBL convolution module to obtain a third intermediate feature map.
[0116] Through the above steps S410 to S450, feature maps of different scales, namely the first intermediate feature map, the second intermediate feature map and the third intermediate feature map, can be obtained, so that large, medium and small targets can be detected based on the first intermediate feature map, the second intermediate feature map and the third intermediate feature map, thereby improving the accuracy of target detection.
[0117] See also Figure 5 In some embodiments, the original label data includes an original position label, an original confidence label, and an original category label, and the predicted label data includes a predicted position label, a predicted confidence label, and a predicted category label. Step S220 may include, but is not limited to, steps S510 to S540:
[0118] Step S510, performing a first loss calculation based on the original location tag and the predicted location tag to obtain a positioning loss value;
[0119] Step S520, performing a second loss calculation based on the original confidence label and the predicted confidence label to obtain a confidence loss value;
[0120] Step S530, performing a third loss calculation based on the original category label and the predicted category label to obtain a classification loss value;
[0121] In step S540 , target loss is calculated based on the positioning loss value, the confidence loss value, and the classification loss value to obtain a target loss value.
[0122] In step S510 of some embodiments, the original position label is the coordinate information of the real bounding box of the target object in the video frame, and the predicted position label is the coordinate information of the predicted bounding box of the target object. The first loss calculation is performed on the original position label and the predicted position label according to the CIOU loss function to obtain the positioning loss value.
[0123] In step S520 of some embodiments, a second loss calculation is performed on the original confidence label and the predicted confidence label according to the binary cross entropy loss function to obtain a targeted confidence loss value and a non-target confidence loss value.
[0124] In step S530 of some embodiments, a third loss calculation is performed on the original category label and the predicted category label according to the binary cross entropy loss function to obtain a classification loss value.
[0125] In step S540 of some embodiments, the positioning loss value, the confidence loss value, and the classification loss value are added to obtain a target loss value. Specifically, the positioning loss value, the confidence loss value, and the classification loss value of the first intermediate feature map are added to obtain a first target loss value, the positioning loss value, the confidence loss value, and the classification loss value of the second intermediate feature map are added to obtain a second target loss value, the positioning loss value, the confidence loss value, and the classification loss value of the third intermediate feature map are added to obtain a third target loss value, and the first target loss value, the second target loss value, and the third target loss value are added to obtain the target loss value.
[0126] Through the above steps S510 to S540, the target loss value can be obtained, so that the parameters of the neural network model can be adjusted according to the target loss value to obtain the target detection model, so as to improve the accuracy of target detection performed by the target detection model.
[0127] Figure 6 This is an optional flowchart of the target detection method provided in the embodiment of the present application. Figure 6 The target detection method is applied to the edge server, and may include but is not limited to steps S610 to S620.
[0128] Step S610, obtaining target video data;
[0129] In step S620, the target video data is input into the target detection model for target detection to obtain a target detection result. The target detection result is used to characterize the object category and object position of the target object in the target video data; the target detection model is trained according to the training method of the target detection model of the first embodiment.
[0130] In step S610 of some embodiments, for video scenarios with high real-time requirements, such as intelligent driving, transmitting real-time video data to the cloud server for video inference will cause delays. Transmitting a large amount of real-time video data from multiple edge servers to the cloud server will occupy a large amount of network bandwidth, resulting in high network overhead and network unreliability. If the network between the edge server and the cloud server is disconnected, it will affect edge computing. Due to network bandwidth limitations, network unreliability, and video data security, performing video inference and retraining on the edge server without relying on the cloud server helps reduce the uplink bandwidth from the edge server to the cloud server and the load on the cloud server. The terminal device uploads target video data to the edge server. The target video data is video data captured in real time by the terminal device. The terminal device can be a camera on the street or a smart car.
[0131] In step S620 of some embodiments, video inference of real-time video data is performed on the edge server, and the target video data is input into the target detection model for target detection to obtain a target detection result, which is used to characterize the object category and object position of the target object in the target video data.
[0132] Through the above steps S610 to S620, target detection can be performed on the target video data in real time on the edge server side, without uploading the video to the cloud server side through a network link, reducing the uplink bandwidth and the load on the cloud server side, and ensuring the security of the video data.
[0133] See also Figure 7 The present application also provides a training device for a target detection model, which is applied to an edge server and can implement the training method of the target detection model. The training device includes:
[0134] The first acquisition module 710 is used to acquire original video data and upload the original video data to the cloud server; wherein the original video data includes multiple video frames;
[0135] The receiving module 720 is configured to receive the annotated video data obtained by the cloud server performing object detection on the original video data; wherein the annotated video data includes multiple video frames and the original label data of each video frame;
[0136] A first calculation module 730 is configured to calculate an initial label prediction loss value between every two adjacent video frames based on the original label data;
[0137] A second calculation module 740 is used to calculate the average label prediction loss value of the original video data according to the initial label prediction loss value;
[0138] An input module 750 is configured to input the labeled video data into a preset neural network model if the average label prediction loss value is greater than a preset loss threshold;
[0139] The training module 760 is used to optimize the parameters of the neural network model based on the labeled video data to train the neural network model and obtain the target detection model.
[0140] The specific implementation of the training device of the target detection model is basically the same as the specific embodiment of the training method of the above-mentioned target detection model, and will not be repeated here.
[0141] See also Figure 8 The present application also provides a target detection device, which is applied to an edge server and can implement the above target detection method. The target detection device includes:
[0142] A second acquisition module 810 is used to acquire target video data;
[0143] The target detection module 820 is used to input the target video data into the target detection model for target detection to obtain the target detection result, which is used to characterize the object category and object position of the target object in the target video data; the target detection model is trained according to the training device of the target detection model as described in the embodiment of the third aspect.
[0144] The specific implementation of the target detection device is basically the same as the specific embodiment of the above-mentioned target detection method, and will not be repeated here.
[0145] The present application also provides an electronic device comprising a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned target detection model training method or target detection method. The electronic device can be any smart terminal, such as a tablet computer or an in-vehicle computer.
[0146] See also Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is shown. The electronic device includes:
[0147] The processor 910 can be implemented as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0148] The memory 920 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 920 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 920, and the processor 910 calls and executes the training method or target detection method of the target detection model of the embodiment of the present application;
[0149] Input / output interface 930, used to implement information input and output;
[0150] Communication interface 940, used to implement communication interaction between this device and other devices, which can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, Wi-Fi, Bluetooth, etc.);
[0151] bus 950 , which transmits information between various components of the device (e.g., processor 910 , memory 920 , input / output interface 930 , and communication interface 940 );
[0152] The processor 910 , the memory 920 , the input / output interface 930 , and the communication interface 940 are connected to each other in communication within the device via a bus 950 .
[0153] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned target detection model training method or target detection method.
[0154] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0155] The target detection model training method, target detection method, target detection model training device, target detection device, electronic device and computer-readable storage medium provided in the embodiments of the present application obtain original video data and upload the original video data to the cloud server side, wherein the original video data includes multiple video frames. Since the computing resources and storage resources of the edge server side are limited, the original video data, i.e., real-time video data, is uploaded to the cloud server side so that the cloud server side can perform target detection on the real-time video data, thereby saving computing resources and storage resources on the edge server side. The cloud server side receives the labeled video data obtained by performing target detection on the original video data, wherein the labeled video data includes multiple video frames and the original label data of each video frame. The cloud server side performs target prediction on the original video data instead of the edge server side, thereby reducing the waste of computing resources and storage resources on the edge server. Furthermore, the initial label prediction loss value between each two adjacent video frames is calculated based on the original label data, and the average label prediction loss value of the original video data is calculated based on the initial label prediction loss value. The average label prediction loss value can reflect the degree of change of the original video data. If the average label prediction loss value is greater than the preset loss threshold, it means that the degree of change of the original video data is large, and the neural network model on the edge server side needs to be retrained based on the labeled video data. The labeled video data is input into the preset neural network model, and the parameters of the neural network model are optimized based on the labeled video data to train the neural network model to obtain the target detection model. The average prediction loss value is used to determine whether to train the neural network model. The frequency of training the neural network model on the edge server side can be dynamically adjusted, rather than training the neural network model based on the labeled video data every time, which helps to reduce the server load on the edge server side. By using real-time video data to train the neural network model on the edge server side, the accuracy of target detection by the target detection model can be improved.
[0156] The embodiments described in the embodiments of this application are intended to more clearly illustrate the technical solutions of the embodiments of this application and do not constitute a limitation on the technical solutions provided by the embodiments of this application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0157] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0158] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, i.e., they may be located in one place or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of this embodiment.
[0159] Those skilled in the art will appreciate that all or some of the steps in the methods, systems, and functional modules / units in the devices disclosed above may be implemented as software, firmware, hardware, or appropriate combinations thereof.
[0160] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0161] It should be understood that in this application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0162] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0163] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes multiple instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: various media that can store programs, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0166] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but are not intended to limit the scope of the present invention. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and essence of the present invention should be within the scope of the present invention.
Claims
1. The training method of the target detection model is characterized by: Applied to the edge server, the training method includes: Obtaining original video data and uploading the original video data to a cloud server; wherein the original video data includes multiple video frames; Receiving annotated video data obtained by the cloud server performing target detection on the original video data; wherein the annotated video data includes a plurality of the video frames and original label data of each of the video frames; Calculate the initial label prediction loss value between each two adjacent video frames according to the original label data; Calculating an average label prediction loss value of the original video data according to the initial label prediction loss value; If the average label prediction loss value is greater than a preset loss threshold, inputting the labeled video data into a preset neural network model; Parameters of the neural network model are optimized according to the labeled video data to train the neural network model and obtain a target detection model.
2. The target detection model training method according to claim 1, characterized in that: Optimizing parameters of the neural network model according to the labeled video data to train the neural network model to obtain a target detection model includes: Performing target detection on video frames in the labeled video data using the neural network model to obtain predicted label data for the video frames; Performing loss calculation based on the original label data and the predicted label data to obtain a target loss value; Parameters of the neural network model are optimized according to the target loss value to train the neural network model to obtain a target detection model.
3. The target detection model training method according to claim 2, characterized in that: The neural network model includes a first feature extraction network, a second feature extraction network, and a prediction network. The neural network model is used to perform target detection on the video frames in the labeled video data to obtain predicted label data of the video frames, including: Performing feature extraction on the video frame using the first feature extraction network to obtain a first initial feature map, a second initial feature map, and a third initial feature map; wherein the feature map sizes of the first initial feature map, the second initial feature map, and the third initial feature map decrease in sequence; Performing feature extraction on the first initial feature map, the second initial feature map, and the third initial feature map through the second feature extraction network to obtain a first intermediate feature map corresponding to the first initial feature map, a second intermediate feature map corresponding to the second initial feature map, and a third intermediate feature map corresponding to the third initial feature map; Performing label prediction on the first intermediate feature map through the prediction network to obtain first prediction data, performing label prediction on the second intermediate feature map through the prediction network to obtain second prediction data, and performing label prediction on the third intermediate feature map through the prediction network to obtain third prediction data; The predicted label data of the video frame is obtained according to the first prediction data, the second prediction data and the third prediction data.
4. The target detection model training method according to claim 3, characterized in that: The second feature extraction network includes a spatial pyramid pooling layer and a path aggregation layer. The second feature extraction network is used to extract features from the first initial feature map, the second initial feature map, and the third initial feature map to obtain a first intermediate feature map corresponding to the first initial feature map, a second intermediate feature map corresponding to the second initial feature map, and a third intermediate feature map corresponding to the third initial feature map, including: performing pooling processing on the third initial feature map through the spatial pyramid pooling layer to obtain a first pooled feature map; Performing feature aggregation on the second initial feature map and the first pooled feature map through the path aggregation layer to obtain a first aggregated feature map; Performing feature aggregation on the first initial feature map and the first aggregated feature map through the path aggregation layer to obtain the first intermediate feature map; Performing feature aggregation on the first intermediate feature map and the first aggregated feature map through the path aggregation layer to obtain a second intermediate feature map; Feature aggregation is performed on the second intermediate feature map and the first pooled feature map through the path aggregation layer to obtain the third intermediate feature map.
5. The method for training a target detection model according to claim 2, wherein: The original label data includes an original position label, an original confidence label, and an original category label; the predicted label data includes a predicted position label, a predicted confidence label, and a predicted category label; and performing loss calculation based on the original label data and the predicted label data to obtain a target loss value includes: Performing a first loss calculation based on the original position label and the predicted position label to obtain a positioning loss value; Performing a second loss calculation based on the original confidence label and the predicted confidence label to obtain a confidence loss value; Perform a third loss calculation based on the original category label and the predicted category label to obtain a classification loss value; Target loss is calculated based on the positioning loss value, the confidence loss value, and the classification loss value to obtain the target loss value.
6. A target detection method, characterized in that: Applied to the edge server, the target detection method includes: Get target video data; The target video data is input into a target detection model for target detection to obtain a target detection result, wherein the target detection result is used to characterize the object category and object position of the target object in the target video data; the target detection model is trained according to the training method of the target detection model as described in any one of claims 1 to 5.
7. A training device for a target detection model, characterized in that: Applied to the edge server side, the training device includes: A first acquisition module is used to acquire original video data and upload the original video data to a cloud server; wherein the original video data includes multiple video frames; A receiving module, configured to receive the annotated video data obtained by the cloud server performing target detection on the original video data; wherein the annotated video data includes a plurality of the video frames and the original label data of each of the video frames; A first calculation module is used to calculate the initial label prediction loss value between every two adjacent video frames according to the original label data; A second calculation module is used to calculate the average label prediction loss value of the original video data according to the initial label prediction loss value; An input module, configured to input the labeled video data into a preset neural network model if the average label prediction loss value is greater than a preset loss threshold; A training module is used to optimize the parameters of the neural network model according to the labeled video data to train the neural network model and obtain a target detection model.
8. The target detection device is characterized in that Applied to the edge server side, the target detection device includes: A second acquisition module is used to acquire target video data; A target detection module is used to input the target video data into a target detection model for target detection to obtain a target detection result, wherein the target detection result is used to characterize the object category and object position of the target object in the target video data; the target detection model is trained according to the target detection model training device as described in claim 7.
9. An electronic device, characterized in that The electronic device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following is achieved: The method for training a target detection model according to any one of claims 1 to 5; or, The target detection method according to claim 6.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it realizes: The method for training a target detection model according to any one of claims 1 to 5; or, The target detection method according to claim 6.
Citation Information
Patent Citations
Chroma deviation and brightness deviation combined video moving object detection method
CN101098462A
Video processing method and device, equipment and storage medium
CN111294646A