Vehicle Speed and Length Estimation Errors Using the Intelligent Transportation System with a Set of Anisotropic Magneto-Resistive (AMR) Sensors

Seeking an effective method for estimating the speed and length of a car is still a challenge for engineers and scientists who work on intelligent transportation systems. This paper focuses on a self-developed system equipped with four anisotropic magneto-resistive (AMR) sensors which are placed on a road lane. The piezoelectric polyvinylidene fluoride (PVDF) sensors are also mounted and used as a reference device. The methods applied in the research are well-known: the fixed threshold-based method and the adaptive two-extreme-peak detection method. However, the improved accuracy of estimating the length by using one of the methods, which is based on computing the difference quotient of a time-discrete signal (representing the changes in the magnitude of the magnetic field of the Earth), is observed. The obtained results, i.e., the speed and length of a vehicle, are presented for various values of the increment Δn used in numerical differentiation of magnetic field magnitude data. The results were achieved in real traffic conditions after analyzing a data set M = 290 of vehicle signatures. The accuracy was evaluated by calculating MAE (Mean Absolute Error), RMSE (Root Mean Squared Error) for different classes of vehicles. The MAE is within the range of 0.52 m–1.18 m when using the appropriate calibration factor. The results are dependent on the distance between sensors, the speed of vehicle and the signal processing method applied.


Introduction
In recent years many intelligent traffic systems have been created using data acquired from magnetic field sensors [1,2], which exploit the magnetoresistance (MR) effect [2] or the magnetoimpedance (MI) effect [3,4], inductive loops [5] or piezoelectric PVDF sensors [6] installed on a road lane.
By processing the measured data, not only the number of passing vehicles can be counted but also their speed, length and even weight can be estimated [7,8].
In previous works [9][10][11], the authors focused on developing a stationary system which was installed on a public road for measuring individual lengths and speeds and identification of vehicles. It was a built-in system operating in normal traffic conditions, which calculated parameters in real-time. Two anisotropic magneto-resistive sensors (AMR) were placed on the road lane at a distance of 0.3 m [10]. The main aim of the research was focused on the signal processing, the metrological analysis of measurement results as well as testing new algorithms aimed at reducing the calculation time of speed and length of the passing vehicles. This calculated time was shorter than 60 ms for each analyzed vehicle and the accuracy of estimating its speed and length was within the range of ±3 km/h.
A comparative analysis of the results of the determined individual speeds of vehicles traveling in road traffic and the times of executing programs based on selected calculation methods was carried out in previously published articles [9][10][11] as well. To determine the speed of vehicles, the method of detecting the delay value of two signals, with respect to each other, of different computational complexity was used. The results of a comparative analysis of many algorithms for determining the speed of vehicles were developed, not only for signals with a large sample size but also for small sample size sections [10]. Linear interpolation was proposed to be applied in order to increase the resolution of the calculated speed results. On the basis of the assessment of the relative speed results average errors (related to the values read from the radar), favorable calculation methods were selected (ensuring satisfactory accuracy with a small number of samples of the processed signal).
In another work [11], the comparative measures RMSE (Root Mean Squared Error) and NRMSE (Normalized Root Mean Squared Error) of a large set of speed results of individual vehicles obtained by a selected calculation method and a reference method (a 60 fps video camera) were developed. Four methods for detecting the delay value of two signals in relation to each other were implemented. A signal processing algorithm was developed and selected speed estimation methods were compared. The influence of changing the window width (i.e., number of samples) of the filter averaging the signals on the current basis on the size of estimated speed errors at different set threshold values of signals was investigated. The above mentioned results were obtained for two-sensor systems and it was assumed that a vehicle was passing over the sensors at a constant speed, nor accelerating or slowing down or performing steering maneuvers.
Currently, the authors propose a new solution with two-sensor pairs ( Figure 1). The system assures acquiring data with a minimum distance between sensors and is placed on a road lane. Some variants of computations enable more accurate determination of speed and length of a traveling vehicle. It was a built-in system operating in normal traffic conditions, which calculated parameters in realtime. Two anisotropic magneto-resistive sensors (AMR) were placed on the road lane at a distance of 0.3 m [10]. The main aim of the research was focused on the signal processing, the metrological analysis of measurement results as well as testing new algorithms aimed at reducing the calculation time of speed and length of the passing vehicles. This calculated time was shorter than 60 ms for each analyzed vehicle and the accuracy of estimating its speed and length was within the range of ±3 km/h. A comparative analysis of the results of the determined individual speeds of vehicles traveling in road traffic and the times of executing programs based on selected calculation methods was carried out in previously published articles [9][10][11] as well. To determine the speed of vehicles, the method of detecting the delay value of two signals, with respect to each other, of different computational complexity was used. The results of a comparative analysis of many algorithms for determining the speed of vehicles were developed, not only for signals with a large sample size but also for small sample size sections [10]. Linear interpolation was proposed to be applied in order to increase the resolution of the calculated speed results. On the basis of the assessment of the relative speed results average errors (related to the values read from the radar), favorable calculation methods were selected (ensuring satisfactory accuracy with a small number of samples of the processed signal).
In another work [11], the comparative measures RMSE (Root Mean Squared Error) and NRMSE (Normalized Root Mean Squared Error) of a large set of speed results of individual vehicles obtained by a selected calculation method and a reference method (a 60 fps video camera) were developed. Four methods for detecting the delay value of two signals in relation to each other were implemented. A signal processing algorithm was developed and selected speed estimation methods were compared. The influence of changing the window width (i.e., number of samples) of the filter averaging the signals on the current basis on the size of estimated speed errors at different set threshold values of signals was investigated. The above mentioned results were obtained for twosensor systems and it was assumed that a vehicle was passing over the sensors at a constant speed, nor accelerating or slowing down or performing steering maneuvers.
Currently, the authors propose a new solution with two-sensor pairs ( Figure 1). The system assures acquiring data with a minimum distance between sensors and is placed on a road lane. Some variants of computations enable more accurate determination of speed and length of a traveling vehicle. The goal of the research, presented in this paper, is to apply and verify a modified method for speed and length estimation which is based on a fixed or an adaptive thresholding of a signal. It relies on calculating the difference quotient of a time-discrete signal. The initial task was to set up an optimal value of the increment Δn used in numeric differentiation of magnetic field magnitude data. The goal of the research, presented in this paper, is to apply and verify a modified method for speed and length estimation which is based on a fixed or an adaptive thresholding of a signal. It relies on calculating the difference quotient of a time-discrete signal. The initial task was to set up an optimal value of the increment ∆n used in numeric differentiation of magnetic field magnitude data. Another goal is to show the differences in speed and length estimation errors which depend on the geometrical parameters of vehicles.

