Loading rate calculation method, system and equipment based on deep learning and storage medium
The X-ray image is preprocessed and annotated through the deep learning U-net network model, which solves the problems of large errors and time-consuming and labor-intensive calculation of vehicle load rate in traditional methods, and achieves faster and more accurate load rate calculation.
Patent Information
- Application Number
- CN202510284019.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-07-18
AI Technical Summary
When calculating vehicle loading rates in the prior art, traditional grayscale image processing algorithms are difficult to adapt to a variety of vehicle models and goods, resulting in large errors in the calculation results, lack of unified measurement benchmarks, and manual measurements are time-consuming and labor-intensive, and the errors are uncertain.
Using a deep learning-based method, X-ray images are preprocessed and marked using U-net network model to identify cargo and carriage areas and calculate loading rates.
Accurate identification of goods and carriages is achieved, and the calculation results are more reliable and faster, reducing the error and time cost of manual measurement.
Smart Images

Figure CN120339789A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of deep learning recognition, and particularly to a loading rate calculation method, system, terminal device and computer-readable storage medium based on deep learning. Background Art
[0002] The method for calculating the load weight of a vehicle is very simple, which is to directly weigh and then subtract the vehicle weight. However, calculating the space ratio of the goods loaded in the vehicle is a very troublesome thing. Without perspective image analysis, basically, only visual estimation can be used to roughly determine the loading rate of the goods. If a little more accurate, it is necessary to measure the volume of the cargo-loading part of the vehicle and the actual volume of the goods with a ruler, and then calculate the cargo loading ratio. Obviously, this method is not only time-consuming and laborious, but also it is very difficult to measure the actual volume of the goods in a fully loaded carriage, and there is no unified measurement and calculation benchmark, and the measurement error is very uncertain.
[0003] Under conditional circumstances, the side image of the vehicle is collected by an X-ray device, and through the side image, the goods are recognized and the frame of the vehicle cargo compartment part is recognized, and a relatively accurate loading rate can be calculated. However, in terms of the recognition method, there is currently only an algorithm based on traditional grayscale image processing. Although the accuracy is relatively high for some images, due to the large variety of vehicle types, even for the same vehicle part, the grayscale change of the transmitted image is very large. This is because the ray machine is in a fixed position, but the distance between the vehicle and the ray machine varies due to driving factors, resulting in a large difference in the grayscale of the X-ray image. Another important aspect is that the algorithm is very likely to recognize the frame, railing and baffle of the carriage as goods, directly leading to a large error in the calculation result and low accuracy. Therefore, it is very difficult for the algorithm based on traditional grayscale processing to meet the accurate calculation of all vehicle types and hundreds of goods. Summary of the Invention
[0004] In order to solve the above deficiencies in the prior art, the present invention provides a loading rate calculation method, system, terminal device and computer-readable storage medium based on deep learning.
[0005] The first object of the present invention is to provide a loading rate calculation method based on deep learning.
[0006] The second object of the present invention is to provide a loading rate calculation system based on deep learning.
[0007] The third object of the present invention is to provide a terminal device.
[0008] The fourth object of the present invention is to provide a computer-readable storage medium.
[0009] The first object of the present invention can be achieved by adopting the following technical solutions:
[0010] A loading rate calculation method based on deep learning, the method includes offline training and online testing, where:
[0011] The offline training includes:
[0012] Collect multiple 16-bit grayscale X-ray original images of the vehicle carriage as a dataset;
[0013] Use image enhancement technology to preprocess the images in the dataset;
[0014] Label the cargo area and the carriage area for the preprocessed images in the dataset;
[0015] Use the labeled images in the dataset to train the U-net network model to obtain a trained model;
[0016] The online testing includes:
[0017] Real-time collect 16-bit grayscale X-ray images of the vehicle carriage and preprocess them;
[0018] Input the preprocessed image into the trained model to obtain a prediction result;
[0019] Calculate the loading rate according to the prediction result.
[0020] Further, the preprocessing includes:
[0021] Convert the 16-bit grayscale image I1 into an 8-bit grayscale image I2; the image I1 is the image in the dataset or the real-time collected X-ray image of the vehicle carriage;
[0022] According to the histogram of the grayscale image I2, by searching from the highest gray level to the lowest gray level, determine the optimal normalization coefficient; use the optimal normalization coefficient to normalize the image I1 to obtain the original normalized image;
[0023] Filter and locally enhance the contrast of the original normalized image to obtain a corrected image;
[0024] Use the CLAHE algorithm to enhance the corrected image to obtain an enhanced image.
[0025] Further, let the number of pixels with gray level i in the histogram of the grayscale image I2 be H(i);
[0026] The determining the optimal normalization coefficient according to the histogram of the grayscale image I2 by searching from the highest gray level to the lowest gray level includes:
[0027] Search from the highest gray level to the lowest gray level, and define the first gray level i that satisfies the following condition as the peak gray level T1:
[0028] H(i) > H(i - 1) and H(i) > H(i - 2) and H(i) > 1000
[0029] Search from T1 towards lower gray levels, and define the gray level i that first satisfies the following conditions as the mapped gray level T2:
[0030] H(i) < H(i - 1) and H(i) ≤ H(i - 2)
[0031] Search from T2 towards lower gray levels, and define the gray level i that first satisfies the following conditions as the secondary peak gray level T3:
[0032] H(i) > H(i - 1) and H(i) > H(i - 2) and H(i) > 1000
[0033] Search from T3 towards lower gray levels, and define the gray level i that first satisfies the following conditions as the final mapped gray level T4:
[0034] H(i) < H(i - 1) and H(i) ≤ H(i - 2)
[0035] According to the final mapped gray level T4, calculate the optimal normalization coefficient:
[0036] T 16bit = T4 × 256.
[0037] Furthermore, the filtering and local contrast enhancement of the original normalized image to obtain the corrected image includes:
[0038] Perform median filtering on the original normalized image to remove salt-and-pepper noise and obtain a denoised image;
[0039] Use Gaussian filtering to extract the low-frequency background component of the original normalized image and obtain a low-frequency image;
[0040] Take the ratio of the denoised image to the low-frequency image as the separated high-frequency image:
[0041] Take the natural logarithm and absolute value of the separated high-frequency image to obtain a high-frequency logarithmic image:
[0042] Define a dynamic compression lower threshold according to the high-frequency logarithmic image;
[0043] Use the dynamic compression lower threshold to perform lower threshold processing on the high-frequency logarithmic image to filter out minute noise and obtain a denoised image:
[0044] Use the defined upper threshold to perform upper threshold limiting on the denoised image to prevent over-enhancement and obtain the processed high-frequency component;
[0045] Normalize the processed high-frequency components using the upper threshold to obtain a normalized image:
[0046] Use the high-frequency logarithmic image to perform gain control on the normalized image to obtain a gain coefficient image:
[0047] Perform exponential recovery on the gain coefficient image to obtain an image after exponential recovery:
[0048] Multiply the image after exponential recovery by the original normalized image to achieve adaptive local contrast enhancement and obtain an enhanced image;
[0049] Perform pixel value constraint on the enhanced image to obtain a constrained image;
[0050] Perform gamma correction on the constrained image to obtain a corrected image.
[0051] Furthermore, the prediction result includes a goods area probability map and a non-goods area probability map;
[0052] Calculating the loading rate according to the prediction result includes:
[0053] Binarize the goods area probability map and the non-goods area probability map to obtain a goods area mask and a non-goods area mask:
[0054] For the goods area mask and the non-goods area mask, count the number of valid pixels column by column along the image width direction to obtain an array of the number of goods pixels and an array of the number of non-goods pixels;
[0055] According to the array of the number of goods pixels and the array of the number of non-goods pixels, calculate the goods proportion column by column for valid columns and count the total number of valid columns;
[0056] Take the arithmetic mean of the goods proportions of all valid columns to finally obtain the loading rate of the vehicle.
[0057] Furthermore, obtaining the array of the number of goods pixels and the array of the number of non-goods pixels is as follows:
[0058]
[0059] Where h goods (j) and h no_goods (j) respectively represent the array of the number of goods pixels and the array of the number of non-goods pixels, M goods (r,j) and M no_goods (r,j) respectively represent the goods area mask and the non-goods area mask, r and j respectively represent the r-th row and the j-th column, and H and W respectively represent the height and width of the prediction result; the prediction result also includes the image background.
[0060] Furthermore, if hgoods (j) + h no_goods If (j) > 0, then the j-th column is a valid column, and the proportion r(j) of the goods in the j-th column of the valid column is:
[0061]
[0062] The second object of the present invention can be achieved by adopting the following technical solutions:
[0063] A loading rate calculation system based on deep learning, the system includes an offline training module and an online testing module, wherein:
[0064] The offline training module includes:
[0065] The first acquisition unit is used to acquire multiple 16-bit grayscale X-ray raw images of the vehicle carriage as a data set;
[0066] The preprocessing unit is used to preprocess the images in the data set by using image enhancement technology;
[0067] The annotation unit is used to annotate the cargo area and the carriage area of the preprocessed images in the data set;
[0068] The training unit is used to train the U-net network model by using the annotated images in the data set to obtain a trained model;
[0069] The online testing module includes:
[0070] The second acquisition unit is used to acquire and preprocess the 16-bit grayscale X-ray image of the vehicle carriage in real time;
[0071] The prediction unit is used to input the preprocessed image into the trained model to obtain a prediction result;
[0072] The calculation unit is used to calculate the loading rate according to the prediction result.
[0073] The third object of the present invention can be achieved by adopting the following technical solutions:
[0074] A terminal device includes a processor and a memory for storing the executable program of the processor. When the processor executes the program stored in the memory, the above-mentioned loading rate calculation method based on deep learning is realized.
[0075] The fourth object of the present invention can be achieved by adopting the following technical solutions:
[0076] A computer-readable storage medium stores a program, and when the program is executed by a processor, the above-mentioned loading rate calculation method based on deep learning is realized.
[0077] The present invention has the following beneficial effects compared with the prior art:
[0078] 1. Compared with the traditional manual weighing method, the present invention has a faster calculation speed, higher detection efficiency, and is of great significance to traffic safety;
[0079] 2. Compared with the loading rate calculation method based on image processing, the present invention can better identify and distinguish the cargo part and the carriage part of the truck, with more accurate calculation and more reliable results. BRIEF DESCRIPTION OF THE DRAWINGS
[0080] 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 some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on the structures shown in these drawings.
[0081] Figure 1 Flow chart of the offline training part and the online testing part of the loading rate calculation method based on deep learning in Embodiment 1 of the present invention;
[0082] Figure 2 Truck X-ray linear array scanning image in Embodiment 1 of the present invention;
[0083] Figure 3 For Figure 2 JPG format image processed by image enhancement technology;
[0084] Figure 4 For Figure 3 Three-channel prediction result map output after inputting the trained model;
[0085] Figure 5 Structural block diagram of the loading rate calculation system based on deep learning in Embodiment 2 of the present invention;
[0086] Figure 6 Structural block diagram of the terminal device in Embodiment 3 of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0087] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention. It should be understood that the specific embodiments described are only used to explain the present application and are not used to limit the present application.
[0088] Example 1:
[0089] As Figure 1 shown, this example provides a method for calculating the loading rate based on deep learning, including two parts: offline training and online testing, where:
[0090] The offline training includes the following steps:
[0091] (1) Dataset preparation: Collect more than 800 original X-ray images I1 of freight car compartments with 16-bit grayscale;
[0092] This example illustrates the above method by taking a freight car as an example.
[0093] (2) Use image enhancement technology to preprocess each original X-ray image of the freight car compartment. The specific steps are as follows:
[0094] (2-1) Linearly map the original X-ray image I1 of the freight car compartment to the 8-bit range (0-255):
[0095]
[0096] where I1 is the input image (16-bit) and I2 is the converted image (8-bit).
[0097] (2-2) Calculate the 256-level grayscale histogram H(i) of I2, i = 0, 1,..., 255, and determine the optimal normalization coefficient; use the optimal normalization coefficient to perform a normalization mapping on I1 to obtain the normalized image I3. The specific steps are as follows:
[0098] (2-2-1) Search from the highest grayscale level to the lowest grayscale level, and define the first grayscale level i that satisfies the following conditions as the peak grayscale R1:
[0099] H(i) > H(i - 1) and H(i) > H(i - 2) and H(i) > 1000
[0100] (2-2-2) Search from T1 to the lowest grayscale level, and define the first grayscale level i that satisfies the following conditions as the mapping grayscale T2:
[0101] H(i) < H(i - 1) and H(i) ≤ H(i - 2)
[0102] (2-2-3) Search from T2 to the lowest grayscale level, and define the first grayscale level i that satisfies the following conditions as the sub-peak grayscale T3:
[0103] H(i) > H(i - 1) and H(i) > H(i - 2) and H(i) > 1000
[0104] (2-2-4) Search from T3 to lower gray levels, and define the gray level i that first satisfies the following conditions as the final mapped gray level T4:
[0105] H(i) < H(i - 1) and H(i) ≤ H(i - 2)
[0106] (2-2-5) Calculate the optimal normalization coefficient according to the final mapped gray level T4:
[0107] T 16bit = T4 × 256
[0108] (2-2-6) Perform normalization on I1 to obtain image I3:
[0109]
[0110] (2-3) Perform filtering and local contrast enhancement on I3, and the specific steps are as follows:
[0111] (2-3-1) Use a 5x5 kernel to perform median filtering on I3 to remove salt-and-pepper noise and obtain the denoised image I4;
[0112] (2-3-2) Use a 31x31 kernel Gaussian filter to extract the low-frequency background component of I3 and obtain the low-frequency image I5;
[0113] (2-3-3) Separate the high-frequency image I6 through ratio calculation:
[0114]
[0115] (2-3-4) Take the natural logarithm and absolute value of the high-frequency image I6 to obtain the high-frequency logarithmic image I7:
[0116] I7(x,y) = |ln(I6(x,y))|
[0117] (2-3-5) Define the dynamic compression lower threshold mins and upper threshold maxs:
[0118] mins = 0.02 × avg(I7(x,y))
[0119] maxs = ln4
[0120] Among them, avg(I7(x,y)) is the pixel mean value of I7, and maxs is an empirical value that can be adjusted according to needs;
[0121] (2-3-6) Perform lower threshold processing on I7 to filter out tiny noise and obtain the denoised image I8:
[0122]
[0123] (2-3-7) Perform an upper threshold limit on I8 to prevent over-enhancement, and obtain the processed high-frequency component I9:
[0124]
[0125] (2-3-8) Normalize the processed high-frequency component I9 to obtain the normalized image I 10 :
[0126]
[0127] (2-3-9) Perform gain control on I 10 to obtain the gain coefficient map I 11 :
[0128]
[0129] (2-3-10) Perform exponential recovery on I 11 to restore the logarithmic domain signal to the linear domain and obtain the exponentially recovered image I 12 :
[0130]
[0131] (2-3-11) Multiply I 12 by the original normalized image I3 to achieve adaptive local contrast enhancement and obtain the enhanced image I 13 :
[0132] I 13 (x,y) = I 12 (x,y) × I3(x,y)
[0133] (2-3-12) Perform pixel value constraint on the enhanced image I 13 to obtain the constrained image I 14 :
[0134]
[0135] (2-3-13) Perform gamma correction on I 14 and generate an 8-bit image I 15 :
[0136]
[0137] (2-4) Apply the CLAHE algorithm to I 15 with the contrast limit threshold set to 3.0 and the histogram equalization range of 0 - 255 to obtain the enhanced image I 16 ;
[0138] (3) Annotated dataset: Use the Labelme tool to manually annotate the vehicle cargo area and the carriage area of all enhanced images;
[0139] (4) Train the network: Feed the annotated dataset into the U-net network for training to obtain model N;
[0140] Online testing includes the following steps:
[0141] (1) Image acquisition: Use a ray machine and a linear array detector to real-time acquire four X-ray images I of the freight car carriage 17 , as Figure 2 shown. The first two are X-ray images of the van carriage, and the entire carriage will be calculated as a whole when calculating the loading rate; the last two are X-ray images of the baffle freight car carriage, and only the baffle part will be calculated as the carriage when calculating the loading rate;
[0142] (2) Enhance the image I 17 that needs to calculate the loading rate to obtain the enhanced image I 18 , as Figure 3 shown. The method is the same as step (2) in the offline training part;
[0143] (3) Input the image I 18 enhanced in step (2) into model N to obtain the three-channel prediction result I 19 , as Figure 4 shown, where the third channel I 19,3 is the probability map of the cargo area, that is Figure 4 the gray shaded area; the second channel I 19,2 is the probability map of the non-cargo area, that is Figure 4 the white shaded area; the first channel is the image background, that is Figure 4 the black area (can be ignored)
[0144] (4) Calculate the loading rate for the three-channel result output by model N. The specific steps are as follows:
[0145] (4-1) Set the probability threshold to 0.5 and binarize I 19,3 and I 19,2 to obtain the mask M goods of the cargo area and the mask M no_goods of the non-cargo area:
[0146]
[0147] (4-2) Count the column-direction pixels: Count the number of valid pixels column by column along the image width direction to obtain the array h goods of the number of cargo pixels and the array h no_goods of the number of non-cargo pixels:
[0148]
[0149] Among them, H and W are the height and width of the image I 19 respectively;
[0150] (4-3) Calculate the proportion of goods in columns: Calculate the proportion of goods r column by column for the valid columns:
[0151]
[0152] (4-4) Count the total number N of valid columns, that is, record the number of columns where h goods (i)+h no_goods (i)>0 as N.
[0153] (4-5) Loading rate calculation: Take the arithmetic mean of the proportion of goods in all valid columns, and finally output the loading rate ω in percentage form:
[0154]
[0155] Those skilled in the art can understand that all or part of the steps in the method for implementing the above embodiments can be completed by instructing relevant hardware through a program, and the corresponding program can be stored in a computer-readable storage medium.
[0156] It should be noted that although the method operations of the above embodiments are described in a specific order in the drawings, this does not require or imply that these operations must be performed in that specific order, or that all the operations shown must be performed to achieve the desired result. On the contrary, the described steps can be changed in the execution order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step for execution, and / or one step can be decomposed into multiple steps for execution.
[0157] Embodiment 2:
[0158] As Figure 5 shown, this embodiment provides a loading rate calculation system based on deep learning. The system includes an offline training module 501 and an online testing module 502, where:
[0159] The offline training module 501 includes:
[0160] A first acquisition unit, configured to acquire multiple original X-ray images of vehicle compartments in 16-bit grayscale as a data set;
[0161] A preprocessing unit, configured to preprocess the images in the data set by using image enhancement technology;
[0162] A labeling unit, configured to label the goods area and the compartment area for the preprocessed images in the data set;
[0163] A training unit, configured to train a U-net network model by using the labeled images in a dataset to obtain a trained model;
[0164] The online testing module 502 includes:
[0165] A second acquisition unit, configured to acquire in real time a vehicle carriage X-ray image in 16-bit grayscale and perform preprocessing;
[0166] A prediction unit, configured to input the preprocessed image into the trained model to obtain a prediction result;
[0167] A calculation unit, configured to calculate a loading rate according to the prediction result.
[0168] For the specific implementation of each unit in this embodiment, reference may be made to Embodiment 1 above, which will not be elaborated here one by one; it should be noted that the system provided in this embodiment is only illustrated by the above division of each functional unit. In practical applications, the above functions may be allocated to different functional units according to needs, that is, the internal structure is divided into different functional units to complete all or part of the functions described above.
[0169] Embodiment 3:
[0170] This embodiment provides a terminal device, which may be a computer. As Figure 6 shown, it includes a processor 602, a memory, an input device 603, a display 604, and a network interface 605 connected through a system bus 601. The processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium 606 and an internal memory 607. The non-volatile storage medium 606 stores an operating system, a computer program, and a database. The internal memory 607 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the processor 602 executes the computer program stored in the memory, it implements the loading rate calculation method based on deep learning in Embodiment 1 above, that is: the method includes offline training and online testing. Among them, the offline training includes: acquiring multiple original vehicle carriage X-ray images in 16-bit grayscale as a dataset; performing preprocessing on the images in the dataset by using an image enhancement technique; annotating the cargo area and the carriage area on the preprocessed images in the dataset; training a U-net network model by using the labeled images in the dataset to obtain a trained model; the online testing includes: acquiring in real time a vehicle carriage X-ray image in 16-bit grayscale and performing preprocessing; inputting the preprocessed image into the trained model to obtain a prediction result; calculating the loading rate according to the prediction result.
[0171] Embodiment 4:
[0172] This embodiment provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the loading rate calculation method based on deep learning in the above-mentioned Embodiment 1, that is: the method includes offline training and online testing, wherein the offline training includes: collecting multiple 16-bit grayscale original X-ray images of vehicle compartments as a data set; preprocessing the images in the data set using image enhancement techniques; annotating the cargo area and the compartment area for the preprocessed images in the data set; training a U-net network model using the annotated images in the data set to obtain a trained model; the online testing includes: collecting in real time 16-bit grayscale X-ray images of vehicle compartments and performing preprocessing; inputting the preprocessed images into the trained model to obtain a prediction result; calculating the loading rate according to the prediction result.
[0173] It should be noted that the computer-readable storage medium in this embodiment can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of a computer-readable storage medium can include, but are not limited to: an electrical connection having one or more wires, a portable computer 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.
[0174] In summary, this embodiment considers that the calculation of the full load rate of goods requires a relatively unified calculation benchmark, that is, accurate identification of the truck frame, accurate identification of various cargo forms, and fast calculation at the same time. Therefore, a loading rate calculation method based on the U-net model and X-ray imaging technology is proposed, which can accurately identify the cargo and the compartment contour and calculate the loading rate; this method has the characteristics of fast detection speed, high accuracy, and strong stability.
[0175] The above is only a preferred embodiment of the present invention patent, but the protection scope of the present invention patent is not limited thereto. Any person skilled in the art within the scope disclosed by the present invention patent, according to the technical solution and inventive concept of the present invention patent, makes equivalent substitutions or changes, all belong to the protection scope of the present invention patent.
Claims
1. A method for calculating the loading rate based on deep learning, characterized in that, The method includes offline training and online testing, where: The offline training includes: Collecting multiple 16-bit grayscale original X-ray images of vehicle compartments as a dataset; Preprocessing the images in the dataset using image enhancement techniques; Labeling the cargo area and the compartment area on the preprocessed images in the dataset; Training the U-net network model using the labeled images in the dataset to obtain a trained model; The online testing includes: Real-time collecting 16-bit grayscale X-ray images of vehicle compartments and preprocessing them; Inputting the preprocessed images into the trained model to obtain prediction results; Calculating the loading rate according to the prediction results.
2. The loading rate calculation method according to claim 1, wherein The preprocessing includes: Converting the 16-bit grayscale image I1 into an 8-bit grayscale image I2; the image I1 is an image in the dataset or a real-time collected X-ray image of a vehicle compartment; According to the histogram of the grayscale image I2, by searching from the highest gray level to the lower gray levels, determining the optimal normalization coefficient; using the optimal normalization coefficient to normalize the image I1 to obtain the original normalized image; Filtering and locally enhancing the contrast of the original normalized image to obtain a corrected image; Enhancing the corrected image using the CLAHE algorithm to obtain an enhanced image.
3. The loading rate calculation method according to claim 2, wherein Let the number of pixels with gray level i in the histogram of the grayscale image I2 be H(i); The determining the optimal normalization coefficient according to the histogram of the grayscale image I2 by searching from the highest gray level to the lower gray levels includes: Searching from the highest gray level to the lower gray levels, and defining the first gray level i that satisfies the following conditions as the peak gray level T1: H(i)>H(i - 1) and H(i)>H(i - 2) and H(i)>1000 Searching from T1 to the lower gray levels, and defining the first gray level i that satisfies the following conditions as the mapped gray level T2: H(i)<H(i - 1) and H(i)≤H(i - 2) Searching from T2 to the lower gray levels, and defining the first gray level i that satisfies the following conditions as the sub-peak gray level T3: H(i)>H(i - 1) and H(i)>H(i - 2) and H(i)>1000 Searching from T3 to the lower gray levels, and defining the first gray level i that satisfies the following conditions as the final mapped gray level T4: H(i)<H(i - 1) and H(i)≤H(i - 2) Calculate the optimal normalization coefficient T according to the final mapped gray level T4 16bit : T 16bit = T4 × 256.
4. The loading rate calculation method according to claim 2, wherein The filtering and locally enhancing the contrast of the original normalized image to obtain a corrected image includes: Performing median filtering on the original normalized image to remove salt-and-pepper noise and obtain a denoised image; Using Gaussian filtering to extract the low-frequency background component of the original normalized image to obtain a low-frequency image; Taking the ratio of the denoised image to the low-frequency image as the separated high-frequency image: Taking the natural logarithm and the absolute value of the separated high-frequency image to obtain a high-frequency logarithmic image: Defining a dynamic compression lower limit threshold according to the high-frequency logarithmic image; Using the dynamic compression lower limit threshold to perform lower limit threshold processing on the high-frequency logarithmic image to filter out tiny noise and obtain a denoised image: Using the defined upper limit threshold to perform upper limit threshold limitation on the denoised image to prevent over-enhancement and obtain a processed high-frequency component; Using the upper limit threshold to normalize the processed high-frequency component to obtain a normalized image: The normalized image is subjected to gain control using a high-frequency logarithmic image to obtain a gain coefficient image: The gain coefficient image is subjected to exponential restoration to obtain an image after exponential restoration: The image after exponential restoration is multiplied by the original normalized image to achieve adaptive local contrast enhancement, resulting in an enhanced image; The pixel values of the enhanced image are constrained to obtain a constrained image; The constrained image is subjected to gamma correction to obtain a corrected image.
5. The loading rate calculation method according to any one of claims 1 to 4, characterized in that, The prediction result includes a probability map of the cargo area and a probability map of the non-cargo area; Calculating the loading rate according to the prediction result includes: The probability map of the cargo area and the probability map of the non-cargo area are binarized to obtain a mask of the cargo area and a mask of the non-cargo area: For the mask of the cargo area and the mask of the non-cargo area, the number of valid pixels is counted column by column along the width direction of the image to obtain an array of the number of cargo pixels and an array of the number of non-cargo pixels; According to the array of the number of cargo pixels and the array of the number of non-cargo pixels, the proportion of cargo is calculated column by column for the valid columns and the total number of valid columns is counted; The arithmetic mean of the proportion of cargo for all valid columns is taken to finally obtain the loading rate of the vehicle.
6. The loading rate calculation method according to claim 5, characterized in that Obtaining the array of the number of cargo pixels and the array of the number of non-cargo pixels is: Among them, h goods (j) and h no_goods (j) respectively represent the array of the number of pixels with goods and the array of the number of pixels without goods. M goods (r, j) and M no_goods (r, j) respectively represent the mask of the area with goods and the mask of the area without goods. r and j respectively represent the r-th row and the j-th column, and H and W respectively represent the height and width of the prediction result; the prediction result also includes the image background.
7. The loading rate calculation method according to claim 6, wherein If h goods (j) + h no_goods (j) > 0, then the j-th column is a valid column, and the proportion r(j) of the goods in the valid column's j-th column is:
8. A loading rate calculation system based on deep learning, characterized in that, The system includes an offline training module and an online testing module, where: The offline training module includes: A first acquisition unit for acquiring multiple original X-ray images of the vehicle compartment with 16-bit grayscale as a data set; A preprocessing unit for preprocessing the images in the data set using image enhancement techniques; A labeling unit for labeling the cargo area and the compartment area of the preprocessed images in the data set; A training unit for training the U-net network model using the labeled images in the data set to obtain a trained model; The online testing module includes: A second acquisition unit for real-time acquiring and preprocessing X-ray images of the vehicle compartment with 16-bit grayscale; A prediction unit for inputting the preprocessed image into the trained model to obtain a prediction result; A calculation unit for calculating the loading rate according to the prediction result.
9. A terminal device, comprising a processor and a memory for storing processor-executable programs, characterized in that, When the processor executes the program stored in the memory, it implements the loading rate calculation method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the loading rate calculation method according to any one of claims 1 to 7.