Illegal driving posture detection method, device, medium and electronic equipment
Through the feature extraction model of DarkNet neural network model and Attention model, combined with pre-trained detection frames, the problem of low accuracy in detecting driver's illegal driving posture in difficult scenarios in the existing technology is solved, and higher detection accuracy is achieved. and recall rate.
Patent Information
- Application Number
- CN202011003091.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-22
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-09-22
AI Technical Summary
Existing technology has low accuracy in detecting drivers' illegal driving postures in difficult scenarios such as haze, rainy days, nighttime, and obstructions, and it is difficult to effectively detect drivers' illegal driving behaviors.
The feature extraction model of the DarkNet neural network model and the Attention model is used to extract features from the target image, and a feature map of at least one scale is obtained, which is combined with the pre-trained detection frame to detect whether the driver has illegal driving behavior.
It improves the accuracy and recall rate of driver illegal driving posture detection in difficult scenes such as haze, rainy days, night, and obstruction, ensuring the integrity and extraction quality of image feature information.
Smart Images

Figure CN112132015B
Abstract
Description
Background Art
[0002] At present, drivers' illegal driving behavior is one of the important reasons for the frequent occurrence of traffic accidents. With the increasing number of drivers' illegal driving behaviors, automatic detection of drivers' illegal driving behaviors becomes particularly important. To a certain extent, the driver's illegal driving behavior can be detected by detecting the driver's driving posture.
[0003] In the existing technology, the detection algorithm for the driver's driving posture in the image can achieve real-time detection with a high accuracy in simple scenes such as sunny days, daytime, and unobstructed conditions. However, in difficult scenes such as haze, rainy days, nighttime, and obstructions, the detection accuracy is still relatively low.
[0004] Based on this, how to improve the accuracy of detecting the driver's illegal driving posture is a technical problem that needs to be solved urgently. Summary of the invention
[0005] The purpose of this application is to provide a method and device for detecting illegal driving posture, a computer-readable storage medium, and an electronic device, so as to improve the accuracy of detecting the driver's illegal driving posture.
[0006] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0007] According to one aspect of an embodiment of the present application, a method for detecting an illegal driving posture is provided, the method comprising: determining a target image, the target image including the driving posture of a driver; based on the target image, performing feature extraction on the target image through a pre-built feature extraction model to obtain a feature map of at least one scale, the feature extraction model comprising a DarkNet neural network model and an Attention model; based on the feature map, detecting whether the driver has an illegal driving behavior through a pre-trained detection frame.
[0008] According to one aspect of an embodiment of the present application, a device for detecting an illegal driving posture is provided, the device comprising: a determination unit, used to determine a target image, the target image including the driving posture of the driver; an extraction unit, used to extract features from the target image based on the target image through a pre-built feature extraction model to obtain a feature map of at least one scale, the feature extraction model comprising a DarkNet neural network model and an Attention model; a detection unit, used to detect whether the driver has an illegal driving behavior through a pre-trained detection frame based on the feature map.
[0009] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. The computer program includes executable instructions. When the executable instructions are executed by a processor, the method for detecting illegal driving posture as described in the above embodiment is implemented.
[0010] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; and a memory for storing executable instructions of the processors, wherein when the executable instructions are executed by the one or more processors, the one or more processors implement the method for detecting illegal driving postures as described in the above embodiments.
[0011] In the technical solutions of some embodiments of the present application, the driving posture of the driver in the target image is feature extracted by a feature extraction model including a DarkNet neural network model and an Attention model to obtain a feature map of at least one scale, which can ensure the integrity and recall rate of the extracted image feature information in the target image. Therefore, by detecting the feature map through a pre-trained detection frame, the accuracy of detecting the driver's illegal driving posture can be improved.
[0012] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The above and other features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
[0014] Figure 1 A schematic diagram showing an application scenario of a method for detecting an illegal driving posture according to an embodiment of the present application is shown;
[0015] Figure 2 A flow chart of a method for detecting an illegal driving posture according to an embodiment of the present application is shown;
[0016] Figure 3 A detailed flow chart of determining a target image according to an embodiment of the present application is shown;
[0017] Figure 4 A detailed flow chart showing feature extraction of the target image by using a pre-built feature extraction model according to an embodiment of the present application is shown;
[0018] Figure 5 A schematic diagram of a DarkNet neural network model according to an embodiment of the present application is shown;
[0019] Figure 6A schematic diagram of a framework of an Attention model according to an embodiment of the present application is shown;
[0020] Figure 7 A detailed flow chart showing determining a feature map of at least one scale based on a first image feature and a second image feature according to an embodiment of the present application is shown;
[0021] Figure 8 A detailed flow chart of detecting whether the driver has illegal driving behavior through a pre-trained detection frame according to an embodiment of the present application is shown;
[0022] Fig. 9 A detailed flow chart of training detection frames according to an embodiment of the present application is shown;
[0023] Fig.10 A block diagram of a device for detecting an illegal driving posture according to an embodiment of the present application is shown;
[0024] Fig.11 A computer-readable storage medium for implementing a method for detecting an illegal driving posture according to an embodiment of the present application is shown;
[0025] Fig.12 An example block diagram of an electronic device for implementing a method for detecting illegal driving posture according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0026] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0027] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0028] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0029] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0030] It should also be noted that the terms "first", "second", etc. in the specification and claims 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 sequence. It should be understood that the objects used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those shown or described.
[0031] First, this application briefly describes the application scenarios of the illegal driving posture detection method.
[0032] In one embodiment of the present application, the detection method of the illegal driving posture can be implemented as follows: Figure 1 In the scenario shown, refer to Figure 1 , shows a schematic diagram of an application scenario of a method for detecting illegal driving posture according to an embodiment of the present application.
[0033] First of all, it should be noted that the method for detecting illegal driving posture can be implemented based on the server 104 as shown in the figure. Of course, the server as shown in the figure can also be replaced by an electronic device with a touch screen such as a tablet computer or a laptop computer.
[0034] In addition, the detection method of illegal driving posture can also be executed by a cloud server with cloud computing function. Specifically, cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, and expanded at any time. By establishing a cloud computing resource pool (referred to as a cloud platform, generally referred to as an IaaS (Infrastructure as a Service) platform, various types of virtual resources are deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0035] In such Figure 1In the example scenario, the driver drives the vehicle 101 on the road, and the monitoring device 102 is used to record or photograph the driving posture of the driver in the vehicle 101, and send the recorded or photographed image file to the server 104. The server 104 detects whether the driver in the vehicle 101 has any illegal driving behavior (illegal driving posture) based on the received image file by executing the illegal driving posture detection method provided in this application.
[0036] In the present application, the driver's illegal driving behaviors include answering calls, playing with mobile phones, and dozing off, and illegal driving behaviors can be reflected by illegal driving postures. Therefore, it is possible to detect whether the driver has illegal driving behaviors by detecting whether the driver has illegal driving postures.
[0037] The following will be combined Figure 2 The implementation details of the technical solution of the method for detecting illegal driving posture in the embodiment of the present application are elaborated in detail:
[0038] See also Figure 2 , shows a flow chart of detecting a driving violation posture according to an embodiment of the present application. The detection method of the driving violation posture can be executed by a physical device or a virtual device with a computing and processing function. Figure 2 As shown, the method for detecting the illegal driving posture at least includes steps 210 to 250:
[0039] In step 210 , a target image is determined, wherein the target image includes the driving posture of the driver.
[0040] In one embodiment of the present application, determining the target image may be performed according to the steps shown in the figure.
[0041] See also Figure 3 , shows a detailed flow chart of determining a target image according to an embodiment of the present application. Specifically, steps 211 to 212 are included:
[0042] Step 211, obtaining an original image, wherein the original image includes the driving posture of the driver.
[0043] In the present application, the original image may refer to a surveillance photo including a driver, for example, the surveillance photo may be obtained by intercepting an image in a surveillance video stream.
[0044] Step 212, respectively adjusting the number of horizontal pixels in the horizontal direction and the number of vertical pixels in the vertical direction of the original image to predetermined values to obtain a target image, wherein the number of horizontal pixels is equal to the number of vertical pixels.
[0045] In the present application, when adjusting the number of pixels in the horizontal direction and the number of pixels in the vertical direction of the original image, the number of pixels in the horizontal direction and the number of pixels in the vertical direction need to be kept equal, and the number of pixels in the horizontal direction and the number of pixels in the vertical direction both need to satisfy 2 to the power of n (n is a positive integer), for example, the number of pixels of the adjusted target image can be 512×512, 256×256, or 1024×1024. This is done to perform convolution processing on the target image in the subsequent processing process.
[0046] Continue to refer to Figure 2 In step 230, based on the target image, feature extraction is performed on the target image through a pre-built feature extraction model to obtain a feature map of at least one scale, and the feature extraction model includes a DarkNet neural network model and an Attention model.
[0047] Specifically, the target image is subjected to feature extraction through a pre-built feature extraction model to obtain a feature map of at least one scale, which can be performed as follows: Figure 4 The steps described are performed.
[0048] See also Figure 4 , shows a detailed flow chart of extracting features of the target image using a pre-built feature extraction model according to an embodiment of the present application. Specifically, steps 231 to 233 are included:
[0049] Step 231, input the target image into the DarkNet neural network model to output a first image feature.
[0050] See also Figure 5 , shows a framework schematic diagram of a DarkNet neural network model according to an embodiment of the present application.
[0051] like Figure 5 As shown, the backbone network of the DarkNet neural network model 500 uses 6 CresX structural components 510, where X represents a number, specifically including Cres2, Cres4, Cres8, Cres8, Cres4, Cres2, etc. The DarkNet neural network model 500 has a residual structure, that is, in the Dark Net neural network model 500, it is mainly composed of residual units stacked together. Using this structure can make the network structure deeper.
[0052] Further, in Figure 5In the example, CBM component 511 is a basic component of the DarkNet neural network model. A CBM component 511 consists of a convolutional layer followed by batch normalization (BN) and a Mish activation function (or a Leaky ReLU activation function). In the present application, as the layer depth increases, the Mish activation function has the advantage of improving training stability, average accuracy, peak accuracy, and other aspects in an all-round way.
[0053] In this application, the DarkNet neural network model 500 can significantly enhance the feature expression capabilities in difficult scenarios such as haze, rainy days, nighttime, and occlusion, thereby improving the overall accuracy and recall rate of detecting drivers' illegal driving postures.
[0054] Step 232: input the first image feature into the Attention model to output a second image feature.
[0055] See also Figure 6 , showing a framework diagram of an Attention model according to an embodiment of the present application.
[0056] Specifically, Figure 6 As shown, the first image feature (matrix) output by the DarkNet neural network model 500 is input into the Attention model 600, and specifically undergoes global average pooling, full connection + Relu activation function, 1×1 convolution + Sigmoid activation function, and multiplication of two matrices to obtain the second image feature.
[0057] For example, assuming that the input matrix size is 4×32×32×75, the matrix size obtained after global average pooling is 4×75, and then the matrix size obtained by performing full connection + Relu activation function is still 4×75, and then performing 1×1 convolution + Sigmoid activation function to obtain a matrix of size 4×75, and finally multiplying the matrix 4×32×32×75 and the matrix 4×75 to obtain the final output matrix of size 4×32×32×75, that is, the second image feature.
[0058] In the present application, the Attention model 600 enables the model to focus on the driver area to extract more detailed features, greatly improving the overall quality of the extracted features, thereby improving the overall accuracy and recall rate of detecting the driver's illegal driving posture.
[0059] Step 233: Determine a feature map of at least one scale based on the first image feature and the second image feature.
[0060] In a specific implementation of this embodiment, based on the first image feature and the second image feature, determining at least one scale feature map may be performed as follows: Figure 7 Follow the steps shown.
[0061] See also Figure 7 , shows a detailed flow chart of determining at least one scale feature map based on the first image feature and the second image feature according to an embodiment of the present application. Specifically, steps 2331 to 2333 are included:
[0062] Step 2331: Perform convolution processing on the second image feature seven times in succession to obtain a first scale feature map.
[0063] Step 2332: perform convolution processing on the second image feature for six consecutive times to obtain a third image feature; perform downsampling processing on the third image feature to obtain a fourth image feature; perform residual connection processing on the first image feature and the fourth image feature to obtain a fifth image feature; perform convolution processing on the fifth image feature for seven consecutive times to obtain a second scale feature map.
[0064] Step 2333: perform convolution processing on the fifth image feature for six consecutive times to obtain a sixth image feature; perform downsampling processing on the sixth image feature to obtain a seventh image feature; perform residual connection processing on the first image feature and the seventh image feature to obtain an eighth image feature; perform convolution processing on the eighth image feature for seven consecutive times to obtain a third scale feature map.
[0065] It can be seen that in the present application, based on the first image features and the second image features, 3×3 convolution + batch normalization + Mish activation function, 1×1 convolution, downsampling processing, residual connection and other operation steps are performed multiple times to obtain a feature map of at least one scale, for example, three feature maps y1, y2, and y3 of different scales are obtained.
[0066] Continue to refer to Figure 2 In step 250, based on the feature map, a pre-trained detection frame is used to detect whether the driver has any illegal driving behavior.
[0067] In one embodiment of the present application, the detection of whether the driver has illegal driving behavior by using the pre-trained detection frame can be performed as follows: Figure 8 Follow the steps shown.
[0068] See also Figure 8 , shows a detailed flow chart of detecting whether the driver has illegal driving behavior through a pre-trained detection frame according to an embodiment of the present application. Specifically including steps 251 to 252:
[0069] Step 251, traverse each area of the feature map through the pre-trained detection frame, wherein, for each area, determine a confidence level for characterizing that the driver has illegal driving behavior.
[0070] Step 252: Determine whether the driver has any illegal driving behavior based on the confidence level.
[0071] Specifically, in the present application, when the confidence level exceeds a second predetermined threshold, it may be determined that the driver has engaged in illegal driving behavior.
[0072] In this application, the position of the driver can be detected on the feature map by a pre-trained detection frame. Then, the driver's driving posture is classified as a violation posture (binary classification), for example, the driver has a violation posture of making a phone call or the driver does not have a violation posture of making a phone call.
[0073] For details, please refer to the following formula:
[0074] L conf (o,c)=-∑(o i ln(Sigmoid(c i ))+(1-o i )ln(1-Sigmoid(c i )))
[0075] When detecting the position of the driver on the feature map through the detection box, the probability of the driver existing in the detection box can be first predicted by the target confidence. The target confidence loss L conf (o,c), using binary cross entropy loss, where o i ∈(0,1), indicating whether there is a real driver in the detection box i, 0 means no driver, 1 means yes driver. Sigmoid(c i ) represents the Sigmoid probability of whether there is a driver in the detection box i (the predicted value c i obtained through the Sigmoid function).
[0076] For further information, please refer to the following formula:
[0077]
[0078] According to the above formula, the target category loss can be used to detect whether the driver has a certain illegal driving posture (for example, the driver has a phone call posture). The target category loss L cla (o,c) also uses binary cross entropy loss, where o ij ∈(0,1), indicating whether the j-th illegal driving posture actually exists in the detection box i, 0 means no illegal driving posture exists, and 1 means illegal driving posture exists.ij ) represents the Sigmoid probability of the jth illegal driving posture in the detection box i (the predicted value c ij obtained through the Sigmoid function).
[0079] In the present application, the detection frame in step 251 can be as follows: Fig. 9 The steps shown are:
[0080] See also Fig. 9 , shows a detailed flow chart of training detection frames according to an embodiment of the present application. Specifically, it includes steps 2511 to 2514:
[0081] Step 2511, marking a reference frame determined by the driver's illegal driving posture on the auxiliary feature map used to train the detection frame.
[0082] Step 2512, obtain a priori box of at least one shape by clustering through the Kmeans++ algorithm.
[0083] Step 2513, for each shape of the prior frame, traverse each area of the auxiliary feature map, wherein, for each area, obtain the intersection-and-union ratio of the prior frame and the reference frame.
[0084] Step 2514: when the intersection-over-union ratio exceeds a first predetermined threshold, the priori box is determined as a detection box.
[0085] It should be noted that the intersection-union ratio refers to the ratio of the area intersection to the area union between the prior frame and the reference frame.
[0086] In the present application, by clustering the Kmeans++ algorithm to obtain a priori frame of at least one shape, the generation quality of the priori frame can be improved, thereby improving the positioning accuracy of the detection frame, and further improving the overall accuracy and recall rate of detecting the driver's illegal driving posture.
[0087] To summarize, in the technical solutions of some embodiments of the present application, the driving posture of the driver in the target image is feature extracted by a feature extraction model including a DarkNet neural network model and an Attention model to obtain a feature map of at least one scale, which can ensure the integrity and recall rate of the extracted image feature information in the target image. Therefore, by detecting the feature map through a pre-trained detection frame, the accuracy of detecting the driver's illegal driving posture can be improved.
[0088] The following describes an embodiment of the device of the present application, which can be used to execute the detection method of the illegal driving posture in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the detection method of the illegal driving posture in the above embodiment of the present application.
[0089] Fig.10 A block diagram of a device for detecting illegal driving posture according to an embodiment of the present application is shown.
[0090] Reference Fig.10 As shown, according to an embodiment of the present application, a device 1000 for detecting illegal driving posture includes: a determination unit 1001, an extraction unit 1002 and a detection unit 1003.
[0091] Among them, the determination unit 1001 is used to determine the target image, which includes the driver's driving posture; the extraction unit 1002 is used to extract features from the target image based on the target image through a pre-built feature extraction model to obtain a feature map of at least one scale, and the feature extraction model includes a DarkNet neural network model and an Attention model; the detection unit 1003 is used to detect whether the driver has illegal driving behavior based on the feature map through a pre-trained detection frame.
[0092] In some embodiments of the present application, based on the aforementioned scheme, the determination unit 1001 includes: an acquisition unit, used to acquire an original image, wherein the original image includes the driver's driving posture; an adjustment unit, used to adjust the number of horizontal pixels in the horizontal direction and the number of vertical pixels in the vertical direction of the original image to predetermined values, respectively, to obtain a target image, wherein the number of horizontal pixels and the number of vertical pixels are equal.
[0093] In some embodiments of the present application, based on the aforementioned scheme, the extraction unit 1002 is configured to: input the target image into the DarkNet neural network model to output a first image feature; input the first image feature into the Attention model to output a second image feature; and determine a feature map of at least one scale based on the first image feature and the second image feature.
[0094] In some embodiments of the present application, based on the aforementioned scheme, the extraction unit 1002 is configured to: perform convolution processing on the second image feature for 7 consecutive times to obtain a first scale feature map; perform convolution processing on the second image feature for 6 consecutive times to obtain a third image feature; downsample the third image feature to obtain a fourth image feature; perform residual connection processing on the first image feature and the fourth image feature to obtain a fifth image feature; perform convolution processing on the fifth image feature for 7 consecutive times to obtain a second scale feature map; perform convolution processing on the fifth image feature for 6 consecutive times to obtain a sixth image feature; downsample the sixth image feature to obtain a seventh image feature; perform residual connection processing on the first image feature and the seventh image feature to obtain an eighth image feature; perform convolution processing on the eighth image feature for 7 consecutive times to obtain a third scale feature map.
[0095] In some embodiments of the present application, based on the aforementioned scheme, the detection unit 1003 is configured to: traverse each area of the feature map through a pre-trained detection frame, wherein, for each area, determine a confidence level for characterizing that the driver has engaged in illegal driving behavior; and determine whether the driver has engaged in illegal driving behavior based on the confidence level.
[0096] In some embodiments of the present application, based on the aforementioned solution, the detection unit 1003 is configured to: when the confidence level exceeds a first predetermined threshold, determine that the driver has engaged in illegal driving behavior.
[0097] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a training unit, which is used to: mark a reference frame determined by the driver's illegal driving posture on the auxiliary feature map used to train the detection frame; obtain a priori frame of at least one shape by clustering through the Kmeans++ algorithm; for each shape of the prior frame, traverse each area of the auxiliary feature map, wherein, for each area, obtain the intersection-and-union ratio of the prior frame and the reference frame; when the intersection-and-union ratio exceeds a second predetermined threshold, determine the prior frame as the detection frame.
[0098] It should be noted that although several units of the detection method of illegal driving posture and the detection device of illegal driving posture are mentioned in the above detailed description, this division is not mandatory. In fact, according to the implementation mode of the present application, two or more units and functions described above can be concretized in one unit. Conversely, the features and functions of a unit described above can be further divided into multiple units for concretization. The components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present application scheme. Those of ordinary skill in the art can understand and implement it without paying creative work.
[0099] As another aspect, the present application further provides a computer-readable storage medium on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present application may also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary implementations of the present application described in the above "Exemplary Method" section of the present specification.
[0100] refer to Fig.11 As shown, a program product 1100 for implementing the above method according to an embodiment of the present application is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0101] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0102] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0103] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0104] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0105] As another aspect, the present application also provides an electronic device capable of implementing the above method.
[0106] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.
[0107] Refer to the following Fig.12 1200 according to this embodiment of the present application is described. Fig.12 The electronic device 1200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0108] like Fig.12As shown, the electronic device 1200 is in the form of a general computing device. The components of the electronic device 1200 may include but are not limited to: at least one processing unit 1210, at least one storage unit 1220, and a bus 1230 connecting different system components (including the storage unit 1220 and the processing unit 1210).
[0109] The storage unit stores program code, which can be executed by the processing unit 1210, so that the processing unit 1210 executes the steps described in the above "Example Method" section of this specification according to various exemplary embodiments of the present application.
[0110] The storage unit 1220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 1221 and / or a cache memory unit 1222 , and may further include a read-only memory unit (ROM) 1223 .
[0111] The storage unit 1220 may also include a program / utility 1224 having a set (at least one) of program modules 1225, such program modules 1225 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0112] Bus 1230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0113] The electronic device 1200 may also communicate with one or more external devices 1200 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1200, and / or communicate with any device that enables the electronic device 1200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1250. Furthermore, the electronic device 1200 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1260. As shown, the network adapter 1260 communicates with other modules of the electronic device 1200 via a bus 1230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0114] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.
[0115] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0116] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be performed without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for detecting illegal driving posture, It is characterized in that The method comprises: Determining a target image, wherein the target image includes a driving posture of a driver; Input the target image into a DarkNet neural network model to output a first image feature, wherein the DarkNet neural network model includes 6 CresX structural components, each CresX structural component has a residual structure, and is composed of X structures of a CBM component followed by a CBM component and a SUM, wherein a CBM component is composed of a convolutional layer followed by a batch normalization and an activation function, and the DarkNet neural network model is used to enhance the feature expression capability of the image in haze, rainy days, nighttime, and occluded scenes; The first image feature is input into the Attention model, and the first image feature is connected with the residual of the first image feature after global average pooling, full connection + Relu activation function, 1×1 convolution + Sigmoid activation function to output a second image feature; Performing convolution processing on the second image feature seven times in succession to obtain a first scale feature map; The second image feature is subjected to six consecutive convolution processes to obtain a third image feature; the third image feature is subjected to downsampling processing to obtain a fourth image feature; the first image feature and the fourth image feature are subjected to residual connection processing to obtain a fifth image feature; the fifth image feature is subjected to seven consecutive convolution processes to obtain a second scale feature map; Performing convolution processing on the fifth image feature for six consecutive times to obtain a sixth image feature; performing downsampling processing on the sixth image feature to obtain a seventh image feature; performing residual connection processing on the first image feature and the seventh image feature to obtain an eighth image feature; performing convolution processing on the eighth image feature for seven consecutive times to obtain a third scale feature map; According to the feature map, traverse each area of the feature map through a pre-trained detection frame, and determine a confidence level for characterizing that the driver has illegal driving behavior for each area, the feature map including the first scale feature map, the second scale feature map and the third scale feature map; When the confidence level exceeds a first predetermined threshold, determining that the driver has illegal driving behavior; The pre-trained detection frame traverses each area of the feature map, and for each area, determines a confidence level for characterizing that the driver has illegal driving behavior, including: Detecting the position of the driver on the feature map through the detection frame, and classifying whether the driving posture of the driver is an illegal posture; When the position of the driver is detected on the feature map by the detection frame, the probability of the driver being in the detection frame is predicted by the target confidence as follows: L conf (o,c)=﹣∑(o i ln(Sigmoid(c i ))+(1﹣o i )ln(1﹣Sigmoid(c i ))) Lconf(o,c) is the target confidence loss, o i ∈(0,1) indicates whether the driver actually exists in the detection box i, Sigmoid(c i ) represents the Sigmoid probability of whether the driver exists in the detection box i; When classifying whether the driver's driving posture is an illegal posture, the formula for detecting whether the driver has a certain illegal driving posture through target category loss is as follows: L cla (o,c) is the target category loss, o ij ∈(0,1) indicates whether the j-th illegal driving posture actually exists in the detection box i, Sigmoid(c ij ) represents the Sigmoid probability of the jth illegal driving posture existing in the detection box i.
2. The method according to claim 1, It is characterized in that The determining of the target image, wherein the target image includes the driving posture of the driver, comprises: Acquire an original image, wherein the original image includes the driving posture of the driver; The number of horizontal pixels in the horizontal direction and the number of vertical pixels in the vertical direction of the original image are respectively adjusted to predetermined values to obtain a target image, wherein the number of horizontal pixels is equal to the number of vertical pixels.
3. The method according to claim 1, It is characterized in that The detection frame is trained in the following way: Marking a reference frame determined by the driver's illegal driving posture on an auxiliary feature map used for training a detection frame; The prior box of at least one shape is obtained by clustering with the Kmeans++ algorithm; For each shape of the prior frame, traverse each area of the auxiliary feature map, wherein for each area, obtain the intersection-and-union ratio of the prior frame and the reference frame; When the intersection-over-union ratio exceeds a second predetermined threshold, the priori box is determined as a detection box.
4. A device for detecting illegal driving posture, It is characterized in that The device comprises: a determination unit, configured to determine a target image, wherein the target image includes a driving posture of the driver; An extraction unit is used to input the target image into a DarkNet neural network model to output a first image feature, wherein the DarkNet neural network model includes 6 CresX structural components, each CresX structural component has a residual structure, and is composed of X structures of a CBM component followed by a CBM component and a SUM, wherein a CBM component is composed of a convolutional layer followed by a batch normalization and an activation function, and the DarkNet neural network model is used to enhance the feature expression capability of an image in haze, rainy days, at night, and in scenes with occlusion; The first image feature is input into the Attention model, and the first image feature is connected with the residual of the first image feature after global average pooling, full connection + Relu activation function, 1×1 convolution + Sigmoid activation function to output a second image feature; Performing convolution processing on the second image feature seven times in succession to obtain a first scale feature map; The second image feature is subjected to six consecutive convolution processes to obtain a third image feature; the third image feature is subjected to downsampling processing to obtain a fourth image feature; the first image feature and the fourth image feature are subjected to residual connection processing to obtain a fifth image feature; the fifth image feature is subjected to seven consecutive convolution processes to obtain a second scale feature map; Performing convolution processing on the fifth image feature for six consecutive times to obtain a sixth image feature; performing downsampling processing on the sixth image feature to obtain a seventh image feature; performing residual connection processing on the first image feature and the seventh image feature to obtain an eighth image feature; performing convolution processing on the eighth image feature for seven consecutive times to obtain a third scale feature map; A detection unit is used to traverse each area of the feature map through a pre-trained detection frame, and determine, for each area, a confidence level for characterizing that the driver has an illegal driving behavior, wherein the feature map includes the first scale feature map, the second scale feature map, and the third scale feature map; When the confidence level exceeds a first predetermined threshold, determining that the driver has illegal driving behavior; The pre-trained detection frame traverses each area of the feature map, and for each area, determines a confidence level for characterizing that the driver has illegal driving behavior, including: Detecting the position of the driver on the feature map through the detection frame, and classifying whether the driving posture of the driver is an illegal posture; When the position of the driver is detected on the feature map by the detection frame, the probability of the driver being in the detection frame is predicted by the target confidence as follows: L conf (o,c)=﹣∑(o i ln(Sigmoid(c i ))+(1﹣o i )ln(1﹣Sigmoid(c i ))) Lconf(o,c) is the target confidence loss, o i ∈(0,1) indicates whether the driver actually exists in the detection box i, Sigmoid(c i ) represents the Sigmoid probability of whether the driver exists in the detection box i; When classifying whether the driver's driving posture is an illegal posture, the formula for detecting whether the driver has a certain illegal driving posture through target category loss is as follows: L cla (o,c) is the target category loss, o ij ∈(0,1) indicates whether the j-th illegal driving posture actually exists in the detection box i, Sigmoid(c ij ) represents the Sigmoid probability of the jth illegal driving posture existing in the detection box i.
5. A computer readable program medium, It is characterized in that The computer program instructions are stored therein, and when the computer program instructions are executed by a computer, the computer is caused to execute the method according to any one of claims 1 to 3.
6. An electronic device for detecting illegal driving postures, It is characterized in that The electronic device comprises: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 3 is implemented.