The Design of a Traffic Monitoring System and Sources of Speed Estimation Error
The traffic monitoring system consists of hardware and software components that are placed in different locations. The magnetic and piezoelectric sensors, their cables and a video camera with infrared illuminator cannot be deployed at a large distance. The magnetic sensors S1-S4 should be placed in the middle of the traffic lane under the surface of the roadway at the beginning of the video camera zone. The general scheme of the traffic monitoring system components deployment is presented in Figures 1 and 2. Another goal is to show the differences in speed and length estimation errors which depend on the geometrical parameters of vehicles.

The Design of a Traffic Monitoring System and Sources of Speed Estimation Error
The traffic monitoring system consists of hardware and software components that are placed in different locations. The magnetic and piezoelectric sensors, their cables and a video camera with infrared illuminator cannot be deployed at a large distance. The magnetic sensors S1-S4 should be placed in the middle of the traffic lane under the surface of the roadway at the beginning of the video camera zone. The general scheme of the traffic monitoring system components deployment is presented in Figure 1 and 2.
(a) (b) (c) Figure 2. Deployment of traffic monitoring system components on the road ((a), (b)) and a view from a traffic monitoring camera (c).

Error Due to Discretization in Time
However, there are limitations in the realization of the scheme in Figure 1, i.e., the distance between the magnetic sensors must be optimal. It is determined by several contradictory factors. The larger the distance between the sensors, the more accurately the average speed of vehicle traveling between them can be calculated (Figure 3a). The number of data points acquired during the total time elapsed is defined by the following formula: where D-distance between two sensor nodes [m], V-average speed [m/s], fs-sampling frequency [Hz]. Sampling frequency should be as high as possible. Errors resulting from the manufacturing process, which cause error of D, should be minimum. The relative error E due to discretization depends on the sampling frequency, which in this case is 2 kHz (sampling interval 0.5 ms). This error is most significant when vehicles move at higher speeds. It is defined as: (2) Obviously, increasing the distance between the sensors reduces the sampling discretization error. This error does not exceed 1.2% when sensors are distant by 2 m even at 170 km/h (Figure 3b).

