Video-based vehicle weighing method and device
By obtaining the vehicle's speed in the weighing video and performing weighted calculations, the vehicle weighing inaccuracy caused by manual judgment is solved, and higher weighing data accuracy is achieved.
Patent Information
- Application Number
- CN202510541736.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-27
- Publication Date
- 2025-08-15
AI Technical Summary
In the field of floor scale weighing technology, manual judgment of the vehicle entering and leaving the weighing area leads to a reduction in the vehicle weighing accuracy, and there are human subjective errors.
By obtaining the time speed corresponding to each frame of the image in the weighing video, filtering out the time periods whose speed is less than the preset threshold, weighted calculations are performed based on the weighing data in these time periods, and target weighing data is obtained.
It improves the accuracy of vehicle weighing, reduces the error caused by manual judgment, and improves the accuracy of data.
Smart Images

Figure CN120489310A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of weighing scales, and in particular to a vehicle weighing method and device based on video. Background Art
[0002] In the field of weighbridge weighing technology, manual judgment is often required to determine whether a vehicle has entered or exited the weighing area, and the vehicle's weight data is manually determined from the weighing data reported by the weighbridge. Excessive manual intervention can lead to subjective judgment errors, resulting in reduced vehicle weighing accuracy.
[0003] In view of this, how to improve the accuracy of vehicle weighing is an urgent problem to be solved. Summary of the Invention
[0004] The present application provides a video-based vehicle weighing method and device for improving the accuracy of vehicle weighing.
[0005] In a first aspect, embodiments of the present application provide a video-based vehicle weighing method that can be applied to any electronic device with processing capabilities. The method includes:
[0006] Obtaining the speed of the first vehicle at the moment corresponding to each frame of the image in the weighing video;
[0007] determining, based on the speed of the first vehicle at the time corresponding to each frame of the image, at least one time period in which the speed of the first vehicle is less than a preset speed threshold, and determining, based on the weighing data of the first vehicle received during the at least one time period, weighing data corresponding to multiple time periods of the first vehicle during the at least one time period;
[0008] The weights of the weighing data corresponding to the multiple moments are determined based on the speeds corresponding to the multiple moments in at least one time period, and the weighing data corresponding to the multiple moments are weightedly calculated based on the weights of the weighing data corresponding to the multiple moments to obtain the target weighing data of the first vehicle.
[0009] In this embodiment, by screening out at least one time period in which the speed is less than a preset speed threshold from the speed of the first vehicle at the moment corresponding to each frame image in the weighing video, so that the speed in the at least one screened time period is close to 0, the influence of the speed on the weighing data can be reduced, thereby improving the accuracy of the subsequent determination of the target weighing data; combining the weighing data of the first vehicle in the at least one time period, determining the weighing data corresponding to the first vehicle at multiple moments, determining the weights of the weighing data corresponding to the multiple moments according to the speeds corresponding to the first vehicle at the multiple moments, and weighting the weighing data based on the weights corresponding to the multiple moments to obtain the target weighing data of the first vehicle; by combining the speed of the first vehicle when it is less than the preset speed threshold to determine the weights of the weighing data at the corresponding moment, the weighing conditions of the first vehicle at multiple moments in which the speed is close to 0 can be more accurately reflected, and then weighted calculation is performed on the corresponding weighing data based on the weights, so that the determined target weighing data of the first vehicle is more accurate, thereby improving the accuracy of vehicle weighing.
[0010] Optionally, obtaining the speed of the first vehicle at the moment corresponding to each frame image in the weighing video includes: identifying the model information of the first vehicle through the weighing video, and obtaining the original body length of the first vehicle according to the model information of the first vehicle; obtaining any consecutive N frames of images from the weighing video, and determining the image offset distance of the first vehicle and the image body length of the first vehicle in the weighing video based on the first position of the first vehicle in the first frame image among the N frames of images, and the second position of the first vehicle in the Nth frame image among the N frames of images; N is a positive integer greater than 1; obtaining the position offset distance of the first vehicle based on the image offset distance divided by the image body length and multiplied by the original body length; the moment corresponding to the first frame image is earlier than the moment corresponding to the Nth frame image; determining the speed of the first vehicle at the moment corresponding to the first frame image according to the position offset distance and the time difference between the first frame image and the Nth frame image.
[0011] Optionally, the speed of the first vehicle in at least one time period is not zero or the number of consecutive times the speed of the first vehicle in at least one time period is zero is less than a preset number threshold; determining the weights of the weighing data corresponding to the multiple moments based on the speeds corresponding to the multiple moments in the at least one time period includes: for any moment in the at least one time period, calculating the weight of the weighing data corresponding to any moment according to the following first formula:
[0012] W cur =1-(V cur -V min ) / (V max -V min );
[0013] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, Vcur represents the speed of the first vehicle at any moment, V min represents the minimum speed of the first vehicle during weighing, V max Indicates the maximum speed of the first vehicle during weighing.
[0014] Optionally, the number of consecutive times that the speed of the first vehicle is 0 in at least one time period is greater than a preset number threshold; and determining weights of weighing data corresponding to multiple moments based on the speeds corresponding to multiple moments in the at least one time period includes:
[0015] Obtain at least one weighing data of the first vehicle during a time period in which the speed is continuously zero; arrange the at least one weighing data in ascending order and determine the maximum and minimum values of the at least one weighing data; and calculate the weight of the weighing data corresponding to any moment in the time period in which the speed of the first vehicle is continuously zero according to the following second formula:
[0016] W cur =1-(Weight cur -Weight min ) / (Weight max -Weight min );
[0017] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, Weight cur Represents the weighing data of the first vehicle at any moment; Weight min Indicates the minimum value of at least one weighing data, Weight max Indicates the maximum value among at least one weighing data.
[0018] Optionally, the speed of the first vehicle is the same in at least one time period; the weights of the weighing data at multiple moments are determined based on the speeds corresponding to multiple moments in at least one time period, including: based on the fact that the speed of the first vehicle is the same in at least one time period, determining that the weights of the weighing data corresponding to multiple moments in at least one time period are the same, and the weight is the inverse of the number of moments in at least one time period.
[0019] Optionally, before obtaining the speed of the first vehicle at the moment corresponding to each frame of image in the weighing video, the method also includes: deploying a starting point tripwire intrusion rule and a key tripwire intrusion rule at the starting point and the end point of the weighing area respectively; the starting point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the starting point, and ends the alarm when the rear of the first vehicle passes the starting point; the end point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the end point, and ends the alarm when the rear of the first vehicle passes the end point; start recording the weighing video of the first vehicle when the starting point tripwire intrusion rule ends the alarm, and end recording the weighing video of the first vehicle when the end point tripwire intrusion rule starts the alarm.
[0020] In a second aspect, an embodiment of the present application provides a video-based vehicle weighing device, comprising:
[0021] An acquisition module is used to: acquire the speed of the first vehicle at the moment corresponding to each frame of image in the weighing video;
[0022] The processing module is used to: determine at least one time period in which the speed of the first vehicle is less than a preset speed threshold based on the speed of the first vehicle at the moment corresponding to each frame of the image, and determine the weighing data corresponding to multiple moments in the at least one time period of the first vehicle based on the weighing data of the first vehicle received in the at least one time period; determine the weights of the weighing data corresponding to the multiple moments based on the speeds corresponding to the multiple moments in the at least one time period, and perform weighted calculation on the weighing data corresponding to the multiple moments based on the weights of the weighing data corresponding to the multiple moments to obtain target weighing data of the first vehicle.
[0023] Optionally, an acquisition module is specifically used to: identify the model information of the first vehicle through the weighing video, and obtain the original body length of the first vehicle according to the model information of the first vehicle; obtain any consecutive N frames of images from the weighing video, and determine the image offset distance of the first vehicle and the image body length of the first vehicle in the weighing video based on the first position of the first vehicle in the first frame of the N frames and the second position of the first vehicle in the N frame of the N frames; N is a positive integer greater than 1; based on the image offset distance divided by the image body length and multiplied by the original body length, the position offset distance of the first vehicle is obtained; the time corresponding to the first frame image is earlier than the time corresponding to the N frame image; based on the position offset distance and the time difference between the first frame image and the N frame image, the speed of the first vehicle at the time corresponding to the first frame image is determined.
[0024] Optionally, the speed of the first vehicle in at least one time period is not zero or the number of consecutive times the speed of the first vehicle in at least one time period is zero is less than a preset number threshold; when the processing module determines the weights of the weighing data corresponding to multiple moments based on the speeds corresponding to multiple moments in at least one time period, it is configured to: for any moment in the at least one time period, calculate the weight of the weighing data corresponding to any moment according to the following first formula:
[0025] W cur =1-(V cur -V min ) / (V max -V min );
[0026] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, V cur represents the speed of the first vehicle at any moment, V min represents the minimum speed of the first vehicle during weighing, V max Indicates the maximum speed of the first vehicle during weighing.
[0027] Optionally, the number of consecutive times that the speed of the first vehicle is 0 in at least one time period is greater than a preset number threshold; when the processing module determines the weights of the weighing data corresponding to the multiple moments based on the speeds corresponding to the multiple moments in the at least one time period, it is configured to:
[0028] Obtain at least one weighing data of the first vehicle during a time period in which the speed is continuously zero; arrange the at least one weighing data in ascending order and determine the maximum and minimum values of the at least one weighing data; and calculate the weight of the weighing data corresponding to any moment in the time period in which the speed of the first vehicle is continuously zero according to the following second formula:
[0029] W cur =1-(Weight cur -Weight min ) / (Weight max -Weight min );
[0030] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, Weight cur Represents the weighing data of the first vehicle at any moment; Weight min Indicates the minimum value of at least one weighing data, Weight max Indicates the maximum value among at least one weighing data.
[0031] Optionally, the speed of the first vehicle is the same in at least one time period; when the processing module determines the weights of the weighing data at multiple moments based on the speeds corresponding to multiple moments in at least one time period, it is used to: based on the fact that the speed of the first vehicle is the same in at least one time period, determine that the weights of the weighing data corresponding to multiple moments in at least one time period are the same, and the weight is the inverse of the number of moments in at least one time period.
[0032] Optionally, before obtaining the speed of the first vehicle at the moment corresponding to each frame of image in the weighing video, the acquisition module is also used to: deploy a starting point tripwire intrusion rule and a key tripwire intrusion rule at the starting point and the end point of the weighing area respectively; the starting point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the starting point, and ends the alarm when the rear of the first vehicle passes the starting point; the end point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the end point, and ends the alarm when the rear of the first vehicle passes the end point; start recording the weighing video of the first vehicle when the starting point tripwire intrusion rule ends the alarm, and end recording the weighing video of the first vehicle when the end point tripwire intrusion rule starts the alarm.
[0033] In a third aspect, an embodiment of the present application provides an electronic device comprising at least one processor, wherein the at least one processor is configured to implement a method as in the first aspect or any optional embodiment of the first aspect when executing a computer program stored in a memory.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing instructions, which, when executed, enables the method in the first aspect or any optional embodiment of the first aspect to be implemented.
[0035] In a fifth aspect, an embodiment of the present application provides a computer program product, comprising a computer program code, which, when executed on a computer, enables the method according to the first aspect or any optional embodiment of the first aspect to be implemented.
[0036] The technical effects or advantages of one or more technical solutions provided in the second, third, fourth and fifth aspects of the embodiments of this application can be explained by the technical effects or advantages of the corresponding one or more technical solutions provided in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is an example diagram of a vehicle weighing scenario provided in an embodiment of the present application;
[0038] Figure 2 A flow chart of a video-based vehicle weighing method provided in an embodiment of the present application;
[0039] Figure 3 An example diagram of a position offset distance provided in an embodiment of the present application;
[0040] Figure 4 An example diagram of the relationship between speed and time provided in an embodiment of the present application;
[0041] Figure 5 An example diagram of the relationship between weighing data and time provided in an embodiment of the present application;
[0042] Figure 6 A structural diagram of a video-based vehicle weighing device provided in an embodiment of the present application;
[0043] Figure 7 A structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0044] In the technical solution of this application, the collection, dissemination, and use of data comply with the requirements of relevant national laws and regulations.
[0045] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned. They should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.
[0046] The technical solution of the present application is described in detail below through the accompanying drawings and specific embodiments. It should be understood that the embodiments of the present application and the specific features in the embodiments are detailed descriptions of the technical solution of the present application, rather than limitations on the technical solution of the present application. Unless there is a conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other.
[0047] It should be understood that "multiple" in the description of the embodiments of the present application refers to two or more. "First", "second" etc. in the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. The term "and / or" in the embodiments of the present application is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the term "including" and any of its variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices. The module in the embodiments of the present application refers to a part with independent functions in a software system.
[0048] In the field of truck scale weighing technology, it is usually necessary to manually determine whether the vehicle is located in the weighing area, determine the vehicle's target weighing data from the weighing data reported by the truck scale, and determine whether the target weighing data is accurate. The labor cost is high and there are errors in human subjective judgment.
[0049] In view of this, an embodiment of the present application is provided, which obtains a weighing video of the first vehicle during weighing, and determines the position offset distance of the first vehicle and the time difference of the moments corresponding to the N frames of image based on each frame of image in the weighing video and N-1 frames of image that are continuous with each frame of image and correspond to a moment later than each frame of image; and determines the speed of the first vehicle at the moment corresponding to each frame of image based on the position offset distance and the time difference; determines at least one time period in which the speed is less than a preset speed threshold according to the speed at the moment corresponding to each frame of image, and determines weighing data corresponding to multiple moments in the at least one time period based on the weighing data received in the at least one time period; and then determines the weights of the weighing data corresponding to the multiple moments based on the speeds at the multiple moments, which can more accurately reflect the weighing status of the first vehicle at the multiple moments, and then performs weighted calculation on the weighing data based on the weights corresponding to the multiple moments to obtain target weighing data, so that the determined target weighing data of the first vehicle is more accurate, which can improve the accuracy of vehicle weighing.
[0050] See also Figure 1 , is an example of a vehicle weighing scenario provided by an embodiment of the present application. Figure 1 As shown, the starting point tripwire intrusion rule and the end point tripwire intrusion rule are deployed at the starting point and the end point of the weighing area respectively. The starting point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the starting point, and ends the alarm when the rear of the first vehicle passes the starting point; the end point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the end point, and ends the alarm when the rear of the first vehicle passes the end point; the recording of the weighing video of the first vehicle starts when the starting point tripwire intrusion rule ends the alarm, and ends when the end point tripwire intrusion rule starts the alarm.
[0051] For example, the starting point tripwire intrusion rule can be used to determine whether the weighing vehicle (i.e., the first vehicle) enters the weighing area, and the end point tripwire intrusion rule can be used to determine whether the weighing vehicle leaves the weighing area. Figure 1As shown in Figure 1, tripwire intrusion rule 1 (i.e., the starting point tripwire intrusion rule) triggers a continuous alarm, indicating that the front of the first vehicle has passed the starting point, meaning that the first vehicle is entering the weighbridge. When tripwire intrusion rule 1 stops, it indicates that the rear of the first vehicle has passed the starting point, meaning that the first vehicle has entered the weighing area. Based on this, the moment tripwire intrusion rule 1 stops triggering the alarm can be determined as the moment the first vehicle begins weighing, which is also the moment the weighing video begins recording.
[0052] When the first vehicle leaves the weighing area after weighing, the Figure 1 As shown in the figure, tripwire intrusion rule 2 (i.e., the endpoint tripwire intrusion rule) triggers a continuous alarm, which indicates that the front of the first vehicle has passed the endpoint, meaning that the first vehicle is leaving the weighing scale. When tripwire intrusion rule 2 stops triggering the alarm, it indicates that the rear of the second vehicle has passed the endpoint, meaning that the first vehicle has completely left the weighing scale. Based on this, the moment when tripwire intrusion rule 2 begins to trigger the alarm, that is, the moment when the first vehicle begins to leave the weighing scale, can be regarded as the moment when the first vehicle ends weighing, and the moment when the weighing video recording ends.
[0053] In this way, the start and end weighing times of the first vehicle can be flexibly determined by adjusting the positions of tripwire intrusion rule 1 and tripwire intrusion rule 2, which can improve the accuracy of judging whether different types of vehicles are in the weighing period, thereby improving the accuracy of vehicle weighing.
[0054] See also Figure 2 , is a flow chart of a video-based vehicle weighing method provided in an embodiment of the present application. The method can be applied to any electronic device with processing capabilities. The method includes steps S201 to S205:
[0055] S201. Obtain the speed of the first vehicle at the moment corresponding to each frame of image in the weighing video.
[0056] For example, Figure 1 Taking the vehicle weighing scenario as an example, the weighing video is the video from the time when the tripwire intrusion rule 1 stops the alarm to the time when the tripwire intrusion rule 2 triggers the alarm.
[0057] In a possible embodiment, the specific implementation of step S102 is as follows:
[0058] Identifying the model information of the first vehicle through the weighing video, and obtaining the original body length of the first vehicle according to the model information of the first vehicle;
[0059] Obtain any N consecutive frames of images from the weighing video, and determine an image offset distance of the first vehicle and an image body length of the first vehicle in the weighing video based on a first position of the first vehicle in a first frame of the N frames and a second position of the first vehicle in an Nth frame of the N frames; N is a positive integer greater than 1;
[0060] The position offset distance of the first vehicle is obtained by dividing the image offset distance by the image vehicle length and multiplying the result by the original vehicle length; the time corresponding to the first frame of image is earlier than the time corresponding to the Nth frame of image;
[0061] The speed of the first vehicle at the time corresponding to the first frame image is determined according to the position offset distance and the time difference between the first frame image and the Nth frame image.
[0062] Exemplarily, any N consecutive frames of images are obtained from the weighing video, the first position of the first vehicle in the first frame of image and the second position of the first vehicle in the Nth frame of image are determined, the distance between the first position and the second position is calculated, and the image offset distance of the first vehicle is obtained.
[0063] Specifically, Figure 3 As an example of the position offset distance shown in the figure, the first frame image in N frames is Figure 3 ; if N is 2, the distance between the position 2 of the first vehicle in the video and the position 1 of the first vehicle in the video is calculated, that is, the distance 1 is the image offset distance of the first vehicle; if N is 3, the distance between the position 3 of the first vehicle in the video and the position 1 of the first vehicle in the video is calculated, that is, the distance 1 plus the distance 2 is the image offset distance of the first vehicle, and so on.
[0064] After calculating the image offset distance, it is necessary to map the image offset distance of the first vehicle in the weighing video to the position offset distance in the actual weighing area. That is, the position offset distance is obtained by dividing the calculated image offset distance by the image vehicle body length and multiplying it by the original vehicle body length. The speed of the first vehicle at the moment corresponding to the first frame of the N frames can be determined by dividing the position offset distance by the time difference corresponding to the N frames of images.
[0065] It is understood that the frame rate of the video can be set according to actual needs, and the embodiments of the present application do not impose any restrictions on this. The value of N can also be adjusted according to the speed of the first vehicle during weighing in actual applications. The higher the speed, the smaller the value of N, and the lower the speed, the larger the value of N.
[0066] After determining the speed of the first vehicle at the time corresponding to each frame image, the speeds of two adjacent time periods can be connected to form the following: Figure 4The speed and time relationship diagram shown in the figure is convenient for subsequent analysis of the speed of the first vehicle at multiple moments. The time reference system can be the time of the electronic device or the storage device in the electronic device that implements the embodiment of the present application; the method of connecting the speeds of two adjacent moments can be as follows: Figure 4 The straight line connection shown can also be connected by arcs, etc., and this embodiment of the application is not limited to this.
[0067] S202: Determine at least one time period in which the speed of the first vehicle is less than a preset speed threshold based on the speed of the first vehicle at the moment corresponding to each frame of image.
[0068] It is understood that when the speed of the first vehicle is closer to 0, the speed has less influence on the weighing data, therefore, the preset speed threshold selected in the embodiment of the present application also needs to be close to 0. The preset speed threshold can also be selected according to actual conditions.
[0069] S203: Determine, based on the weighing data of the first vehicle received within at least one time period, weighing data corresponding to multiple moments of the first vehicle within the at least one time period.
[0070] It can be understood that during the weighing of the first vehicle, the scale will continuously report the weighing data of the first vehicle at preset time intervals, obtain at least one weighing data of the first vehicle reported by the scale within at least one time period, and determine the weighing data corresponding to multiple moments (or each moment) of the first vehicle within at least one time period based on the at least one weighing data.
[0071] For example, if only one weighing data a is received in at least one time period, the corresponding weighing data of the first vehicle at each moment in at least one time period are all set to the weighing data a; if multiple weighing data are received in at least one time period, the weighing data corresponding to the time period between the moments corresponding to two adjacent weighing data are all set to the weighing data received first among the two weighing data. For example, if weighing data b is received at the first moment in at least one time period, weighing data c is received at the second moment after the first moment, and weighing data d is received at the third moment after the second moment, then the weighing data corresponding to the time period between the first moment and the second moment is weighing data b, and the weighing data corresponding to the time period between the second moment and the third moment is weighing data c. In this way, we can get the following: Figure 5 The diagram shown is an example of the relationship between weighing data and time (i.e. an example of the relationship between weight and time).
[0072] Optionally, it is possible to create only the relationship between the weighing data and time within at least one time period, or to create the relationship between all the weighing data and time during the entire weighing period of the first vehicle, and extract the relationship between the weighing data and time within at least one time period as needed; usually, in order to improve the accuracy and reliability of the weighing data, the latter is usually selected to determine the relationship between the weighing data and time within at least one time period.
[0073] S204: Determine weights of weighing data corresponding to multiple moments based on speeds corresponding to multiple moments in at least one time period.
[0074] The embodiments of the present application provide the following three examples, which respectively introduce the specific implementation of step S203 for three possible situations.
[0075] Example 1: The speed of the first vehicle is not 0 in at least one time period, or the consecutive number of times the speed of the first vehicle is 0 in at least one time period is less than a preset number threshold.
[0076] For any moment in at least one time period, the weight of the weighing data corresponding to any moment is calculated according to the following first formula:
[0077] W cur =1-(V cur -V min ) / (V max -V min );
[0078] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, V cur represents the speed of the first vehicle at any moment, V min represents the minimum speed of the first vehicle during weighing, V max Indicates the maximum speed of the first vehicle during weighing.
[0079] It can be understood that if the speed of the first vehicle is not 0 in at least one time period or the consecutive number of times the speed of the first vehicle is 0 in at least one time period is less than the preset number threshold, it means that the first vehicle has not had a stationary time period during the weighing period. In this case, the above-mentioned first formula is used to perform linear distribution calculation on the weight to improve the accuracy of the weight of the determined weighing data.
[0080] Example 2: The number of consecutive times that the speed of the first vehicle is 0 in at least one time period is greater than a preset number threshold.
[0081] Acquiring at least one weighing data of the first vehicle during a time period in which the speed is continuously zero;
[0082] Arrange at least one weighing data in ascending order, and determine the maximum value and the minimum value of the at least one weighing data;
[0083] For any moment in the time period when the speed of the first vehicle is continuously 0, the weight of the weighing data corresponding to any moment is calculated according to the following second formula:
[0084] W cur =1-(Weight cur -Weight min ) / (Weight max -Weight min );
[0085] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, Weight cur Represents the weighing data of the first vehicle at any moment; Weight min Indicates the minimum value of at least one weighing data, Weight max Indicates the maximum value among at least one weighing data.
[0086] It can be understood that when the speed of the first vehicle is 0 for a consecutive number of times greater than the preset number threshold, it means that the first vehicle has been in a stationary state during the time period when the speed is continuously 0. The weighing data when stationary are arranged in order from small to large (or from large to small). The smaller the weighing data, the higher the corresponding weight. In this way, the weighing error caused by starting and stopping of the first vehicle can be reduced.
[0087] It can be understood that the preset number thresholds in the above-mentioned Examples 1 and 2 can be set according to actual needs. For example, the preset number thresholds can be related to the speed of the first vehicle in at least one time period. The greater the speed, the shorter the actual stop time of the first vehicle will be, and the corresponding preset number thresholds can be increased. The embodiments of the present application do not impose any restrictions on this.
[0088] Example 3: The speed of the first vehicle is the same in at least one time period.
[0089] Based on the fact that the speed of the first vehicle is the same in at least one time period, it is determined that the weights of the weighing data corresponding to multiple moments in the at least one time period are the same, and the weight is the reciprocal of the number of moments in the at least one time period.
[0090] It can be understood that if the speed of the first vehicle is the same in at least one time period, that is, the first vehicle travels at a constant speed in at least one time period, it can be determined that the weights of the weighing data corresponding to multiple moments in at least one time period are the same.
[0091] S205 . Perform weighted calculation on the weighing data corresponding to the multiple moments based on the weights of the weighing data corresponding to the multiple moments to obtain target weighing data of the first vehicle.
[0092] It can be understood that the target weighing data can be obtained by performing weighted calculation according to the weighing data corresponding to the multiple moments determined in the above step S204 and their weights.
[0093] Optionally, if different time periods within at least one time period satisfy the speed conditions required by different examples in step S204 above, for example, the first time period within at least one time period satisfies the speed condition of example one, and the second time period satisfies the speed condition of example two, then the weight of the weighing data and the target weighing data can be determined according to a preset priority, for example, example two has a higher priority than example one, and example one has a higher priority than example three. In this example, example two can be directly selected to determine the weight of the weighing data of the second time period. That is, the three examples in step S204 above can be used separately;
[0094] Alternatively, the weights of the weighing data in the first time period are calculated according to the method shown in Example 1, and the first target weighing data is obtained based on the weight calculation. The weights of the weighing data in the second time period are calculated according to the method shown in Example 2, and the second target weighing data is obtained based on the weight calculation. The first target weighing data and the second target weighing data are averaged, or the first target weighing data and the second target weighing data are weighted again, and the first target weighing data and the second target weighing data are weightedly calculated according to the weights to obtain the target weighing data. That is, the three examples in the above step S204 can be used in combination, and the embodiments of the present application do not limit this.
[0095] In this embodiment, the speed of the first vehicle at the time corresponding to each frame is determined by combining each frame of the weighing video, N-1 frames of images that are consecutive and corresponding to each frame of the image and are later than each frame of the image (i.e., N consecutive frames of images), and the time difference between the time corresponding to each frame of the image and the N-1 frame of the image. At least one time period in which the speed is less than a preset speed threshold is screened out, so that the speed in the at least one screened time period is close to 0, thereby reducing the influence of the speed on the weighing data and improving the accuracy of the subsequent determination of the target weighing data. Combined with the weighing data of the first vehicle in the at least one time period, weighing data corresponding to the first vehicle at multiple time points is determined, weights of the weighing data corresponding to the multiple time points are determined based on the speeds corresponding to the first vehicle at the multiple time points, and target weighing data of the first vehicle is obtained by weighting the weighing data based on the weights corresponding to the multiple time points. By combining the weights of the weighing data at the corresponding time points with the speed of the first vehicle when the speed is less than the preset speed threshold, the weighing conditions of the first vehicle at multiple time points in which the speed is close to 0 can be more accurately reflected. Then, weighted calculation is performed based on the weights and the corresponding weighing data, so that the determined target weighing data of the first vehicle is more accurate, thereby improving the accuracy of vehicle weighing.
[0096] The above describes the method provided by the embodiment of the present application, and the following describes the device provided by the embodiment of the present application.
[0097] Based on the same technical concept, embodiments of the present application provide a video-based vehicle weighing device, which includes modules / units / means for executing the methods performed by the electronic device in the above method embodiments. The modules / units / means can be implemented through software or hardware, or hardware can execute corresponding software implementations.
[0098] For example, Figure 6 As shown, the apparatus 600 includes:
[0099] The acquisition module 601 is used to: acquire the speed of the first vehicle at the moment corresponding to each frame of the weighing video;
[0100] The processing module 602 is used to: determine at least one time period in which the speed of the first vehicle is less than a preset speed threshold based on the speed of the first vehicle at the moment corresponding to each frame of the image, and determine the weighing data corresponding to multiple moments in the at least one time period of the first vehicle based on the weighing data of the first vehicle received in the at least one time period; determine the weights of the weighing data corresponding to the multiple moments based on the speeds corresponding to the multiple moments in the at least one time period, and perform weighted calculation on the weighing data corresponding to the multiple moments based on the weights of the weighing data corresponding to the multiple moments to obtain target weighing data for the first vehicle.
[0101] Optionally, the processing module 602 is specifically used to: identify the model information of the first vehicle through the weighing video, and obtain the original body length of the first vehicle according to the model information of the first vehicle; obtain any consecutive N frames of images from the weighing video, and determine the image offset distance of the first vehicle and the image body length of the first vehicle in the weighing video based on the first position of the first vehicle in the first frame image among the N frames of images, and the second position of the first vehicle in the Nth frame image among the N frames of images; N is a positive integer greater than 1; based on the image offset distance divided by the image body length and multiplied by the original body length, the position offset distance of the first vehicle is obtained; the time corresponding to the first frame image is earlier than the time corresponding to the Nth frame image; based on the position offset distance and the time difference between the first frame image and the Nth frame image, the speed of the first vehicle at the time corresponding to the first frame image is determined.
[0102] Optionally, the speed of the first vehicle in at least one time period is not zero or the number of consecutive times the speed of the first vehicle in at least one time period is zero is less than a preset number threshold; when determining the weights of the weighing data corresponding to multiple moments based on the speeds corresponding to multiple moments in at least one time period, the processing module 602 is configured to: for any moment in the at least one time period, calculate the weight of the weighing data corresponding to any moment according to the following first formula:
[0103] W cur =1-(V cur -V min ) / (V max -V min );
[0104] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, V cur represents the speed of the first vehicle at any moment, V min represents the minimum speed of the first vehicle during weighing, V max Indicates the maximum speed of the first vehicle during weighing.
[0105] Optionally, the number of consecutive times that the speed of the first vehicle is zero in at least one time period is greater than a preset number threshold; when determining the weights of the weighing data corresponding to multiple moments based on the speeds corresponding to multiple moments in the at least one time period, the processing module 602 is configured to: obtain at least one weighing data in the time period when the speed of the first vehicle is continuously zero; arrange the at least one weighing data in ascending order, and determine the maximum and minimum values of the at least one weighing data; and calculate, for any moment in the time period when the speed of the first vehicle is continuously zero, the weight of the weighing data corresponding to any moment according to the following second formula:
[0106] W cur =1-(Weightcur -Weight min ) / (Weight max -Weight min );
[0107] Among them, W cur Indicates the weight of the weighing data corresponding to any moment, Weight cur Represents the weighing data of the first vehicle at any moment; Weight min Indicates the minimum value of at least one weighing data, Weight max Indicates the maximum value among at least one weighing data.
[0108] Optionally, the speed of the first vehicle is the same in at least one time period; when the processing module 602 determines the weights of the weighing data at multiple moments based on the speeds corresponding to multiple moments in at least one time period, it is used to: based on the fact that the speed of the first vehicle is the same in at least one time period, determine that the weights of the weighing data corresponding to multiple moments in at least one time period are the same, and the weight is the inverse of the number of moments in at least one time period.
[0109] Optionally, before obtaining the speed of the first vehicle at the moment corresponding to each frame of image in the weighing video, the acquisition module 601 is also used to: deploy a starting point tripwire intrusion rule and an end point tripwire intrusion rule at the starting point and the end point of the weighing area respectively; the starting point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the starting point, and ends the alarm when the rear of the first vehicle passes the starting point; the end point tripwire intrusion rule starts to alarm when the front of the first vehicle is detected to pass the end point, and ends the alarm when the rear of the first vehicle passes the end point; start recording the weighing video of the first vehicle when the starting point tripwire intrusion rule ends the alarm, and end recording the weighing video of the first vehicle when the end point tripwire intrusion rule starts the alarm.
[0110] It should be understood that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.
[0111] Based on the same technical concept, see Figure 7 , an embodiment of the present application further provides an electronic device 700, including:
[0112] At least one processor 701; and a communication interface 703 in communication with the at least one processor 701; the at least one processor 701 executes instructions stored in the memory 702, so that the electronic device 700 executes the method steps performed by the billboard in the above method embodiment through the communication interface 703.
[0113] Optionally, the memory 702 is located outside the electronic device 700 .
[0114] Optionally, the electronic device 700 includes the memory 702, which is connected to the at least one processor 701, and the memory 702 contains instructions that can be executed by the at least one processor 701. Figure 7 The dotted lines indicate that the memory 702 is optional for the electronic device 700 .
[0115] The at least one processor 701 and the memory 702 may be coupled via an interface circuit or may be integrated together, which is not limited here.
[0116] The specific connection medium between the at least one processor 701, the memory 702 and the communication interface 703 is not limited in the embodiment of the present application. Figure 7 In the embodiment, at least one processor 701, a memory 702 and a communication interface 703 are connected via a bus 704. Figure 7 The bus portion may be an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Just one thick line is used, but this does not mean there is only one bus or one type of bus.
[0117] It should be understood that the processors mentioned in the embodiments of the present application can be implemented by hardware or software. When implemented by hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented by software, the processor can be a general-purpose processor that is implemented by reading software code stored in a memory.
[0118] Exemplarily, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0119] It should be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which acts as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0120] It should be noted that when the processor is a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, the memory (storage module) can be integrated into the processor.
[0121] It should be noted that the memory described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0122] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which is used to store instructions. When the instructions are executed, the computer executes the method steps executed by any device in the above method embodiments.
[0123] Based on the same technical concept, an embodiment of the present application also provides a computer program product, including computer program code. When the computer program code is run on a computer, the method steps executed by any device in the above method embodiment are implemented.
[0124] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0125] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0126] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0127] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0128] Obviously, those skilled in the art may make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include these modifications and variations.
Claims
1. A vehicle weighing method based on video, characterized in that: include: Obtaining the speed of the first vehicle at the moment corresponding to each frame of the image in the weighing video; determining, based on the speed of the first vehicle at the time corresponding to each frame of the image, at least one time period in which the speed of the first vehicle is less than a preset speed threshold, and determining, based on the weighing data of the first vehicle received during the at least one time period, weighing data corresponding to multiple time periods of the first vehicle within the at least one time period; The weights of the weighing data corresponding to the multiple moments are determined based on the speeds corresponding to the multiple moments within the at least one time period, and the weighing data corresponding to the multiple moments are weightedly calculated based on the weights of the weighing data corresponding to the multiple moments to obtain the target weighing data of the first vehicle.
2. The method according to claim 1, wherein The obtaining of the speed of the first vehicle at the moment corresponding to each frame of the weighing video includes: identifying the model information of the first vehicle through the weighing video, and obtaining the original body length of the first vehicle according to the model information of the first vehicle; Obtain any N consecutive frames of images from the weighing video, and determine an image offset distance of the first vehicle and an image body length of the first vehicle in the weighing video based on a first position of the first vehicle in a first frame of the N frames and a second position of the first vehicle in an Nth frame of the N frames, where N is a positive integer greater than 1; The position offset distance of the first vehicle is obtained by dividing the image offset distance by the image vehicle body length and multiplying the result by the original vehicle body length; the time corresponding to the first frame of image is earlier than the time corresponding to the Nth frame of image; The speed of the first vehicle at the time corresponding to the first frame image is determined according to the position offset distance and the time difference between the first frame image and the Nth frame image.
3. The method according to claim 1, wherein The speed of the first vehicle in the at least one time period is not 0 or the number of consecutive times the speed of the first vehicle in the at least one time period is 0 is less than a preset number threshold; Determining weights of weighing data corresponding to the multiple moments based on speeds corresponding to the multiple moments within the at least one time period includes: For any moment in the at least one time period, the weight of the weighing data corresponding to the any moment is calculated according to the following first formula: W cur =1-(V cur -V min ) / (V max -V min ); Among them, the W cur represents the weight of the weighing data corresponding to any moment, the V cur represents the speed of the first vehicle at any time, and the V min represents the minimum speed of the first vehicle during the weighing period, the V max represents the maximum speed of the first vehicle during the weighing period.
4. The method according to claim 1, wherein The number of consecutive times that the speed of the first vehicle is 0 in the at least one time period is greater than a preset number threshold; and determining the weights of the weighing data corresponding to the multiple moments based on the speeds corresponding to the multiple moments in the at least one time period includes: Acquire at least one weighing data of the first vehicle during a time period in which the speed is continuously zero; arrange the at least one weighing data in ascending order, and determine a maximum value and a minimum value of the at least one weighing data; For any moment in the time period when the speed of the first vehicle is continuously 0, the weight of the weighing data corresponding to the any moment is calculated according to the following second formula: W cur =1-(Weight cur -Weight m i n ) / (Weight max -Weight m i n ); Among them, the W cur Indicates the weight of the weighing data corresponding to any moment. cur represents the weighing data of the first vehicle at any time; the Weight min Indicates the minimum value of the at least one weighing data, the Weight max Indicates the maximum value of the at least one weighing data.
5. The method according to claim 1, wherein The speed of the first vehicle in the at least one time period is the same; and determining the weights of the weighing data at the multiple moments based on the speeds corresponding to the multiple moments in the at least one time period includes: Based on the fact that the speed of the first vehicle is the same in the at least one time period, it is determined that the weights of the weighing data corresponding to multiple moments in the at least one time period are the same, and the weight is the inverse of the number of moments in the at least one time period.
6. The method according to any one of claims 1 to 5, wherein: Before obtaining the speed of the first vehicle at the moment corresponding to each frame of the image in the weighing video, the method further includes: A starting point tripwire intrusion rule and an end point tripwire intrusion rule are respectively deployed at the starting point and the end point of the weighing area; the starting point tripwire intrusion rule starts an alarm when the front of the first vehicle passes the starting point, and ends the alarm when the rear of the first vehicle passes the starting point; the end point tripwire intrusion rule starts an alarm when the front of the first vehicle passes the end point, and ends the alarm when the rear of the first vehicle passes the end point; The recording of the weighing video of the first vehicle starts when the alarm of the starting point tripwire intrusion rule ends, and the recording of the weighing video of the first vehicle ends when the alarm of the ending point tripwire intrusion rule starts.
7. A video-based vehicle weighing device, characterized in that: include: An acquisition module is used to: acquire the speed of the first vehicle at the moment corresponding to each frame of image in the weighing video; a processing module, configured to: determine, based on the speed of the first vehicle at the time corresponding to each frame of the image, at least one time period in which the speed of the first vehicle is less than a preset speed threshold, and determine, based on the weighing data of the first vehicle received during the at least one time period, weighing data corresponding to multiple time periods of the first vehicle within the at least one time period; The weights of the weighing data corresponding to the multiple moments are determined based on the speeds corresponding to the multiple moments within the at least one time period, and the weighing data corresponding to the multiple moments are weightedly calculated based on the weights of the weighing data corresponding to the multiple moments to obtain the target weighing data of the first vehicle.
8. The device according to claim 7, wherein The acquisition module is specifically used for: identifying the model information of the first vehicle through the weighing video, and obtaining the original body length of the first vehicle according to the model information of the first vehicle; Obtain any N consecutive frames of images from the weighing video, and determine an image offset distance of the first vehicle and an image body length of the first vehicle in the weighing video based on a first position of the first vehicle in a first frame of the N frames and a second position of the first vehicle in an Nth frame of the N frames, where N is a positive integer greater than 1; The position offset distance of the first vehicle is obtained by dividing the image offset distance by the image vehicle body length and multiplying the result by the original vehicle body length; the time corresponding to the first frame of image is earlier than the time corresponding to the Nth frame of image; The speed of the first vehicle at the time corresponding to the first frame image is determined according to the position offset distance and the time difference between the first frame image and the Nth frame image.
9. An electronic device, characterized in that: include: a memory for storing program instructions; A processor is configured to call the program instructions stored in the memory, and execute the steps included in the method according to any one of claims 1 to 6 according to the obtained program instructions.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a computer, the method according to any one of claims 1 to 6 is implemented.