Target detection method and device, electronic equipment and readable storage medium
Through the pre-trained offset detection model and the previous moment object detection box, the offset parameters of the current moment object detection box are determined, and the problems of high and complex steps of continuous object detection computing power in the prior art are solved, thus achieving high efficiency and simplicity object detection.
Patent Information
- Application Number
- CN202310787909.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
AI Technical Summary
The prior art has high computing power requirements in continuous object detection, resulting in limited application scenarios, and complex processes and many steps, making it difficult to achieve simple and efficient object detection.
Through the pre-trained offset detection model and the previous moment object detection box, determine the offset parameters of the current moment object detection box, including horizontal offset, vertical offset and target scaling, and adjust the position and size of the detection box to Achieve object detection.
It improves the efficiency of continuous object detection, reduces the use of computing resources, and realizes simple and fast object detection without complex model structures and steps.
Smart Images

Figure CN119229438A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a target detection method, device, electronic device and readable storage medium. Background Art
[0002] At present, in some scenarios that require continuous target detection (such as front vehicle collision warning or driver distraction detection), electronic devices are often required to periodically detect the location of the target. Moreover, most scenarios have high requirements for immediacy, which requires electronic devices to perform target detection at a higher frequency.
[0003] In the process of continuous target detection using related technologies, continuous target detection can only be performed through processes such as initialization of detection frame, motion model processing, feature extraction, observation model processing, model update processing and target prediction processing.
[0004] However, due to the complexity of the above process and the large number of steps, the related technology has high requirements for the computing power of continuous target detection, which in turn limits its application scenarios. In other words, how to perform continuous target detection simply and efficiently is a problem that needs to be solved urgently. Summary of the invention
[0005] In view of this, embodiments of the present application provide a target detection method, device, electronic device, and readable storage medium to improve the efficiency of continuous target detection and reduce the computing resources occupied by continuous target detection.
[0006] In a first aspect, a target detection method is provided, the method comprising:
[0007] Determine a current moment image and a previous moment target detection frame corresponding to the current moment image.
[0008] The detected target area identified by the target detection frame at the previous moment is input into a pre-trained offset detection model to determine the offset parameters corresponding to the detected target area, wherein the offset parameters at least include the horizontal offset and the vertical offset of the detected target area relative to the target detection frame at the previous moment.
[0009] At least the position of the target detection frame at the previous moment is adjusted according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment.
[0010] Output the target detection result according to the target detection frame at the current moment.
[0011] In some embodiments, the offset parameter also includes a target scaling amount of the detected target area relative to the target detection frame at the previous moment.
[0012] The step of at least adjusting the position of the target detection frame at the previous moment according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment comprises:
[0013] According to the horizontal offset, the vertical offset and the target scaling amount, the position and size of the target detection frame at the previous moment are adjusted to determine the target detection frame at the current moment.
[0014] In some embodiments, the method further comprises:
[0015] A target training set is obtained, wherein the target training set includes at least a sample image, a sample target detection frame of the sample image, and a random transformation detection frame, wherein the random transformation detection frame includes at least a position transformation detection frame.
[0016] Determine a position offset of the randomly transformed detection frame relative to the sample target detection frame.
[0017] The offset detection model is trained based on at least the area image divided by the random transformation detection frame and the position offset corresponding to the random transformation detection frame.
[0018] In some embodiments, the random change detection box also includes a size change detection box.
[0019] The method further comprises:
[0020] A sample scaling amount of the randomly transformed detection box relative to the sample target detection box is determined.
[0021] The offset detection model is trained based at least on the regional image divided by the random transformation detection frame and the sample scaling amount corresponding to the random transformation detection frame.
[0022] In some embodiments, said training said offset detection model comprises:
[0023] According to the size of the random transformation detection frame, the predetermined adjustment parameter and the adjustment factor, the position offset and the sample scaling amount are normalized and encoded to determine the normalized values corresponding to the position offset and the sample scaling amount.
[0024] The offset detection model is trained based on at least the area image divided by the random transformation detection frame and the normalized value.
[0025] In some embodiments, inputting the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model to determine the offset parameter corresponding to the detected target area includes:
[0026] The detected target area identified by the target detection frame at the previous moment is input into a pre-trained offset detection model, and an intermediate result output by the offset detection model is determined, where the intermediate result is a normalized value after normalization encoding.
[0027] According to the intermediate result, the predetermined adjustment parameter and the adjustment factor, the intermediate result is normalized and decoded to determine the offset parameter corresponding to the detected target area.
[0028] In some embodiments, the method further comprises:
[0029] In response to one or more of the horizontal offset, the vertical offset and the target scaling amount exceeding a predetermined range, target detection is performed on the current moment image to determine a current moment target detection frame corresponding to the current moment image.
[0030] In some embodiments, the offset detection model is a task network in a multi-task model.
[0031] In some embodiments, each of the task networks in the multi-task model corresponds to at least one predetermined task, and the predetermined tasks include at least a face detection task, a driver distraction state detection task, a driver fatigue state detection task, a driver dangerous action detection task, and a driver face occlusion detection task.
[0032] In a second aspect, a target detection device is provided, the device comprising:
[0033] The image determination module is configured to determine the current moment image and the previous moment target detection frame corresponding to the current moment image.
[0034] The offset detection module is configured to input the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model to determine the offset parameters corresponding to the detected target area, wherein the offset parameters at least include the horizontal offset and vertical offset of the detected target area relative to the target detection frame at the previous moment.
[0035] The adjustment module is configured to adjust at least the position of the target detection frame at the previous moment according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment.
[0036] The result output module is configured to output the target detection result according to the target detection frame at the current moment.
[0037] In some embodiments, the offset parameter also includes a target scaling amount of the detected target area relative to the target detection frame at the previous moment.
[0038] The adjustment module is specifically configured to execute:
[0039] According to the horizontal offset, the vertical offset and the target scaling amount, the position and size of the target detection frame at the previous moment are adjusted to determine the target detection frame at the current moment.
[0040] In some embodiments, the apparatus further comprises:
[0041] The target training set acquisition module is configured to execute the acquisition of the target training set, wherein the target training set at least includes a sample image, a sample target detection frame of the sample image, and a random transformation detection frame, and the random transformation detection frame at least includes a position transformation detection frame.
[0042] The position offset determination module is configured to determine the position offset of the randomly transformed detection frame relative to the sample target detection frame.
[0043] The training module is configured to execute training of the offset detection model based at least on the area image divided by the random transformation detection frame and the position offset corresponding to the random transformation detection frame.
[0044] In some embodiments, the random change detection box also includes a size change detection box.
[0045] The device also includes:
[0046] The sample scaling amount determination module is configured to determine the sample scaling amount of the random transformation detection frame relative to the sample target detection frame.
[0047] The training module is further configured to execute training of the offset detection model based at least on the area image divided by the random transformation detection frame and the sample scaling amount corresponding to the random transformation detection frame.
[0048] In some embodiments, the training module is specifically configured to perform:
[0049] According to the size of the random transformation detection frame, the predetermined adjustment parameter and the adjustment factor, the position offset and the sample scaling amount are normalized and encoded to determine the normalized values corresponding to the position offset and the sample scaling amount.
[0050] The offset detection model is trained based on at least the area image divided by the random transformation detection frame and the normalized value.
[0051] In some embodiments, the offset detection module is specifically configured to perform:
[0052] The detected target area identified by the target detection frame at the previous moment is input into a pre-trained offset detection model, and an intermediate result output by the offset detection model is determined, where the intermediate result is a normalized value after normalization encoding.
[0053] According to the intermediate result, the predetermined adjustment parameter and the adjustment factor, the intermediate result is normalized and decoded to determine the offset parameter corresponding to the detected target area.
[0054] In some embodiments, the apparatus further comprises:
[0055] The abnormality detection module is configured to perform target detection on the current moment image in response to one or more of the horizontal offset, the vertical offset and the target zoom amount exceeding a predetermined range to determine a current moment target detection frame corresponding to the current moment image.
[0056] In some embodiments, the offset detection model is a task network in a multi-task model.
[0057] In some embodiments, each of the task networks in the multi-task model corresponds to at least one predetermined task, and the predetermined tasks include at least a face detection task, a driver distraction state detection task, a driver fatigue state detection task, a driver dangerous action detection task, and a driver face occlusion detection task.
[0058] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method described in the first aspect.
[0059] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the method described in the first aspect is implemented.
[0060] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program / instructions, which, when executed by a processor, implement the method described in the first aspect.
[0061] After a target detection is performed and the target detection frame is determined, the embodiment of the present application can directly determine the offset parameters of the detected target area of the image at the current moment relative to the target detection frame at the previous moment based on the pre-trained offset detection model and the target detection frame at the previous moment. Furthermore, the embodiment of the present application can at least adjust the position of the target detection frame at the previous moment according to the offset parameters, determine the target detection frame at the current moment and output the target detection result. In other words, the embodiment of the present application can simply, quickly and efficiently determine the position of the target detection frame at the current moment by determining the offset parameters, without the need for complex model structures, processes and steps, while improving the efficiency of continuous target detection, it can also effectively reduce the computing resources occupied by continuous target detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The above and other purposes, features and advantages of the embodiments of the present application will become more apparent through the following description of the embodiments of the present application with reference to the accompanying drawings, in which:
[0063] Figure 1 A flow chart of a target detection method according to an embodiment of the present application;
[0064] Figure 2 A schematic diagram of a target detection frame according to an embodiment of the present application;
[0065] Figure 3 A schematic diagram of the offset parameters of an embodiment of the present application;
[0066] Figure 4 A schematic diagram of a target detection method according to an embodiment of the present application;
[0067] Figure 5 A schematic diagram of another offset parameter according to an embodiment of the present application;
[0068] Figure 6 A flowchart of another target detection method according to an embodiment of the present application;
[0069] Figure 7 A flowchart of another target detection method according to an embodiment of the present application;
[0070] Figure 8 A flowchart of another target detection method according to an embodiment of the present application;
[0071] Fig. 9 A flowchart of another target detection method according to an embodiment of the present application;
[0072] Fig.10 A schematic diagram of the structure of a multi-task model according to an embodiment of the present application;
[0073] Fig.11 A schematic diagram of the structure of a target detection device according to an embodiment of the present application;
[0074] Fig.12 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0075] The present application is described below based on embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, some specific details are described in detail. It is possible for those skilled in the art to fully understand the present application without the description of these details. In order to avoid confusing the essence of the present application, known methods, processes, flows, components and circuits are not described in detail.
[0076] In addition, persons of ordinary skill in the art will appreciate that the drawings provided herein are for illustration purposes and are not necessarily drawn to scale.
[0077] Unless the context clearly requires otherwise, the words "include", "comprising" and the like throughout this application should be interpreted as including rather than exclusive or exhaustive; that is, as meaning "including but not limited to".
[0078] In the description of this application, it should be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.
[0079] The solutions described in this specification and in the examples, if they involve the processing of personal information, will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or being necessary for the performance of a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.
[0080] At present, in some scenarios that require continuous target detection (such as front vehicle collision warning or driver distraction detection), electronic devices are often required to periodically detect the position of the target. Moreover, most scenarios have high requirements for immediacy, which requires electronic devices to perform target detection at a higher frequency. Taking the front vehicle collision warning as an example, the road conditions change rapidly during the driving process of the vehicle (especially in vehicle-dense areas). Therefore, the vehicle needs to capture the external environment in real time to detect possible dangers in the external environment based on the real-time video stream (i.e., target detection for the front vehicle). The higher the target detection frequency of the vehicle for the front vehicle, the better.
[0081] In one case, the related technology can perform target detection on each frame in the video stream. However, the video frames in the video stream have temporal and spatial correlations, and the feature extraction network between adjacent video frames will output redundant feature map information, resulting in a waste of computing resources. In response to this situation, a common improvement measure in the related technology is to reduce the detection frequency (for example, only detect 5 video frames per second) to reduce computing pressure. However, due to the reduced frequency of target detection, this method will cause instability in scenes where the target moves faster.
[0082] In view of the problems arising from the above situation, the relevant technology can also use target tracking to detect the target. Specifically, the relevant technology can first determine an initial detection frame, which can be used to identify the initial position of the detected target in a certain video frame. Further, the relevant technology can determine multiple candidate detection frames in the next frame of the video stream by means of a motion model, a particle filter and a sliding window, and perform feature extraction processing on each candidate detection frame to determine the features corresponding to each candidate detection frame. Further, the relevant technology can calculate the confidence score corresponding to each candidate detection frame through the observation model and the features corresponding to each candidate detection frame, and select the detection frame corresponding to the next frame from each candidate detection frame based on the confidence score, thereby realizing target tracking. In the above target tracking process, the relevant technology also needs to update the observation model in real time so that the observation model can adapt to changes in the target (such as the detected target is replaced or the detected target undergoes a morphological change).
[0083] That is to say, in the process of target tracking in the related technology, continuous target detection can be performed through the processes of initializing the detection frame, motion model processing, feature extraction, observation model processing, model update processing and target prediction processing. However, the related technology still has the following problems: In the first aspect, since the above process needs to use the motion model, feature extraction model and observation model at the same time, the related technology needs to use more training data to train each of the above models separately, making the model training process more complicated and unable to achieve end-to-end training. In the second aspect, since the above process flow is complicated and there are many steps, this leads to the high computing power requirements for continuous target detection in the related technology, which in turn leads to the limitation of its application scenarios. For example, the target tracking method of the related technology is difficult to apply to devices with less computing resources such as online car-hailing dedicated camera equipment. In the third aspect, since the above process flow is complicated and there are many steps, the time consumed by the related technology for target tracking is long, and then, when the moving speed of the detected target is fast, the related technology cannot achieve continuous target tracking. That is to say, when the detected target moves at a faster speed, since the relevant technology cannot achieve continuous target tracking, the relevant technology still needs to periodically intersperse target detection processing during the target tracking process, thereby further increasing the consumption of computing resources.
[0084] Therefore, how to perform continuous target detection simply and efficiently is a problem that needs to be solved urgently.
[0085] In order to solve the above problems, the embodiment of the present application provides a target detection method to achieve simple and efficient continuous target detection. Among them, the target detection method of the embodiment of the present application can be used for electronic devices, the electronic device can be a terminal or a server, the terminal can be a smart phone, a tablet computer, a vehicle control terminal, a camera device (such as a driving recorder or a camera device dedicated to online car-hailing) or a personal computer (Personal Computer, PC), etc., and the server can be a single server, a server cluster configured in a distributed manner, or a cloud server.
[0086] Specifically, Figure 1 As shown, the target detection method of the embodiment of the present application may include the following steps:
[0087] In step S110, the current moment image and the previous moment target detection frame corresponding to the current moment image are determined.
[0088] The target that is authorized to be photographed and detected in the embodiment of the present application can be determined according to the actual task. For example, if the target detection method in the embodiment of the present application is used for the front vehicle collision warning task, the target that is photographed and detected in the embodiment of the present application can be the vehicle in front. If the target detection method in the embodiment of the present application is used for the driver distraction state detection task, the target that is photographed and detected in the embodiment of the present application can be the driver driving the vehicle.
[0089] The current moment image is the image captured at the current moment, which can be directly captured by the camera unit set in the electronic device itself (such as the camera of a smartphone, the camera of a driving recorder, or the camera of a camera device dedicated to online car-hailing), or captured by a camera device external to the electronic device (wired connection or wireless connection). The last moment target detection frame is the target detection frame determined for the image captured at the last moment.
[0090] That is to say, since target tracking is to first acquire an image and then track the target in the image through a detection frame, the current moment image acquired at time t in the embodiment of the present application is the image taken at time t, and the previous moment target detection frame determined at time t in the embodiment of the present application is the target detection frame finally determined at time t-1 (that is, the previous target detection cycle).
[0091] Take face detection as an example. Figure 2 As shown, image 21 is an image captured by the embodiment of the present application at the previous moment, and detection frame 22 is a detection frame determined by the embodiment of the present application at the previous moment based on image 21 (i.e., the target detection frame at the previous moment). Further, image 23 is an image captured by the embodiment of the present application at the current moment (i.e., the image at the current moment). In other words, the embodiment of the present application needs to adjust the position of detection frame 22 (i.e., the target detection frame at the previous moment) according to image 23 (i.e., the image at the current moment) at the current moment, so that detection frame 22 tracks to the position of the face in image 23.
[0092] In step S120, the detected target area identified by the target detection frame at the previous moment is input into a pre-trained offset detection model to determine the offset parameters corresponding to the detected target area.
[0093] Among them, since the offset detection model of the embodiment of the present application is only used to output offset parameters, the embodiment of the present application can adopt a lightweight regression model built based on a fully connected network as the offset detection model to reduce the size of the model and thus reduce the amount of computing resources occupied.
[0094] In addition, the detected target area is the area marked by the target detection frame at the previous moment, and the offset parameters include at least the horizontal offset and vertical offset of the detected target area relative to the target detection frame at the previous moment. Taking face detection as an example, the offset parameters may at least include the horizontal offset and vertical offset of the center point of the face in the detected target area relative to the center point of the target detection frame at the previous moment. Taking vehicle detection as an example, the offset parameters may at least include the horizontal offset and vertical offset of the center point of the vehicle in the detected target area relative to the center point of the target detection frame at the previous moment. Among them, the horizontal offset and the vertical offset can be represented by the pixel distance between the center points.
[0095] Take face detection as an example. Figure 3 As shown, Figure 3 It includes the target detection frame 31 of the previous moment and the detected target area 32 marked by the target detection frame 31 of the previous moment, wherein the position point 33 is used to represent the center point of the face, and the position point 34 is used to represent the center point of the target detection frame 31 of the previous moment (that is, the center point of the detected target area 32).
[0096] Further, when the embodiment of the present application inputs the detected target area 32 into the pre-trained offset detection model, the offset detection model can determine the horizontal offset X and vertical offset Y of the position point 33 relative to the position point 34, wherein X and Y can be positive or negative numbers, and positive numbers are used to represent movement in the positive direction, and negative numbers are used to represent movement in the negative direction. Through the horizontal offset X and the vertical offset Y, the embodiment of the present application can adjust the position of the target detection frame 31 at the previous moment in the image at the current moment, so that the target detection frame 31 at the previous moment tracks to the position where the face is located.
[0097] In step S130, at least the position of the target detection frame at the previous moment is adjusted according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment.
[0098] Specifically, the embodiment of the present application can determine the target detection frame at the current moment by adjusting the position of the target detection frame at the previous moment so that the center point of the target detection frame at the previous moment coincides with the center point of the detected target (for example, the center point of a face or the center point of a vehicle, etc.), thereby ensuring that the target detection frame at the current moment can accurately identify the detected target.
[0099] In step S140, the target detection result is output according to the target detection frame at the current moment.
[0100] Among them, the target detection result can be a visual detection result. For example, the electronic device can display the video stream shot by the camera unit through its own settings or an external display unit, and display the target detection frame corresponding to each moment in each frame of the video stream (that is, the current moment target detection frame obtained by adjustment at each moment in the embodiment of the present application) for the user to view. The target detection result can also be a non-visual detection result. For example, after adjusting the position of the current moment target detection frame, the embodiment of the present application can use the area identified by the current moment target detection frame obtained after adjustment (that is, the accurate detected target area) as the target detection result, and directly or indirectly output it to other task networks, so that other task networks can perform further processing according to the target detection result. Among them, other task networks can be a network for judging the distance of the vehicle in front, a network for judging whether the driver is driving safely, and a network for judging whether the driver has dangerous driving actions, etc.
[0101] For example, Figure 4 As shown, the embodiment of the present application can continuously capture images through the image capture device 41 to form a video stream. When the image capture device 41 captures an image for the first time, the image capture device 41 can input the first captured image into the target detection model 42, so that the target detection model 42 performs target detection on the first captured image and determines an initial target detection frame.
[0102] After determining the initial target detection frame, the embodiment of the present application can use the image captured by the image acquisition device 41 in the subsequent process as the above-mentioned current moment image, and determine the detected target area 43 according to the target detection frame at the previous moment. Further, the embodiment of the present application can input the detected target area 43 into the offset detection model 44 so that the offset detection model 44 determines the offset parameter.
[0103] Furthermore, after determining the offset parameter, the embodiment of the present application can adjust the position of the target detection frame at the previous moment according to the offset parameter, determine the target detection frame at the current moment, and determine the target detection result according to the target detection frame at the current moment. Furthermore, the embodiment of the present application can directly output the target detection result for visualization on the one hand, and on the other hand, the embodiment of the present application can also output the target detection result to other task networks.
[0104] After a target detection is performed and the target detection frame is determined, the embodiment of the present application can directly determine the offset parameters of the detected target area of the image at the current moment relative to the target detection frame at the previous moment based on the pre-trained offset detection model and the target detection frame at the previous moment. Furthermore, the embodiment of the present application can at least adjust the position of the target detection frame at the previous moment according to the offset parameters, determine the target detection frame at the current moment and output the target detection result. In other words, the embodiment of the present application can simply, quickly and efficiently determine the position of the target detection frame at the current moment by determining the offset parameters, without the need for complex model structures, processes and steps, while improving the efficiency of continuous target detection, it can also effectively reduce the computing resources occupied by continuous target detection.
[0105] In an optional implementation, the offset parameter may also include a target scaling amount of the detected target area relative to the target detection frame at the previous moment, wherein the target scaling amount may be represented by pixels of the overall size scaling.
[0106] For example, Figure 5 As shown, Figure 5 It includes the target detection frame 51 at the previous moment and the target detection frame 52 at the current moment obtained by scaling the target detection frame 51 at the previous moment. Figure 5 It can be seen that the target scaling amount determined in the embodiment of the present application can be -L, where "-" is used to represent the reduction in size of the target detection frame 52 at the current moment relative to the target detection frame 51 at the previous moment (correspondingly, "+" is used to represent the enlargement in size), and "L" is used to represent the pixels scaled in the up, down, left and right directions of the target detection frame 52 at the current moment relative to the target detection frame 51 at the previous moment.
[0107] Specifically, the above step S130 may be performed as follows: adjusting the position and size of the target detection frame at the previous moment according to the horizontal offset, the vertical offset and the target scaling amount, and determining the target detection frame at the current moment.
[0108] Among them, the embodiment of the present application can first adjust the position of the target detection frame at the previous moment by the horizontal offset and the vertical offset, so that the center point of the target detection frame at the previous moment coincides with the center point of the detected target. Furthermore, the embodiment of the present application can adjust the size of the target detection frame at the previous moment by the target scaling amount, so that the size of the target detection frame at the previous moment matches the detected target, so as to determine the target detection frame at the current moment. Optionally, when performing target detection, the embodiment of the present application can adjust the target detection frame to a square detection frame to facilitate scaling adjustment.
[0109] Since the detected target is often not limited to two-dimensional plane movement, when the detected target approaches or moves away from the camera device, the detected target in the current moment image will be enlarged or reduced accordingly. At this time, the embodiment of the present application can determine the target scaling amount of the detected target area relative to the target detection frame at the previous moment through the offset detection model, and adjust the size of the target detection frame at the previous moment according to the target scaling amount, so that the target detection frame at the current moment can adapt to the size of the detected target, thereby improving the accuracy of target detection.
[0110] In one case, since the offset (horizontal offset and vertical offset) and the scaling amount belong to different types of regression parameters, the offset detection model of the embodiment of the present application can determine the horizontal offset and the vertical offset through the offset branch network, and determine the target scaling amount through the scaling branch network, so that each branch network can focus on learning the same type of regression parameters, thereby improving the accuracy of the offset parameters. In another case, the offset detection model of the embodiment of the present application can also determine the offset and scaling amount through the same branch network to further reduce the model volume and improve the efficiency of continuous target detection.
[0111] In an optional implementation, the present application embodiment may also train the offset detection model, specifically, Figure 6 As shown, the training process may include the following steps:
[0112] In step S210, a target training set is obtained.
[0113] The target training set includes at least a sample image, a sample target detection frame of the sample image, and a random transformation detection frame, and the random transformation detection frame includes at least a position transformation detection frame. In an optional case, the random transformation detection frame may also include a size transformation detection frame. The sample target detection frame is used to identify the actual area of the detected target in the sample image (i.e., the offset parameter corresponding to the sample target detection frame is 0).
[0114] In step S220, the position offset of the randomly transformed detection frame relative to the sample target detection frame is determined.
[0115] The position offset may be an offset parameter recorded when creating a target training set in an embodiment of the present application.
[0116] In step S230, an offset detection model is trained based on at least the area image divided by the random transformation detection frame and the position offset corresponding to the random transformation detection frame.
[0117] Specifically, the embodiment of the present application can input the regional image divided by the random transformation detection frame into the offset detection model to obtain the result output by the offset detection model. Furthermore, the embodiment of the present application can use the position offset corresponding to the random transformation detection frame as a training label, determine the loss corresponding to the random transformation detection frame, and train the offset detection model through the loss.
[0118] Since the offset detection model of the embodiment of the present application is only used to output the offset parameters of the detected target area relative to the target detection frame at the previous moment, the embodiment of the present application can achieve rapid enhancement of training samples by randomly transforming the sample target detection frame of the sample image and recording the corresponding offset parameters. This process does not require additional labeled data, simplifies the process of constructing the training set, and improves the efficiency of model training.
[0119] In an optional implementation, the random transformation detection frame may also include a size transformation detection frame. The sample scaling amount corresponding to the size transformation detection frame may be represented by the pixels of the overall size scaling (e.g. Figure 5 as shown).
[0120] like Figure 7 As shown, the above training process may also include the following steps:
[0121] In step S310, a sample scaling amount of the randomly transformed detection frame relative to the sample target detection frame is determined.
[0122] In step S320, an offset detection model is trained based on at least the regional image divided by the random transformation detection frame and the sample scaling amount corresponding to the random transformation detection frame.
[0123] Specifically, the embodiment of the present application can input the regional image divided by the random transformation detection frame into the offset detection model to obtain the result output by the offset detection model. Furthermore, the embodiment of the present application can use the sample scaling amount corresponding to the random transformation detection frame as a training label, determine the loss corresponding to the random transformation detection frame, and train the offset detection model through the loss.
[0124] It should be noted that if the embodiment of the present application determines the offset (horizontal offset and vertical offset) and the scaling amount respectively through two network branches (offset branch network and scaling branch network), then the embodiment of the present application can train the offset branch network and the scaling branch network respectively through the position offset and sample scaling amount to improve the training effect.
[0125] In an optional embodiment, if Figure 8 As shown, the above step S320 may include the following steps:
[0126] Step S321, performing normalized encoding on the position offset and the sample scaling amount according to the size of the randomly transformed detection frame, the predetermined adjustment parameters and the adjustment factors, and determining normalized values corresponding to the position offset and the sample scaling amount.
[0127] Among them, since the offset detection model of the embodiment of the present application is a regression model, the offset detection model can be trained by an absolute loss function (Smooth L1 Loss). The absolute loss function has a high correlation with the training label (i.e., the above-mentioned position offset or sample scaling amount), and the related technology generally uses an absolute value (i.e., the actual pixel distance) or a relative value (i.e., the absolute value is scaled according to the ratio of the image) as the training label.
[0128] Taking eyelid distance detection as an example, the target training set includes sample image A1 (image size is 320 pixels * 320 pixels, eyelid distance in the figure is 16 pixels) and sample image A2 (image size is 160 pixels * 160 pixels, eyelid distance in the figure is 16 pixels). During the training process, it is often necessary to resize each sample image to the same size. Taking 160 pixels * 160 pixels as an example, the image size of sample image A1 after resizing is 160 pixels * 160 pixels, and the eyelid distance in the figure is 8 pixels. The size of sample image A2 does not need to be resized.
[0129] In one case, if the absolute value is used as the training label, the training labels corresponding to sample image A1 and sample image A2 are both 16 pixels. However, since sample image A1 will be resized during training, the training label corresponding to sample image A1 is too large relative to the resized sample image A1, and the training label at this time is no longer applicable to the resized sample image A1. In other words, if the absolute value is used as the training label, it will affect the training effect to a certain extent.
[0130] In another case, if relative values are used as training labels, the training label corresponding to sample image A1 can be 16 pixels / 320 pixels=0.05, and the training label corresponding to sample image A2 can be 16 pixels / 160 pixels=0.1. By processing relative values, the problems caused by using absolute values as training labels can be avoided. However, it can be seen from the above process that using relative values as training labels will make the pixels of the training labels too small, and too small training labels will affect the convergence of the model to a certain extent, thereby affecting the training effect.
[0131] In order to avoid the problems caused by using absolute values or relative values as training labels, the embodiment of the present application can use a normalized encoding method to normalize the training labels and determine the normalized values. The process of normalizing the position offset can be represented by the following formula:
[0132] l norm =S*l abs / (h*0.8)
[0133] Among them, l norm Used to characterize the normalized value. S is the adjustment factor, and the normalized value finally determined in the embodiment of the present application will be mapped between -S and +S. abs is the size of the training label (in this case, the position offset). h is the height of the random transformation detection frame (i.e., the detected target area). 0.8 is a predetermined adjustment parameter. The adjustment parameter is a parameter used to limit the maximum offset, which can prevent the offset of the random transformation detection frame from being too large. For example, if the sample target detection frame is an area of 200 pixels * 200 pixels (i.e., h is 200 pixels), the maximum offset allowed by the embodiment of the present application (i.e., l abs The maximum value of () is 200 pixels * 0.8 = 160 pixels. That is to say, if the starting point of the horizontal coordinate of the sample target detection frame in the image is 726 pixels and the end point is 926 pixels (726 pixels + 200 pixels), then through the above adjustment parameter (0.8), the embodiment of the present application can determine that the starting point of the horizontal coordinate of the random transformation detection frame can be any random value from 566 pixels (726 pixels - 160 pixels) to 886 pixels (726 pixels + 160 pixels).
[0134] The process of normalizing and encoding the sample scaling can be expressed as follows:
[0135] l norm =S*l abs / ((h-2*l abs )*0.15))
[0136] Among them, l abs is the size of the training label (in this case, the sample scaling amount). 0.15 is a predetermined adjustment parameter. Similar to the above formula, 0.15 in this formula is a parameter used to limit the maximum scaling amount, which can avoid excessive scaling of the random transformation detection frame. For example, if the sample target detection frame is an area of 200 pixels * 200 pixels, then through the above adjustment parameter (0.15), the embodiment of the present application can determine the size of the random transformation detection frame to be any size from 170 pixels * 170 pixels to 230 pixels * 230 pixels.
[0137] It should be noted that the above predetermined adjustment parameters and adjustment factors can be adjusted according to actual conditions, and are not limited to the values given in the above examples.
[0138] Step S322, training an offset detection model based at least on the area image divided by the random transformation detection frame and the normalized value.
[0139] Specifically, the embodiment of the present application can input the regional image divided by the random transformation detection frame into the offset detection model to obtain the result output by the offset detection model. Furthermore, the embodiment of the present application can use the normalized value as a training label to determine the loss corresponding to the random transformation detection frame, and train the offset detection model through the loss.
[0140] The embodiment of the present application determines the normalized value so that the training labels of all training samples are mapped to a reasonable value range (i.e., the range determined by the above-mentioned adjustment factor), thereby avoiding the problems caused by unreasonable training label values and improving the training effect.
[0141] In an optional implementation, if the embodiment of the present application uses normalized encoding to train the offset detection model, the offset detection model will output a normalized encoded value during the inference process. At this time, when determining the offset parameters corresponding to the detected target area, the embodiment of the present application can add a normalized decoding process to determine the actual offset parameters. Specifically, Fig. 9 As shown, the above step S120 may include the following steps:
[0142] In step S121, the detected target area identified by the target detection frame at the previous moment is input into a pre-trained offset detection model to determine an intermediate result output by the offset detection model.
[0143] The intermediate result is a normalized value after normalization encoding, which may be a normalized value of a position offset (horizontal offset and vertical offset) or a normalized value of a target scaling amount.
[0144] In step S122, the intermediate result is normalized and decoded according to the intermediate result, the predetermined adjustment parameter and the adjustment factor, and the offset parameter corresponding to the detected target area is determined.
[0145] Among them, if the intermediate result is a normalized value of the position offset, the normalized decoding process can be represented by the following formula:
[0146] l abs = l pred *h*0.8 / S
[0147] Among them, l absis the offset parameter corresponding to the detected target area. pred is the intermediate result output by the offset detection model, that is, the predicted value output by the offset detection model. h is the height of the target detection frame at the previous moment, that is, the height of the detected target area. S is the adjustment factor, and 0.8 is a predetermined adjustment parameter.
[0148] If the intermediate result is the normalized value of the target scaling amount, the normalized decoding process can be expressed as the following formula:
[0149]
[0150] l abs =h*l mid / (1+2*l mid )
[0151] Among them, l mid For the embodiment of this application, pred The intermediate conversion result is determined, and 0.15 is a predetermined adjustment parameter.
[0152] The embodiment of the present application can map the training labels of all training samples to a reasonable numerical range (i.e., the range determined by the above adjustment factor) by determining the normalized numerical value, thereby avoiding the problems caused by the unreasonable numerical values of the above training labels and improving the training effect. Furthermore, in the process of determining the offset parameter (i.e., in the process of model inference), the embodiment of the present application can reversely decode the offset parameter by normalized decoding, thereby improving the accuracy of the offset parameter.
[0153] In an optional implementation, the embodiment of the present application may also execute: in response to one or more of the horizontal offset, the vertical offset and the target zoom amount exceeding a predetermined range, performing target detection on the current moment image to determine the current moment target detection frame corresponding to the current moment image.
[0154] Among them, the predetermined range can be set with appropriate pixel values according to the actual situation. That is to say, when the horizontal offset, vertical offset or target scaling is too large, the detected target may be lost or a new detected target may appear. At this time, the embodiment of the present application can re-detect the target to ensure the stability of the continuous target detection process. Similarly, in the above training process, if the training label (position offset and sample scaling) is too large, the embodiment of the present application can determine the training label as an abnormal label, and filter and delete the abnormal label, so as to ensure a good training effect.
[0155] In an optional implementation, the offset detection model is a task network in a multi-task model.
[0156] Among them, since the offset detection model of the embodiment of the present application is only used to output offset parameters, the offset detection model can adopt a lightweight model architecture. Furthermore, the embodiment of the present application can embed the offset detection model into any multi-task model, so that the offset detection model serves as a task network in the multi-task model.
[0157] For example, Fig.10 As shown, the multi-task model of an embodiment of the present application may include a target detection network 1001, an expansion and cropping network 1002, a main extraction network 1003, an offset detection model 1004 and multiple other task networks (task network 10051-task network 1005n, n is a natural number greater than or equal to 1).
[0158] Among them, the target detection network 1001 can be used to perform target detection tasks (such as face detection, vehicle detection and other tasks). The expansion and cropping network 1002 can be used to expand the cropping process to determine the expansion and cropping area image. For example, the embodiment of the present application can crop the detected target area into a square to determine the expansion and cropping area image. The main extraction network 1003 can be used to determine the shared feature map of the expanded cropping area image (i.e., the detected target area), which may include the image features required for multiple predetermined tasks (i.e., the offset detection model 1004 and each other task network), and the predetermined task may be each subtask under a total task. For example, the total task may be a driving safety detection task, and the predetermined task may be a face detection task under the driving safety detection task, a driver distraction state detection task, a driver fatigue state detection task, a driver dangerous action detection task, and a driver face occlusion detection task and other subtasks. For another example, the total task may also be an illegal parking vehicle detection task, and the predetermined task may be a vehicle detection task, a parking space detection task, and a vehicle state detection task and other subtasks under the illegal parking vehicle detection task.
[0159] Taking the online car-hailing service as an example, in order to ensure the driving safety of the driver (i.e., the online car-hailing driver), the online car-hailing service platform's dedicated camera equipment can collect the driver's image and input the driver's image as the target image into the multi-task model, so that after the multi-task model obtains the target image, it performs face detection on the target image through the target detection network 1001 to determine the face area image of the target image. Furthermore, the dedicated camera equipment for online car-hailing can perform expansion and cropping processing on the face area image based on the expansion and cropping network 1002 to determine the expansion and cropping area image. Among them, the expansion and cropping area image can include only the face area image, or it can include the face area image and the limb area image at the same time.
[0160] Furthermore, the online car-hailing dedicated camera device can input the expanded cropped area image into the main extraction network 1003, so that the main extraction network 1003 determines the shared feature map. Furthermore, the online car-hailing dedicated camera device can input the shared feature map into each task network (task network 10051-task network 1005n), so that each task network can extract and select the features it needs for processing.
[0161] In this process, the offset detection model 1004 of the embodiment of the present application can be embedded in the multi-task model as a task network. Whenever the offset detection model 1004 receives the current moment image, the offset detection model 1004 can directly determine the offset parameter of the detected target area of the current moment image relative to the target detection frame of the previous moment, so as to quickly determine the current moment target detection frame and output the target detection result. Among them, the target detection result can be output to the main extraction network 1003, so that the main extraction network 1003 determines an accurate shared feature map.
[0162] That is to say, since the offset detection model 1004 can simply, quickly and efficiently determine the target detection frame at the current moment, the embodiment of the present application embeds the offset detection model 1004 into the multi-task model related to target detection, which can effectively improve the processing efficiency and model performance of the multi-task model.
[0163] In addition, since the embodiment of the present application can perform a one-time feature extraction through the main extraction network 1003 to determine the shared feature map, and the task network corresponding to each predetermined task extracts and selects the features required by itself for processing, compared with the conventional method of setting up a detection model separately, the embodiment of the present application can effectively reduce the number of feature extractions (i.e., from n feature extractions to 1 feature extraction), and achieve the purpose of simply and efficiently executing each image processing task while meeting the accuracy requirements. In some scenarios, the computing pressure of small devices can also be reduced. For example, the multi-task model of the embodiment of the present application can reduce the computing pressure of the camera equipment dedicated to online car-hailing.
[0164] In an optional implementation, the predetermined tasks of the embodiment of the present application may include at least a face detection task, a driver distraction state detection task, a driver fatigue state detection task, a driver dangerous action detection task, and a driver face occlusion detection task.
[0165] Among them, the face detection task can be implemented by the offset detection model of the embodiment of the present application, so as to improve the efficiency of continuous target detection while effectively reducing the computing resources occupied by continuous target detection.
[0166] Through comprehensive detection of face detection tasks, driver distraction status detection tasks, driver fatigue status detection tasks, driver dangerous action detection tasks and driver face occlusion detection tasks, the embodiments of the present application can effectively determine whether the driver is in a safe driving state, thereby improving the driver's driving safety.
[0167] Based on the same technical concept, the embodiment of the present application also provides a target detection device, such as Fig.11 As shown, the device includes: an image determination module 1101, a deviation detection module 1102, an adjustment module 1103 and a result output module 1104.
[0168] The image determination module 1101 is configured to determine the current moment image and the previous moment target detection frame corresponding to the current moment image.
[0169] The offset detection module 1102 is configured to input the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model to determine the offset parameters corresponding to the detected target area, wherein the offset parameters at least include the horizontal offset and vertical offset of the detected target area relative to the target detection frame at the previous moment.
[0170] The adjustment module 1103 is configured to adjust at least the position of the target detection frame at the previous moment according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment.
[0171] The result output module 1104 is configured to output the target detection result according to the target detection frame at the current moment.
[0172] In some embodiments, the offset parameter also includes a target scaling amount of the detected target area relative to the target detection frame at the previous moment.
[0173] The adjustment module 1103 is specifically configured to execute:
[0174] According to the horizontal offset, the vertical offset and the target scaling amount, the position and size of the target detection frame at the previous moment are adjusted to determine the target detection frame at the current moment.
[0175] In some embodiments, the apparatus further comprises:
[0176] The target training set acquisition module is configured to execute the acquisition of the target training set, wherein the target training set at least includes a sample image, a sample target detection frame of the sample image, and a random transformation detection frame, and the random transformation detection frame at least includes a position transformation detection frame.
[0177] The position offset determination module is configured to determine the position offset of the randomly transformed detection frame relative to the sample target detection frame.
[0178] The training module is configured to execute training of the offset detection model based at least on the area image divided by the random transformation detection frame and the position offset corresponding to the random transformation detection frame.
[0179] In some embodiments, the random change detection box also includes a size change detection box.
[0180] The device also includes:
[0181] The sample scaling amount determination module is configured to determine the sample scaling amount of the random transformation detection frame relative to the sample target detection frame.
[0182] The training module is further configured to execute training of the offset detection model based at least on the area image divided by the random transformation detection frame and the sample scaling amount corresponding to the random transformation detection frame.
[0183] In some embodiments, the training module is specifically configured to perform:
[0184] According to the size of the random transformation detection frame, the predetermined adjustment parameter and the adjustment factor, the position offset and the sample scaling amount are normalized and encoded to determine the normalized values corresponding to the position offset and the sample scaling amount.
[0185] The offset detection model is trained based on at least the area image divided by the random transformation detection frame and the normalized value.
[0186] In some embodiments, the offset detection module 1102 is specifically configured to perform:
[0187] The detected target area identified by the target detection frame at the previous moment is input into a pre-trained offset detection model, and an intermediate result output by the offset detection model is determined, where the intermediate result is a normalized value after normalization encoding.
[0188] According to the intermediate result, the predetermined adjustment parameter and the adjustment factor, the intermediate result is normalized and decoded to determine the offset parameter corresponding to the detected target area.
[0189] In some embodiments, the apparatus further comprises:
[0190] The abnormality detection module is configured to perform target detection on the current moment image in response to one or more of the horizontal offset, the vertical offset and the target zoom amount exceeding a predetermined range to determine a current moment target detection frame corresponding to the current moment image.
[0191] In some embodiments, the offset detection model is a task network in a multi-task model.
[0192] In some embodiments, each of the task networks in the multi-task model corresponds to at least one predetermined task, and the predetermined tasks include at least a face detection task, a driver distraction state detection task, a driver fatigue state detection task, a driver dangerous action detection task, and a driver face occlusion detection task.
[0193] After a target detection is performed and the target detection frame is determined, the embodiment of the present application can directly determine the offset parameters of the detected target area of the image at the current moment relative to the target detection frame at the previous moment based on the pre-trained offset detection model and the target detection frame at the previous moment. Furthermore, the embodiment of the present application can at least adjust the position of the target detection frame at the previous moment according to the offset parameters, determine the target detection frame at the current moment and output the target detection result. In other words, the embodiment of the present application can simply, quickly and efficiently determine the position of the target detection frame at the current moment by determining the offset parameters, without the need for complex model structures, processes and steps, while improving the efficiency of continuous target detection, it can also effectively reduce the computing resources occupied by continuous target detection.
[0194] Fig.12 Schematic diagram of an electronic device according to an embodiment of the present application. Fig.12 As shown, Fig.12The electronic device shown is a general address query device, which includes a general computer hardware structure, which includes at least a processor 1201 and a memory 1202. The processor 1201 and the memory 1202 are connected via a bus 1203. The memory 1202 is suitable for storing instructions or programs executable by the processor 1201. The processor 1201 can be an independent microprocessor or a collection of one or more microprocessors. Thus, the processor 1201 executes the instructions stored in the memory 1202, thereby executing the method flow of the embodiment of the present application as described above to realize the processing of data and the control of other devices. The bus 1203 connects the above-mentioned multiple components together, and at the same time connects the above-mentioned components to the display controller 1204 and the display device and the input / output (I / O) device 1205. The input / output (I / O) device 1205 can be a mouse, a keyboard, a modem, a network interface, a touch input device, a somatosensory input device, a printer, and other devices known in the art. Typically, the input / output device 1205 is connected to the system through an input / output (I / O) controller 1206.
[0195] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices (equipment) or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may adopt a computer program product implemented on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0196] The present application is described with reference to flowcharts of methods, apparatuses (devices) and computer program products according to embodiments of the present application. It should be understood that each process in the flowchart can be implemented by computer program instructions.
[0197] These computer program instructions may be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device that implements the process Figure 1 A function specified in a process or multiple processes.
[0198] These computer program instructions may also be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce the instructions for implementing the process Figure 1 A device that specifies functions in a process or multiple processes.
[0199] Another embodiment of the present application relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used for a computer to execute part or all of the above method embodiments.
[0200] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by specifying relevant hardware through a program, and the program is stored in a storage medium, including several instructions for a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0201] Another embodiment of the present application relates to a computer program product, including a computer program / instruction, which can implement part or all of the above method embodiments when the computer program / instruction is executed by a processor.
[0202] That is, those skilled in the art can understand that the embodiments of the present application can specify relevant hardware (including the processor itself) through the processor executing a computer program product (computer program / instructions), thereby implementing all or part of the steps in the above-mentioned embodiment method.
[0203] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A target detection method, characterized in that: The method comprises: Determine a current moment image and a previous moment target detection frame corresponding to the current moment image; Inputting the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model to determine an offset parameter corresponding to the detected target area, wherein the offset parameter at least includes a horizontal offset and a vertical offset of the detected target area relative to the target detection frame at the previous moment; At least adjusting the position of the target detection frame at the previous moment according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment; Output the target detection result according to the target detection frame at the current moment.
2. The method according to claim 1, characterized in that The offset parameter also includes a target scaling amount of the detected target area relative to the target detection frame at the previous moment; The step of at least adjusting the position of the target detection frame at the previous moment according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment comprises: According to the horizontal offset, the vertical offset and the target scaling amount, the position and size of the target detection frame at the previous moment are adjusted to determine the target detection frame at the current moment.
3. The method according to claim 1, characterized in that The method further comprises: Acquire a target training set, wherein the target training set at least includes a sample image, a sample target detection frame of the sample image, and a random transformation detection frame, wherein the random transformation detection frame at least includes a position transformation detection frame; Determining a position offset of the randomly transformed detection frame relative to the sample target detection frame; The offset detection model is trained based on at least the area image divided by the random transformation detection frame and the position offset corresponding to the random transformation detection frame.
4. The method according to claim 3, characterized in that The random transformation detection frame also includes a size transformation detection frame; The method further comprises: Determining a sample scaling amount of the randomly transformed detection frame relative to the sample target detection frame; The offset detection model is trained based at least on the regional image divided by the random transformation detection frame and the sample scaling amount corresponding to the random transformation detection frame.
5. The method according to claim 4, characterized in that The training of the offset detection model comprises: According to the size of the random transformation detection frame, the predetermined adjustment parameter and the adjustment factor, the position offset and the sample scaling amount are normalized and encoded to determine normalized values corresponding to the position offset and the sample scaling amount; The offset detection model is trained based on at least the area image divided by the random transformation detection frame and the normalized value.
6. The method according to claim 1, characterized in that The step of inputting the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model to determine the offset parameter corresponding to the detected target area comprises: Inputting the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model, and determining an intermediate result output by the offset detection model, wherein the intermediate result is a normalized value after normalization encoding; According to the intermediate result, the predetermined adjustment parameter and the adjustment factor, the intermediate result is normalized and decoded to determine the offset parameter corresponding to the detected target area.
7. The method according to claim 2, characterized in that The method further comprises: In response to one or more of the horizontal offset, the vertical offset and the target scaling amount exceeding a predetermined range, target detection is performed on the current moment image to determine a current moment target detection frame corresponding to the current moment image.
8. The method according to claim 1, characterized in that The offset detection model is a task network in a multi-task model.
9. The method according to claim 8, characterized in that Each of the task networks in the multi-task model corresponds to at least one predetermined task, and the predetermined tasks include at least a face detection task, a driver distraction state detection task, a driver fatigue state detection task, a driver dangerous action detection task, and a driver face occlusion detection task.
10. A target detection device, characterized in that: The device comprises: An image determination module is configured to determine a current moment image and a target detection frame at a previous moment corresponding to the current moment image; an offset detection module, configured to input the detected target area identified by the target detection frame at the previous moment into a pre-trained offset detection model, and determine an offset parameter corresponding to the detected target area, wherein the offset parameter at least includes a horizontal offset and a vertical offset of the detected target area relative to the target detection frame at the previous moment; An adjustment module is configured to adjust at least the position of the target detection frame at the previous moment according to the horizontal offset and the vertical offset to determine the target detection frame at the current moment; The result output module is configured to output the target detection result according to the target detection frame at the current moment.
11. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.
13. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Cited By
Image structure dynamic labeling method and system based on artificial intelligence
CN120783343A