Error Due to Discretization in Time
However, there are limitations in the realization of the scheme in Figure 1, i.e., the distance between the magnetic sensors must be optimal. It is determined by several contradictory factors. The larger the distance between the sensors, the more accurately the average speed of vehicle traveling between them can be calculated ( Figure 3a). The number of data points acquired during the total time elapsed is defined by the following formula: where D-distance between two sensor nodes [m], V-average speed [m/s], f s -sampling frequency [Hz]. Sampling frequency should be as high as possible. Errors resulting from the manufacturing process, which cause error of D, should be minimum. The relative error E due to discretization depends on the sampling frequency, which in this case is 2 kHz (sampling interval 0.5 ms). This error is most significant when vehicles move at higher speeds. It is defined as: Obviously, increasing the distance between the sensors reduces the sampling discretization error. This error does not exceed 1.2% when sensors are distant by 2 m even at 170 km/h ( Figure 3b). However, such a large distance causes a technical problem of situating the sensors at proper places, as their geometric configuration affects the measurement accuracy. However, such a large distance causes a technical problem of situating the sensors at proper places, as their geometric configuration affects the measurement accuracy.
(a) (b) Figure 3. The number of data points acquired in the function of vehicle speed and corresponding error due to discretization (at sampling frequency of 2 kHz): (a) the number of data points acquired at different distances between sensor nodes; (b) relative error due to discretization at different distances between sensor nodes.

Error Related to Vehicle Deceleration or Acceleration
The location of sensor nodes is an important determinant of the system performance properties [12]. A single-lane configuration and a slight intrusion in the road surface were assumed. The acceptable distance between sensors is from 0.3 m to 1.0 m, because with a greater distance, there is a possibility of additional errors due to a change in vehicle trajectories and accelerations. When the distance between the sensors is approximately 2 m and higher, the speed of a decelerating or accelerating vehicles in the sensor area will be unequal for the first magnetic sensor and the second one. These errors are less significant for vehicles at higher speeds but it should be taken into account for relatively slow moving vehicles. The average rate of acceleration of all the ordinary vehicles is between 1 m/s 2 and 4 m/s 2 [13]. Acceleration, considering real models, is varied and depends on a vehicle type and a gear number [14]. Therefore, in previous works [9][10][11], the obtained speed accuracy was determined within the range of ±3 km/h and the comparison to existing systems showed it was sufficient, keeping in mind that the distance between sensors was set to 0.3 m. Due to a low sampling frequency and a short distance between sensors, the accelerating or decelerating effect will not be analyzed in the further sections of this paper.

Trajectory Error
If the system sensors are deployed at a distance greater than 0.5 m, then there may be an error resulting from vehicle maneuvering (Figure 4). In a situation when a vehicle slip angle α is 30°, the relative error of the estimated length is about 15%. When the cars move on trajectories whose directions do not coincide with the longitudinal axis of the magnetic sensors due to the interaction between the parts of the vehicle and the sensors, the magnetic signatures at the input and at the output of the system may be different. An error occurs when the calculating time delays on the basis of such signatures. The trajectory error may occur with improper sensors installation or due to potholes in a road surface or unknown objects which cause drivers to change direction. They force drivers to turn the steering wheel while entering the sensing area. When installing magnetic sensors in places where turning is prohibited these errors can be reduced (but not eliminated).

Error Related to Vehicle Deceleration or Acceleration
The location of sensor nodes is an important determinant of the system performance properties [12]. A single-lane configuration and a slight intrusion in the road surface were assumed. The acceptable distance between sensors is from 0.3 m to 1.0 m, because with a greater distance, there is a possibility of additional errors due to a change in vehicle trajectories and accelerations. When the distance between the sensors is approximately 2 m and higher, the speed of a decelerating or accelerating vehicles in the sensor area will be unequal for the first magnetic sensor and the second one. These errors are less significant for vehicles at higher speeds but it should be taken into account for relatively slow moving vehicles. The average rate of acceleration of all the ordinary vehicles is between 1 m/s 2 and 4 m/s 2 [13]. Acceleration, considering real models, is varied and depends on a vehicle type and a gear number [14]. Therefore, in previous works [9][10][11], the obtained speed accuracy was determined within the range of ±3 km/h and the comparison to existing systems showed it was sufficient, keeping in mind that the distance between sensors was set to 0.3 m. Due to a low sampling frequency and a short distance between sensors, the accelerating or decelerating effect will not be analyzed in the further sections of this paper.

Trajectory Error
If the system sensors are deployed at a distance greater than 0.5 m, then there may be an error resulting from vehicle maneuvering (Figure 4). In a situation when a vehicle slip angle α is 30 • , the relative error of the estimated length is about 15%. When the cars move on trajectories whose directions do not coincide with the longitudinal axis of the magnetic sensors due to the interaction between the parts of the vehicle and the sensors, the magnetic signatures at the input and at the output of the system may be different. An error occurs when the calculating time delays on the basis of such signatures. The trajectory error may occur with improper sensors installation or due to potholes in a road surface or unknown objects which cause drivers to change direction. They force drivers to turn the steering wheel while entering the sensing area. When installing magnetic sensors in places where turning is prohibited these errors can be reduced (but not eliminated). Magnetic sensors are currently mounted on the longitudinal axis of the lane, but this does not mean that most cars move in the trajectory where the longitudinal axis of the car coincides with the central axis of the lane. In every sensor mounting location a vehicle trajectory survey should be performed to determine the optimum position of the magnetic sensors in relation to the axis of the lane.

