Vehicle cargo carrying state recognition method, device and system and storage medium
By introducing the SimAM module with a parameterless attention mechanism in the YOLOv5 model, combined with image preprocessing, the accuracy and speed problems of truck cargo status recognition are solved, and efficient overload detection is achieved.
Patent Information
- Application Number
- CN202510424667.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-07-18
AI Technical Summary
The existing overload detection technology cannot effectively identify the cargo status of trucks, resulting in the inability to effectively prevent the damage to the road by overloaded vehicles.
Using the improved YOLOv5 model, the SimAM module with a parameterless attention mechanism is introduced into the backbone network and the neck network, and combined with image preprocessing technology, the vehicle cargo status is trained and identified.
It improves the accuracy and speed of cargo status recognition, reduces missed and missed inspections, and meets practical application needs.
Smart Images

Figure CN120339972A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle overloading detection, and particularly relates to a method and device, a system, and a storage medium for identifying the loading state of a vehicle. Background Art
[0002] Overloading of freight trucks not only impairs the transportation safety of the vehicles, but also increases the probability of accidents. In addition, there is data indicating that when the overloading of a vehicle reaches about 50% of the specified limit, the service life of the road may be shortened by nearly 80%. This not only affects the service quality of the road, but also increases the difficulty of road maintenance. Overloading also leads to unfair competition in the logistics industry. Therefore, an efficient overloading detection technology is particularly crucial. However, the current overloading detection means are still unable to propose an effective method for identifying the loading state of freight trucks, and it is difficult to screen out suspicious vehicles from a large amount of overloading data, resulting in the inability to effectively prevent the damage caused by overloaded vehicles to the road. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide a method and device, a system, and a storage medium for identifying the loading state of a vehicle.
[0004] To achieve the above object, the present invention adopts the following technical solutions:
[0005] A method for identifying the loading state of a vehicle, comprising:
[0006] Step S1, obtaining historical vehicle loading image data;
[0007] Step S2, preprocessing the historical vehicle loading image data;
[0008] Step S3, training an improved YOLOv5 model according to the preprocessed historical vehicle loading image data; wherein, the improved YOLOv5 model includes: a backbone network and a neck network, and a SimAM module based on a parameter-free attention mechanism is introduced into the backbone network and the neck network;
[0009] Step S4, inputting the vehicle loading image data obtained in real time into the trained improved YOLOv5 model for identifying the loading state of the vehicle.
[0010] Preferably, in step S2, the preprocessing of the historical vehicle loading image data includes: image annotation, image scaling, flipping, central cropping, and blurring processing.
[0011] Preferably, the loading states include: empty load, half load, full load, overloading, modification, and unknown category.
[0012] The present invention also provides a device for identifying the loading state of a vehicle, comprising:
[0013] An acquisition module for acquiring historical vehicle cargo image data;
[0014] A preprocessing module for preprocessing the historical vehicle cargo image data;
[0015] A training module for training an improved YOLOv5 model based on the preprocessed historical vehicle cargo image data; wherein, the improved YOLOv5 model includes: a backbone network and a neck network, and a SimAM module based on a parameter-free attention mechanism is introduced into the backbone network and the neck network;
[0016] An identification module for inputting the vehicle cargo image data obtained in real time into the trained improved YOLOv5 model for vehicle cargo status identification.
[0017] Preferably, the preprocessing module preprocessing the historical vehicle cargo image data includes: image annotation, image scaling, flipping, central cropping, and blurring.
[0018] Preferably, the cargo status includes: empty load, half load, full load, overloading, modification, and unknown category.
[0019] The present invention also provides a vehicle cargo status identification system, including: a memory and a processor, a computer program is stored on the memory and run by the processor, and the computer program executes the vehicle cargo status identification method when run by the processor.
[0020] The present invention also provides a storage medium, a computer program is stored on the storage medium, and the computer program executes the vehicle cargo status identification method when running.
[0021] Based on the YOLOV5 network, the present invention aims to improve the identification of the truck cargo status by adding a parameter-free attention mechanism to the backbone network and the neck network, so as to ensure the accuracy of detection and reduce the situation of missed detection and false detection. Adopting the technical solution of the present invention, not only has a high recognition rate, but also has a fast processing speed, and can well meet the actual application requirements. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings.
[0023] Figure 1 It is a flowchart of the vehicle cargo status identification method according to the embodiment of the present invention;
[0024] Figure 2 Schematic diagram of the improved YOLOv5 model structure;
[0025] Figure 3 It is the SimAM attention mechanism structure. Specific implementation manners
[0026] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0027] To make the above objects, features, and advantages of the present invention more obvious and understandable, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific implementation manners.
[0028] Embodiment 1:
[0029] As Figure 1 shown, a method for identifying the cargo-loading state of a vehicle according to an embodiment of the present invention includes:
[0030] Step S1, obtaining historical vehicle cargo image data;
[0031] Step S2, preprocessing the historical vehicle cargo image data; wherein, the preprocessing includes: image annotation, image scaling, flipping, central cropping, and blurring.
[0032] Step S3, training an improved YOLOv5 model according to the preprocessed historical vehicle cargo image data;
[0033] Step S4, inputting the real-time obtained vehicle cargo image data into the trained improved YOLOv5 model for identifying the cargo-loading state of the vehicle, and the cargo-loading state includes: empty load, half load, full load, over load, modification, and unknown category.
[0034] As an implementation manner of the embodiment of the present invention, the improved YOLOv5 model includes: a backbone network and a neck network, and a SimAM module based on a parameter-free attention mechanism is introduced into the backbone network and the neck network, as Figure 2As shown, the improved YOLOv5 model adopts a three - level architecture of "Backbone - Neck - Head" to achieve efficient object detection. The input image is processed layer by layer through the BackBone network. Through multiple layers of convolution (Conv) and three consecutive C3 modules (including the Path Aggregation Network PAN), the feature extraction is deepened. The SimAM self - attention module is embedded to strengthen the local feature correlation. Then, through the SPPF lightweight feature pyramid pooling, multi - scale feature fusion is achieved. In the Neck part, through the double - branch upsampling (UpSample) and cross - layer concatenation (Concat) strategies, the deep semantic and shallow detail information are fused, and combined with the SimAM module to further enhance the feature expression. The Head adjusts the feature resolution through two - stage convolution, and finally outputs multi - scale object detection results through the double detection layer (Detect). The improved YOLOv5 model not only helps the model to more precisely focus on the important features in the image, thus significantly improving the understanding and recognition ability of the target object, but also enhances the overall performance and robustness of the model by optimizing the feature extraction process. The application of the SimAM module enables the model to maintain high - precision detection results in complex and changing actual scenarios, especially when dealing with challenging data, such as the recognition of the cargo state of vehicles under low - light conditions or partial occlusion. This enhanced attention mechanism brings better detection effects to YOLOv5.
[0035] SimAM can comprehensively consider the information of different positions and channels on the feature map, and assign corresponding three - dimensional attention weights to each position and channel to evaluate their importance, which is expressed by the following formula:
[0036]
[0037]
[0038] Among them, is the minimum energy function of each neuron, t is the value of the input feature X, λ is the regularization coefficient, u is the mean of all neurons on the channel, and σ 2 is the variance of all neurons. t, which represents the difference between a neuron and its surrounding neurons, is in the denominator. Therefore, the lower the value of the minimum energy function, the greater the difference between the neuron and its surrounding neurons, and the higher its importance. The attention mechanism plays a role by enhancing specific features, and uses the Sigmoid activation function to control the output range of the minimum energy function, and its specific form is shown in the following formula:
[0039]
[0040] In this process, X represents the input feature, and It represents the output features enhanced by the Sigmoid function. Based on this, we obtained an enhanced attention feature map without adding additional network parameters. Specifically, as shown in Figure 3 Figure Figure 3 , this figure shows the 3-D weight generation and fusion process of the SimAM module. The input feature map X (with dimensions C×H×W) generates a pixel-wise 3-D attention weight matrix (where the colored squares represent different weight distributions) by calculating the local self-similarity of each neuron (optimized through an energy function to measure the linear separability of a neuron from its surrounding neurons). Weight generation does not require additional parameters or fully connected layers and only relies on the mean, variance statistics of the feature map, and closed-form formulas for calculation. Subsequently, the 3-D weights are fused with the original feature map through element-wise multiplication to output the enhanced features. Its core is to enhance features by dynamically evaluating the spatial inhibition effect of each neuron (i.e., the difference from its surrounding neurons), while maintaining a parameter-free and lightweight design (only requiring one multiplication operation). The figure intuitively presents the per-neuron weight distribution through multi-colored squares and spatial mapping.
[0041] In the embodiment of the present invention, an improved YOLOv5 algorithm framework is adopted. By introducing the parameter-free attention mechanism of SimAM, the model's ability to recognize the cargo-carrying state of vehicles is enhanced. In this framework, real images collected under actual road conditions are used as the data set source, and a series of data augmentation techniques are adopted, including image scaling, flipping, central cropping, and blurring, etc., to expand and diversify the data set, ensuring that the model can adapt to various complex actual situations. After multiple rounds of strict training and optimization, the improved model demonstrates its effective recognition ability for different vehicle cargo-carrying states, significantly improving the detection accuracy and reliability. The effective recognition of the vehicle cargo-carrying state is achieved.
[0042] Embodiment 2:
[0043] The embodiment of the present invention also provides a device for recognizing the cargo-carrying state of a vehicle, including:
[0044] An acquisition module, configured to acquire historical vehicle cargo image data;
[0045] A preprocessing module, configured to preprocess the historical vehicle cargo image data;
[0046] A training module, configured to train an improved YOLOv5 model according to the preprocessed historical vehicle cargo image data; wherein, the improved YOLOv5 model includes: a backbone network and a neck network, and a SimAM module based on a parameter-free attention mechanism is introduced into the backbone network and the neck network;
[0047] A recognition module, configured to input the real-time acquired vehicle cargo image data into the trained improved YOLOv5 model for recognizing the cargo-carrying state of the vehicle.
[0048] As an implementation manner of an embodiment of the present invention, the preprocessing module preprocesses the historical vehicle cargo image data, including: image annotation, image scaling, flipping, central cropping, and blurring processing.
[0049] As an implementation manner of an embodiment of the present invention, the cargo states include: empty load, half load, full load, over load, modification, and unknown category.
[0050] Embodiment 3:
[0051] The embodiment of the present invention further provides a vehicle cargo state recognition system, including: a memory and a processor, where a computer program run by the processor is stored on the memory, and the computer program executes the vehicle cargo state recognition method when being run by the processor.
[0052] Embodiment 4:
[0053] The embodiment of the present invention further provides a storage medium, where a computer program is stored on the storage medium, and the computer program executes the vehicle cargo state recognition method when running.
[0054] The above embodiments are only descriptions of the preferred embodiments of the present invention, and do not limit the scope of the present invention. Without departing from the design spirit of the present invention, various deformations and improvements made by those of ordinary skill in the art to the technical solutions of the present invention shall fall within the protection scope determined by the claims of the present invention.
Claims
1. A method for identifying the cargo-loaded state of a vehicle, characterized in that, Including: Step S1, obtaining historical vehicle cargo image data; Step S2, preprocessing the historical vehicle cargo image data; Step S3, training an improved YOLOv5 model according to the preprocessed historical vehicle cargo image data; wherein, the improved YOLOv5 model includes: a backbone network and a neck network, and a SimAM module based on a parameter-free attention mechanism is introduced into the backbone network and the neck network; Step S4, inputting the real-time obtained vehicle cargo image data into the trained improved YOLOv5 model for vehicle cargo state recognition.
2. The vehicle cargo state recognition method according to claim 1, characterized in that, In step S2, the preprocessing of the historical vehicle cargo image data includes: image annotation, image scaling, flipping, central cropping, and blurring processing.
3. The vehicle cargo state recognition method according to claim 2, characterized in that The cargo state includes: empty load, half load, full load, overloading, modification, and unknown category.
4. A vehicle cargo state recognition device, characterized in that, Including: An acquisition module, configured to obtain historical vehicle cargo image data; A preprocessing module, configured to preprocess the historical vehicle cargo image data; A training module, configured to train an improved YOLOv5 model according to the preprocessed historical vehicle cargo image data; wherein, the improved YOLOv5 model includes: a backbone network and a neck network, and a SimAM module based on a parameter-free attention mechanism is introduced into the backbone network and the neck network; An identification module, configured to input the real-time obtained vehicle cargo image data into the trained improved YOLOv5 model for vehicle cargo state recognition.
5. The vehicle cargo state recognition device according to claim 4, characterized in that, The preprocessing module preprocessing the historical vehicle cargo image data includes: image annotation, image scaling, flipping, central cropping, and blurring processing.
6. The vehicle cargo state recognition device according to claim 5, wherein, The cargo state includes: empty load, half load, full load, overloading, modification, and unknown category.
7. A vehicle load state recognition system, characterized in that, Including: A memory and a processor, a computer program is stored on the memory and run by the processor, and the computer program, when run by the processor, executes the vehicle cargo state recognition method according to any one of claims 1-3.
8. A storage medium, characterized in that, A computer program is stored on the storage medium, and the computer program, when running, executes the vehicle cargo state recognition method according to any one of claims 1-3.
Citation Information
Patent Citations
Railway freight loading state image recognition method and system
CN117011798A