Error of Time Delay Estimation
The magnetic flux density B (the magnitude of the magnetic field) is the number of magnetic lines of force passing through a unit area of material.
The AMR sensor measures the incident magnetic field B in three geometrical axes providing three corresponding components (Bx, By, Bz). The changes in the Earth magnetic field magnitude at two sensor nodes, caused by a traveling vehicle, are expressed as follows: For calculating vehicle speed, it is necessary to find the time delay between two curves (data points from two AMR sensors). The problem gets more complicated in practice as the received signal is corrupted with additive random noise. The result deeply depends on the sample size [10] and preprocessing techniques of signals (i.e., filtering, normalization). Therefore, two curves, B1 and B2, can be considered as signal s with measurement errors eB1, eB2: where n-sample number, nd-sample delay. It is commonly accepted, that for this purpose, cross-correlation is one of the most reliable methods [9]. The averaged time delay in seconds is the output of the cross-correlation function. It is given by the following formula: where ̅ -location of the highest peak of the cross-correlation function f (averaged sample delay), ts-sampling period (1/fs), l-lag (a delay in samples), N-total number of samples in the time series. The averaged sample delay corresponds to the average speed of a vehicle in the time interval between passing sensors S1 and S2 or sensors S1 and S4 (Figure 1). The algorithm for estimating a result variation in the presence of measurement errors is complicated. The analytical error estimation is presented in article [15]. The use of cross-correlation with Fast Fourier Transform (FFT) interpolation, parabolic fit interpolation or the FFT with Hilbert transform can diminish the error of the time delay estimation [16]. Another technique is proposed in the further section of this paper.

Error of Time Delay Estimation
The magnetic flux density B (the magnitude of the magnetic field) is the number of magnetic lines of force passing through a unit area of material.
The AMR sensor measures the incident magnetic field B in three geometrical axes providing three corresponding components (B x , B y , B z ). The changes in the Earth magnetic field magnitude at two sensor nodes, caused by a traveling vehicle, are expressed as follows: For calculating vehicle speed, it is necessary to find the time delay between two curves (data points from two AMR sensors). The problem gets more complicated in practice as the received signal is corrupted with additive random noise. The result deeply depends on the sample size [10] and preprocessing techniques of signals (i.e., filtering, normalization). Therefore, two curves, B 1 and B 2 , can be considered as signal s with measurement errors e B1 , e B2 : where n-sample number, n d -sample delay. It is commonly accepted, that for this purpose, cross-correlation is one of the most reliable methods [9]. The averaged time delay in seconds is the output of the cross-correlation function. It is given by the following formula: where n d -location of the highest peak of the cross-correlation function f (averaged sample delay), t s -sampling period (1/f s ), l-lag (a delay in samples), N-total number of samples in the time series. The averaged sample delay corresponds to the average speed of a vehicle in the time interval between passing sensors S1 and S2 or sensors S1 and S4 (Figure 1). The algorithm for estimating a result variation in the presence of measurement errors is complicated. The analytical error estimation is presented in article [15]. The use of cross-correlation with Fast Fourier Transform (FFT) interpolation, parabolic fit interpolation or the FFT with Hilbert transform can diminish the error of the time delay estimation [16]. Another technique is proposed in the further section of this paper.

Speed Estimation Method
The method is based on calculating derivatives of two scalar functions with respect to time. In the numerical analysis, if the samples are contained in one-dimensional (1D) arrays B 1 and B 2 , then, the difference quotients ∆B 1 and ∆B 2 can be estimated using the equation: where n-subsequent sample number in the computational algorithm, ∆n-increment in n.
As is shown in Figure 5, the difference quotient is used to calculate the slope of the secant line between two points on the graph of functions B 1 and B 2 .
The method is based on calculating derivatives of two scalar functions with respect to time. In the numerical analysis, if the samples are contained in one-dimensional (1D) arrays B1 and B2, then, the difference quotients ΔB1 and ΔB2 can be estimated using the equation: where n-subsequent sample number in the computational algorithm, Δn-increment in n.
As is shown in Figure 5, the difference quotient is used to calculate the slope of the secant line between two points on the graph of functions B1 and B2. As opposed to previously published articles [9][10][11], it was decided to differentiate the change in magnetic field magnitude signals ( Figure 6). Then, the cross-correlation function ( Figure 5) with inputs ΔB1 and ΔB2 instead of B1 and B2 was used. Signals B1 and B2 were previously affected by signal smoothing with a low-pass filter (100 Hz). Furthermore, the increment Δn plays a significant role in the obtained result of the speed and its accuracy. It will be presented in Section 4.

Length Estimation Method
Estimating a vehicle length is based on two parameters: speed and length of the signal. Since the magnetic signal magnitude rises gradually with an arriving vehicle, it is not a trivial task to accurately identify the arrival and departure moments. Several different methods were tested, and finally, it was chosen to calculate the derivative of a signal from a single sensor. The algorithm relies on the assumption that the first positive significant peak represents the vehicle front and the last negative peak-its rear part. This method is presented in Figure 7. Firstly, the derivative signal is obtained and normalized. Then, the peak finding algorithm is employed. It is crucial to identify the correct peak; therefore, there are two rules: the peak must be above/below a certain threshold value, moreover, the As opposed to previously published articles [9][10][11], it was decided to differentiate the change in magnetic field magnitude signals ( Figure 6). Then, the cross-correlation function ( Figure 5) with inputs ∆B 1 and ∆B 2 instead of B 1 and B 2 was used. Signals B 1 and B 2 were previously affected by signal smoothing with a low-pass filter (100 Hz). Furthermore, the increment ∆n plays a significant role in the obtained result of the speed and its accuracy. It will be presented in Section 4. The method is based on calculating derivatives of two scalar functions with respect to time. In the numerical analysis, if the samples are contained in one-dimensional (1D) arrays B1 and B2, then, the difference quotients ΔB1 and ΔB2 can be estimated using the equation: where n-subsequent sample number in the computational algorithm, Δn-increment in n.
As is shown in Figure 5, the difference quotient is used to calculate the slope of the secant line between two points on the graph of functions B1 and B2. As opposed to previously published articles [9][10][11], it was decided to differentiate the change in magnetic field magnitude signals ( Figure 6). Then, the cross-correlation function ( Figure 5) with inputs ΔB1 and ΔB2 instead of B1 and B2 was used. Signals B1 and B2 were previously affected by signal smoothing with a low-pass filter (100 Hz). Furthermore, the increment Δn plays a significant role in the obtained result of the speed and its accuracy. It will be presented in Section 4.

Length Estimation Method
Estimating a vehicle length is based on two parameters: speed and length of the signal. Since the magnetic signal magnitude rises gradually with an arriving vehicle, it is not a trivial task to accurately identify the arrival and departure moments. Several different methods were tested, and finally, it was chosen to calculate the derivative of a signal from a single sensor. The algorithm relies on the assumption that the first positive significant peak represents the vehicle front and the last negative peak-its rear part. This method is presented in Figure 7. Firstly, the derivative signal is obtained and normalized. Then, the peak finding algorithm is employed. It is crucial to identify the correct peak; therefore, there are two rules: the peak must be above/below a certain threshold value, moreover, the

Length Estimation Method
Estimating a vehicle length is based on two parameters: speed and length of the signal. Since the magnetic signal magnitude rises gradually with an arriving vehicle, it is not a trivial task to accurately identify the arrival and departure moments. Several different methods were tested, and finally, it was chosen to calculate the derivative of a signal from a single sensor. The algorithm relies on the assumption that the first positive significant peak represents the vehicle front and the last negative peak-its rear part. This method is presented in Figure 7. Firstly, the derivative signal is obtained and normalized. Then, the peak finding algorithm is employed. It is crucial to identify the correct peak; therefore, there are two rules: the peak must be above/below a certain threshold value, moreover, the value and the location of the local maximum must be found in a set of data. The second rule enables establishing the first/last peak just above the noise level. Furthermore, since one measurement node consists of two magnetic sensors, it enables the calculation of vehicle length from two independent signals and use those result as the average. value and the location of the local maximum must be found in a set of data. The second rule enables establishing the first/last peak just above the noise level. Furthermore, since one measurement node consists of two magnetic sensors, it enables the calculation of vehicle length from two independent signals and use those result as the average.   After detecting a vehicle, the threshold HT = −LT was calculated individually for every magnetic signature based on the normalized signal ΔBi. For this purpose, the highest peak of this signal was found and its value was multiplied by a coefficient. This coefficient represents a percentage. The results in Section 4 are presented for the threshold of 10%.

Speed Estimation Error
The methods mentioned in Section 3 were verified using a data set of the size of M = 290 vehicles. The MAE (Mean Absolute Error) is an absolute difference of the reference speed Vr and the measured speed Vp, expressed by the formula: where M-number of vehicles which equals 290, m-vehicle number in the data set.  value and the location of the local maximum must be found in a set of data. The second rule enables establishing the first/last peak just above the noise level. Furthermore, since one measurement node consists of two magnetic sensors, it enables the calculation of vehicle length from two independent signals and use those result as the average.   After detecting a vehicle, the threshold HT = −LT was calculated individually for every magnetic signature based on the normalized signal ΔBi. For this purpose, the highest peak of this signal was found and its value was multiplied by a coefficient. This coefficient represents a percentage. The results in Section 4 are presented for the threshold of 10%.

Speed Estimation Error
The methods mentioned in Section 3 were verified using a data set of the size of M = 290 vehicles. The MAE (Mean Absolute Error) is an absolute difference of the reference speed Vr and the measured speed Vp, expressed by the formula: where M-number of vehicles which equals 290, m-vehicle number in the data set. After detecting a vehicle, the threshold HT = −LT was calculated individually for every magnetic signature based on the normalized signal ∆B i . For this purpose, the highest peak of this signal was found and its value was multiplied by a coefficient. This coefficient represents a percentage. The results in Section 4 are presented for the threshold of 10%.

Speed Estimation Error
The methods mentioned in Section 3 were verified using a data set of the size of M = 290 vehicles. The MAE (Mean Absolute Error) is an absolute difference of the reference speed V r and the measured speed V p , expressed by the formula: where M-number of vehicles which equals 290, m-vehicle number in the data set.
It should be noted that V r is a value obtained due to the use of PVDF piezoelectric sensors (Roadtrax BL, Measurement Specialties Inc., Hampton, VA, USA) based on the time difference between the front and rear axles. While V p (for p = 1 . . . 5) is estimated by means of AMR sensors (LIS3MDL, STMicroelectronics Inc., Santa Clara, CA, USA), which are placed at the distance D (Table 1). The RMSE (Root Mean Squared Error) is defined as follows: Speed estimation is based on cross-correlation which is a measure of similarity of two series as a function of the displacement of one relative to the other. In Figure 9, the MAE and the RMSE of the estimated speed basing on the series of two AMR sensors distant from each other by D = 90 cm, is presented.
Speed estimation is based on cross-correlation which is a measure of similarity of two series as a function of the displacement of one relative to the other. In Figure 9, the MAE and the RMSE of the estimated speed basing on the series of two AMR sensors distant from each other by D = 90 cm, is presented. As is shown in Table 1, the MAE depends on a pair of sensors location in the system as well as the distance between them. The lowest value (MAE5) is for D = 90 cm. The lowest results are obtained when calculations are based on the data from S2 and S3 sensors (MAE3). The lowest MAE occurs for the increment Δn = 14 samples. In Table 2   As is shown in Table 1, the MAE depends on a pair of sensors location in the system as well as the distance between them. The lowest value (MAE 5 ) is for D = 90 cm. The lowest results are obtained when calculations are based on the data from S2 and S3 sensors (MAE 3 ). The lowest MAE occurs for the increment ∆n = 14 samples. In Table 2 MAE values, which were calculated for three speed ranges

Length Estimation Error
Since the system contains four sensor nodes (Figure 1), a vehicle travel time over each AMR sensor S1-S4 needed to be estimated. For each sensor the number of samples T 1 -T 4 in Table 3 represents a period of time between the first maximum and the last minimum of the derivative signal. It is depicted in Figure 7 for sensor S1. The speed V 5 is calculated with the use of the cross-correlation method and the derivative data points from sensors S1 and S4 (D = 90 cm). Lengths L 1 and L 3 are calculated according to (11). A vehicle is identified by means of a video camera. Lr is a reference length, W is a vehicle wheelbase, G is a ground clearance-all these parameters are based on the data from vehicle manufacturers. W/Lr is the wheelbase to length ratio. Lengths L 1 an L 3 are defined in meters as follows: As presented in Table 3, the differences in samples T 1 -T 4 between markers, which indicate the first significant peak and the last one, are quite large. Therefore, L 1 and L 3 are usually not equal. Lengths and their errors were computed using T 1 and T 3 data from sensor nodes S1 and S3. However, it is possible to obtain a result as their average or even the average of T 1 -T 4 . However, it would lengthen the processing time of a vehicle. This is unwanted, especially for long vehicles travelling at slow speeds. Errors based on S3 are larger than S1 ( Figure 10). The MAE measures of L 1 and L 3 are defined in the following way: As presented in Table 3, the differences in samples T1-T4 between markers, which indicate the first significant peak and the last one, are quite large. Therefore, L1 and L3 are usually not equal. Lengths and their errors were computed using T1 and T3 data from sensor nodes S1 and S3. However, it is possible to obtain a result as their average or even the average of T1-T4. However, it would lengthen the processing time of a vehicle. This is unwanted, especially for long vehicles travelling at slow speeds. Errors based on S3 are larger than S1 ( Figure 10). The MAE measures of L1 and L3 are defined in the following way: When Vr speed was used in (11), the lowest value of MAE was for the increment Δn = 10 samples but the error differences, in comparison to Δn = 14, 18, 22, were small.  When Vr speed was used in (11), the lowest value of MAE was for the increment ∆n = 10 samples but the error differences, in comparison to ∆n = 14, 18, 22, were small.
When the speeds from AMR sensors data were used in (11) and the sensors were 60 cm or 90 cm distant from each other, the obtained length errors were up to 8% lower in comparison to the 30 cm distance (Figure 11). The highest MAE was about 1.9 m. Finally, the vehicles were divided into five classes according to their length. It is difficult to find one unified vehicle classification in the world. There are commonly used terms of vehicles market segments with or without the number of axles [17]. There are also legal classifications based on interior volume index or gross vehicle weight rating. We decided to calculate the mean W/Lr ratio for every vehicle class and present it in Table 4. For the longest vehicles, it is noticeably larger.    In Table 5, the MAE values are presented for every class and for all classes together. Additionally, for classes A, B, C, the influence of the ground clearance G with W/Lr is analyzed and special cases are selected to highlight the differences. Table 5. The MAE of the estimated lengths L 1 and L 3 of all vehicles from a given class and the values of these errors for two wheelbase to the length W/Lr ratio intervals (lower and upper than the mean) and three ground clearance G intervals. As is shown in Table 6, the adaptive method based on differentiating signals causes a minor decrease of the MAE values compared to a fixed threshold-based method [6]. It is especially noticeable for the vehicles with W/Lr ≥ 0.61. However, for the vehicles with W/Lr < 0.61, a fixed threshold HT = 0.06 mT the MAE values are the lowest. The data in the tables is presented without calibration correction factors. This means that these error values can be reduced.

Correction Factor of Estimated Length
All results obtained from formula (11) were multiplied by the appropriate correction factor C f to reduce MAE: The dependence of the threshold and the correction factor on the MAE L1 is presented in Figure 12. These parameters need to be selected precisely.

MAEL3
1.68 1.40 2.27 The data in the tables is presented without calibration correction factors. This means that these error values can be reduced.

Correction Factor of Estimated Length
All results obtained from formula (11) were multiplied by the appropriate correction factor Cf to reduce MAE: The dependence of the threshold and the correction factor on the MAEL1 is presented in Figure 12. These parameters need to be selected precisely.
Minimum absolute error values were found for Cf = 0.78 and threshold HT = 0.1 hdsp (hdspthe highest derivative signal peak). As a result, about 50% error reduction was achieved (Table 7).   Minimum absolute error values were found for C f = 0.78 and threshold HT = 0.1 hdsp (hdsp-the highest derivative signal peak). As a result, about 50% error reduction was achieved (Table 7).

Summary
The speed estimation error depends on many factors. One of them is the signal processing technique used. The variability of errors due to the increment ∆n when calculating difference quotients is noticeable in Figure 9. Moreover, since the speed is calculated with the use of the cross-correlation function, decreasing the sample size of the processed signals (number of data points) may lead to higher error values. Another factor is the sensor deployment on a road lane. The MAE is the lowest (1.7 km/h) for AMR sensors deployed at the largest distance of 90 cm ( Table 1). The MAE is also the lowest at the speed range of 45 km/h-74.99 km/h ( Table 2). It is related to discretization, described in Section 2.1.
The length of a vehicle (11) is estimated based on the time differences between markers ( Figure 7) and previously evaluated speed. Every normalized derivative curve contains many peaks, which may be lower or higher. The most important activity which affects accuracy is to setup the adequate threshold. The best results are observed when the calculated length is based on the output data from sensor S1 ( Table 3). The errors of the estimated lengths L 1 and L 3 and their dependence on ∆n when calculating numerical derivative from the change in the magnetic field magnitude data points are presented in Figures 10 and 11. The MAE is the lowest when ∆n = 10 samples and D = 90 cm.
Finally, the vehicles were divided into 5 classes. The MAE of the estimated lengths of all vehicles from a given class and the values of these errors for two wheelbase to the length W/Lr ratio intervals (lower and upper than the mean for every class) and two ground clearance G intervals are presented in Table 5. These values are from 0.44 m to 2.93 m. This range is from 0.52 m to 1.18 m when using the appropriate calibration factor. The most significant difference is visible between Class C vehicles with G ≤ 0.13 m (sedans and wagons) and G ≥ 0.18 m (large SUVs). The largest values are for the longest D and E class vehicles in comparison with A, B, C class passenger cars. Differences of MAE L1 and MAE L3 for the same W/Lr and G sometimes even reach 40 cm.
The adaptive method based on differentiating signals causes a minor decrease of the MAE values compared to a fixed threshold-based method. It should be noted that one of the most important parameters is ∆n, which should be 14 samples for our data. The appropriate correction factor C f is also needed. There is almost no vehicle acceleration or deceleration effect on the MAE because the distance between sensors is small (max. 90 cm). On the other hand, there is rather no possibility to enlarge the sampling frequency. There are few digital three-axis sensors, i.e., LIS3MDL, HMC5983, LSM9DS1 and other commercial off-the-shelf products [18] with fast output rate (ODR > 80 Hz) setting.

Conclusions
Effective traffic management schemes that improve traffic flow and utilization of road infrastructure are very important at present times [19,20]. Magnetic sensors have advantages over other non-contact based sensing techniques because the weather conditions do not affect the efficiency of vehicle detection [21,22]. In the literature, the following features are indicated: the low price of detectors and simplicity of their installation. It is possible to identify the type of vehicle (car, bus, truck) because they differ in the degree of the interference field. Therefore, it seems to be necessary to create an intelligent network of sensors that acquire the changes in the Earth magnetic field magnitude. In some literature only one or two sensors are applied roadway or roadside [23,24]. They usually are used to measure vehicle speed or to detect presence of a traveling vehicle using novel algorithms [25].
The presented system contains four AMR sensors to estimate the length of vehicles. The performed research is a preliminary step before vehicle classification [26]. The piezoelectric sensors (PVDF) were used as the reference system. Based on the data from PVDF sensors, we can know precisely the number of vehicle axles and estimate wheelbases, i.e., the distance between the centers of the front and rear axles. Magnetic sensors generate more information if it is necessary to discern cars of the same class, e.g., between a sedan and an SUV. They both may have the same length and wheelbase, but height of the peaks and their location in their magnetic signatures are usually different. Ultimately, we plan that our system will work with AMR sensors only.
Errors of speed and length estimation presented in Tables 1, 2 and 5-7 are mostly the result of the imperfect trajectory of a traveling vehicle over sensors, the different construction and geometry of vehicles, the presence of ferromagnetic loads, which may be carried in trucks with trailers, the discretization of the acquired data and the noise in signals. It is worth pointing out that the visual identification of brand and model of a traveling vehicle is based on a video image and the manufacturer's data. The type of a vehicle and yawing are taken into account, but the vehicle load can change the length evaluation process.
The MAE values of the estimated speed are from 1.3 to 6.3 km/h. They depend on the distance between sensors, speed of vehicle and the filtering signals method used. As a comparison, the errors for variously constructed systems with magnetic sensors placed on the road lane at a distance D = 6 m are RMSE = 5.1 km/h, MAPE = 2.65% (MAPE -Mean Absolute Percentage Error) [27], and at a distance of 20 cm MAPE = 4.16% or 2.10% [28]. With regards to the system with induction loops, in publication [29], accuracy measures were given for four categories of vehicles: RMSE-from 2.5 km/h to 8.6 km/h, MAPE-from 1.8% to 9%.
As we can see in Table 5, the lowest MAE of the estimated length occurred for C class sedans and wagons (0.44 m). The MAE for the longest car is about 8.5% (5.2 m). The vehicle clearance G has its influence on the result, e.g., if we compare MAE values in columns 5 and 6 of class C. The largest relative MAE error is observed for class D, i.e., large VANs and minibuses. That means it equals to 25% with an average length of 7 m to 8 m. When the correction factor is used the relative error is 9.75%. The comparable error values are given in publication [30]; however, in our system the sampling frequency is five times higher, the distance D is 10 times shorter and the number of sensor nodes is eight times less.
With regards to designing a reliable transportation system, the AMR sensors are an alternative choice to magneto-impedance sensors [19], other magnetic field sensors and inductive loops. They are dedicated to measure small magnetic fields (a few mT). Due to their small size, low cost and low detection limit (nT), they are suitable for communication systems and mobile applications [2]. They can also be considered suitable to be installed in areas where inductive loops cannot be cut in the road surface [12].