# Traffic Peak Period Detection from an Image Processing View

Authors: Jianli Xiao; Hang Li; Xiang Wang; Shangcao Yuan
Journal: Journal of Advanced Transportation
 (2018)

---

## Abstract

Traffic peak period detection is very important for the guidance and control of traffic flow. Most common methods for traffic peak period detection are based on data analysis. They have achieved good performance. However, the detection processes are not intuitional enough. Besides that, the accuracy of these methods needs to be improved further. From an image processing view, we introduce a concept in corner detection, sharpness, to detect the traffic peak periods in this paper. The proposed method takes the traffic peak period detection problem as a salient point detection problem and uses the image processing strategies to solve this problem. Firstly, it generates a speed curve image with the speed data. With this image, the method for detection of salient points is adopted to obtain the peak point candidates. If one candidate has the lowest speed value, this candidate is the peak point. Finally, the peak period is gotten by moving forward and backward the corresponding time of the peak point with a time interval. Experimental results show that the proposed method has achieved higher accuracy. More importantly, as the proposed method solves the traffic peak period detection problem from an image processing view, it has more intuition.


---

## Body

## 1. Introduction

Traffic peak period detection (TPPD) has attracted more and more attentions from the researchers in intelligent transportation systems (ITS) area [1–6]. TPPD is very important for both public and traffic management departments. As for public, if the traffic peak periods have been detected, they can select the optimal travel route, which can reduce the travel time. Among traffic management departments, they can improve the ability of traffic guidance during the traffic peak periods.The idea of TPPD is that the speed, flow, and density will achieve the peaks during the traffic peak periods [7–9]. As there are interrelated relations between speed, flow, and density, any one of them can be selected to detect the traffic peak periods. For example, researchers can apply the clustering methods on the speed values to detect the peak periods.Most of the previous methods are limited to learning technologies. The clustering methods are adopted by most of the previous learning methods. Clustering methods compute the similarity of the traffic samples and assign the same labels to the samples which have the larger similarity [10, 11]. The metrics for similarity comparison [12, 13] include the Euclidean distance and city-block distance.K-means [14] and FuzzyC-means methods [15] are the most common methods used in TPPD. Clustering methods have achieved good performances. However, their performances are greatly affected by parameter initialization, for example, the initial number of the classes and the initial centers of each class. If the parameter initialization process is reasonable, the results of the clustering methods will be good; otherwise the results will be unacceptable. This defeat will lead to unsatisfactory results in TPPD. Besides that, the TPPD processes are not intuitional. That is because there are some interleaving between different classes, unless the clustering performance is good enough.In order to solve the problems above, we introduce a concept in corner detection, sharpness, to detect the traffic peak periods from an image processing view. The proposed method takes the traffic peak period detection problem as a salient point detection problem and uses the image processing strategies to solve this problem. Firstly, it employs the speed values of one road to generate a speed curve image. Then, the salient point detection method is applied on this image to obtain the peak point candidates. For all the candidates, if one candidate has the lowest speed value, this candidate is the peak point. The peak period is gotten by taking the corresponding time of the peak point as the center and moving forward and backward a time interval. Extensive experiments indicate that the proposed method has achieved higher accuracy. More importantly, as the proposed method solves the traffic peak period detection problem from an image processing view, it is very intuitional and easy to be carried out.The remaining parts of this paper are structured as follows. Section2 describes the proposed method in detail. Section 3 is devoted to empirical results. Finally, conclusions have been drawn in Section 4.


## 2. Proposed Method

### 2.1. Data Preprocessing

In order to achieve better performance, the raw traffic data afforded by Shanghai Transportation Information Center should be preprocessed first. The methods for noise elimination [16–18] and missing values completion [19, 20] are adopted to improve the quality of the traffic data. Good data quality is the guarantee of good TPPD performance. In this research, the linear interpolation method [21] is used to complete the missing traffic data, and the average smoothing method [22] is introduced to eliminate the noise data. With these two steps, the traffic data quality is improved greatly. Then, the traffic data is used to draw the speed curve, and a speed curve image is generated, which is shown in Figure 1. In this figure, the circles denote the traffic samples. Namely, they are speed values at different times. The solid line is the smoothed speed curve.Figure 1
Traffic speed data and its smooth curve.


### 2.2. Construct Peak Point Candidate Sets

In Section2.1, the speed curve image is obtained. In this section, we will present the method for generating the peak point candidate sets by introducing the sharpness concept [23, 24].According to [23], we present the definition of sharpness and use it to capture the peak point candidates. As shown in Figure 2, the solid points denote the points in the speed curve. Suppose we select one point from the speed curve and denote it as Pi. Take Pi as the center, and move forward and backward k points distance, respectively. Then, two points are obtained, and we denote them as Pi+k and Pi-k. With three points Pi-k, Pi, and Pi+k, we can do circle fitting and use the dotted line to represent the arc. O is the center of the circle. Θi is the angle between the lines PiPi-k and PiPi+k. According to experience, the integer k is selected from [310] for good detection results. As k is small enough, we can let Pi-kPi=PiPi+k, approximately. Namely, △Pi-kPiPi+k is an isosceles triangle. Meanwhile, O is the center of the circle. Thus, PiO⊥Pi-kPi+k. △Pi-kPiM and △Pi+kPiM are both right triangles.Figure 2
The enlarged view of one part of the speed curve.In△Pi-kPiM, we have(1)sin⁡∠Pi-kPiM=sin⁡Θi2=Pi-kMPi-kPi.Similarly, in △Pi+kPiM, we have(2)sin⁡∠Pi+kPiM=sin⁡Θi2=Pi+kMPi+kPi.Combine (1) and (2); we can get(3)sin⁡Θi2=Pi-kMPi-kPi=Pi+kMPi+kPi.From (3), the following formula can be derived:(4)sin⁡Θi2=Pi-kPi+kPi-kPi+PiPi+k.According to (4), we can define a sharpness variable with the following formula:(5)sharpi=1-sin⁡Θi2=1-Pi-kPi+kPi-kPi+PiPi+k,where sharpi is the sharpness value of the ith point in the speed curve.With (5), the sharpness values of each point in the speed curve can be computed. The threshold T of the sharpness can be computed as(6)T=∑i=1msharpim,where m is the total number of nonzero elements of the sharpness values.As the morning and evening peaks appear in certain periods. If we set the start time and end time manually for the morning and evening peaks according to the experience, the traffic samples which do not lie in these two periods are not the peak point candidates. For example, if we estimate the periods for morning and evening peaks appeared are, respectively, [7:00 10:00] and [16:00 20:00], only the traffic samples in these two periods can be peak point candidates. Suppose the estimated morning and evening peak periods areRam and Rpm. The rule for judging whether the ith point is a peak point candidate is(7)fsharpi=1ifsharpi≥T,ti∈Ram,Rpm0else,where f(sharpi) is a discriminant function and ti is the sampling time of the ith traffic sample. If fsharpi=1, the ith point is a peak point candidate; otherwise, the ith point is not a peak point candidate.With (7), we can judge whether one point in the speed curve is a peak point candidate. Namely, when the sharpness value of one point in the speed curve is not smaller than the sharpness threshold T and ti is in the morning peak period or the evening peak period, this point is a peak point candidate. Following this rule, we can obtain two peak point candidate sets: morning peak point candidate set and evening peak point candidate set.


### 2.3. Capture the Peak Points

In Section2.2, the morning and evening peak point candidate sets are obtained. Now, we sort the elements in the morning and evening peak point candidate sets according to their sharpness values from the maximum to the minimum, respectively. Then, we select top l samples. In these l traffic samples, if one has the smallest speed value, this traffic sample is a peak point, and the corresponding time is the peak time. With this idea, the morning peak time and evening peak time are detected.For example, we sort the traffic samples in the estimated morning (evening) peak periods. Then, we select top 9 samples and show them in Figures3(a) and 3(b). At 08:58, the speed is the smallest. Thus, this traffic sample is the peak point in the morning, which can be seen in Figure 3(c). With the same method, we can get that the evening peak time is 17:34.Figure 3
The peak points in the speed curve: (a) sorted traffic samples in the estimated morning peak period; (b) sorted traffic samples in the estimated evening peak period; (c) two peak points on the speed curve.


### 2.4. Compute the Traffic Peak Periods

The peak time is obtained in Section2.3. In this subsection, we will describe the method for computing the peak periods.In real applications, the peak periods are more important for the traffic guidance and control. The peak period is gotten by taking the corresponding time of the peak point as the center and moving forward and backward a time interval. And, the time interval is estimated manually according to the experience. In our research, the time interval is 40 minutes. For example, in Figure3(c), the morning peak time is 08:58. According to this method, the morning peak period can be computed as [08:18 09:48]. With the same method, we can also compute the evening peak period, which is [16:54 18:14].As a summary, we present the framework of the proposed method in Figure4, which affords an overview of our method.Figure 4
The framework of the proposed method.


## 2.1. Data Preprocessing

In order to achieve better performance, the raw traffic data afforded by Shanghai Transportation Information Center should be preprocessed first. The methods for noise elimination [16–18] and missing values completion [19, 20] are adopted to improve the quality of the traffic data. Good data quality is the guarantee of good TPPD performance. In this research, the linear interpolation method [21] is used to complete the missing traffic data, and the average smoothing method [22] is introduced to eliminate the noise data. With these two steps, the traffic data quality is improved greatly. Then, the traffic data is used to draw the speed curve, and a speed curve image is generated, which is shown in Figure 1. In this figure, the circles denote the traffic samples. Namely, they are speed values at different times. The solid line is the smoothed speed curve.Figure 1
Traffic speed data and its smooth curve.


## 2.2. Construct Peak Point Candidate Sets

In Section2.1, the speed curve image is obtained. In this section, we will present the method for generating the peak point candidate sets by introducing the sharpness concept [23, 24].According to [23], we present the definition of sharpness and use it to capture the peak point candidates. As shown in Figure 2, the solid points denote the points in the speed curve. Suppose we select one point from the speed curve and denote it as Pi. Take Pi as the center, and move forward and backward k points distance, respectively. Then, two points are obtained, and we denote them as Pi+k and Pi-k. With three points Pi-k, Pi, and Pi+k, we can do circle fitting and use the dotted line to represent the arc. O is the center of the circle. Θi is the angle between the lines PiPi-k and PiPi+k. According to experience, the integer k is selected from [310] for good detection results. As k is small enough, we can let Pi-kPi=PiPi+k, approximately. Namely, △Pi-kPiPi+k is an isosceles triangle. Meanwhile, O is the center of the circle. Thus, PiO⊥Pi-kPi+k. △Pi-kPiM and △Pi+kPiM are both right triangles.Figure 2
The enlarged view of one part of the speed curve.In△Pi-kPiM, we have(1)sin⁡∠Pi-kPiM=sin⁡Θi2=Pi-kMPi-kPi.Similarly, in △Pi+kPiM, we have(2)sin⁡∠Pi+kPiM=sin⁡Θi2=Pi+kMPi+kPi.Combine (1) and (2); we can get(3)sin⁡Θi2=Pi-kMPi-kPi=Pi+kMPi+kPi.From (3), the following formula can be derived:(4)sin⁡Θi2=Pi-kPi+kPi-kPi+PiPi+k.According to (4), we can define a sharpness variable with the following formula:(5)sharpi=1-sin⁡Θi2=1-Pi-kPi+kPi-kPi+PiPi+k,where sharpi is the sharpness value of the ith point in the speed curve.With (5), the sharpness values of each point in the speed curve can be computed. The threshold T of the sharpness can be computed as(6)T=∑i=1msharpim,where m is the total number of nonzero elements of the sharpness values.As the morning and evening peaks appear in certain periods. If we set the start time and end time manually for the morning and evening peaks according to the experience, the traffic samples which do not lie in these two periods are not the peak point candidates. For example, if we estimate the periods for morning and evening peaks appeared are, respectively, [7:00 10:00] and [16:00 20:00], only the traffic samples in these two periods can be peak point candidates. Suppose the estimated morning and evening peak periods areRam and Rpm. The rule for judging whether the ith point is a peak point candidate is(7)fsharpi=1ifsharpi≥T,ti∈Ram,Rpm0else,where f(sharpi) is a discriminant function and ti is the sampling time of the ith traffic sample. If fsharpi=1, the ith point is a peak point candidate; otherwise, the ith point is not a peak point candidate.With (7), we can judge whether one point in the speed curve is a peak point candidate. Namely, when the sharpness value of one point in the speed curve is not smaller than the sharpness threshold T and ti is in the morning peak period or the evening peak period, this point is a peak point candidate. Following this rule, we can obtain two peak point candidate sets: morning peak point candidate set and evening peak point candidate set.


## 2.3. Capture the Peak Points

In Section2.2, the morning and evening peak point candidate sets are obtained. Now, we sort the elements in the morning and evening peak point candidate sets according to their sharpness values from the maximum to the minimum, respectively. Then, we select top l samples. In these l traffic samples, if one has the smallest speed value, this traffic sample is a peak point, and the corresponding time is the peak time. With this idea, the morning peak time and evening peak time are detected.For example, we sort the traffic samples in the estimated morning (evening) peak periods. Then, we select top 9 samples and show them in Figures3(a) and 3(b). At 08:58, the speed is the smallest. Thus, this traffic sample is the peak point in the morning, which can be seen in Figure 3(c). With the same method, we can get that the evening peak time is 17:34.Figure 3
The peak points in the speed curve: (a) sorted traffic samples in the estimated morning peak period; (b) sorted traffic samples in the estimated evening peak period; (c) two peak points on the speed curve.


## 2.4. Compute the Traffic Peak Periods

The peak time is obtained in Section2.3. In this subsection, we will describe the method for computing the peak periods.In real applications, the peak periods are more important for the traffic guidance and control. The peak period is gotten by taking the corresponding time of the peak point as the center and moving forward and backward a time interval. And, the time interval is estimated manually according to the experience. In our research, the time interval is 40 minutes. For example, in Figure3(c), the morning peak time is 08:58. According to this method, the morning peak period can be computed as [08:18 09:48]. With the same method, we can also compute the evening peak period, which is [16:54 18:14].As a summary, we present the framework of the proposed method in Figure4, which affords an overview of our method.Figure 4
The framework of the proposed method.


## 3. Experiments

### 3.1. Dataset

In order to evaluate the performance of the proposed method, extensive experiments are performed with the GPS dataset, which is provided by Shanghai Transportation Information Center. The whole GPS data in one day is taken to perform the experiments, which contains road section ID, the longitude and latitude coordinates of the center points of each road section, the speed of each road section, and the traffic state of each road section. The GPS data is sampled from the whole road sections in Shanghai, which includes 14786073 traffic samples. The sample time and the speed values of the road sections are adopted to perform the experiments. For comparison,K-means [14] and FuzzyC-means methods [15] are also employed to perform the experiments. As the peak detection methods [25, 26] are commonly used to detect the traffic peak periods. A peak detection method, Billauer’s method [26], is adopted to perform the experiments at the same time. The true values of the morning and evening peak periods are calibrated manually.


### 3.2. Results and Discussions

Due to limitations on space, some parts of detection results are shown in Figures5–7. In these figures, the points marked with “∘” are the peak points. The corresponding time of the peak point is presented with a point on the x-axis. The red dashed line between this point and the peak point is perpendicular to the x-axis. The blue dashed line at the left of the red dashed line has a crossover point with the the x-axis, and this crossover point denotes the start time of the peak period. Also, we can find that there is a crossover point between the right blue dashed line and the x-axis, which denotes the end time of the peak period. The curves in Figures 5(a), 5(b), 6(a), 6(b), 7(a), and 7(b) present the detection results ofK-means and FuzzyC-means. For these two curves, different colors denote different classes, and “×” is the center of one class. Each curve has two circles. The left and right circles represent the morning and evening peak points, respectively.Figure 5
The detection results on Road 5.
(a)
(b)
(c)
(d)Figure 6
The detection results on Road 6.
(a)
(b)
(c)
(d)Figure 7
The detection results on Road 8.
(a)
(b)
(c)
(d)Figures5–7 show that the proposed method has achieved higher accuracy and robustness compared withK-means method, FuzzyC-means method, and Billauer’s method. In Figure 5,K-means method and FuzzyC-means method have big errors in detecting the evening peak periods. And, Billauer’s method has detected the morning and evening peak periods faultily. Figure 6 shows thatK-means method has big error in detecting the morning peak period. It also indicates that FuzzyC-means method and Billauer’s method have detected the evening peak period faultily. From Figure 7, we can see thatK-means method, FuzzyC-means method, and Billauer’s method generate big errors in the evening peak period detection.As the accuracy of the four methods is decided by the peak times they detected. We present the true vales of the peak times in one figure, which are marked with “∗”, and we also present the peak times each method detected in the same figure. All peak times are presented in minutes. For example, if the peak time is 625, it denotes 10:25. Figures 8 and 9, respectively, show the results in detecting the morning and evening peak time. In these two figures, the curves of each method are generated by connecting the peak points with line segments. Thus, the curve more close to the true values (namely, the asterisks) has higher detection accuracy. From Figures 8 and 9, we can see that the curve of the proposed method is the most close to the true values, which indicates that the proposed method has the highest accuracy and its performance is the most robust.Figure 8
Performance comparison of four methods for morning peak period detection.Figure 9
Performance comparison of four methods for evening peak period detection.


## 3.1. Dataset

In order to evaluate the performance of the proposed method, extensive experiments are performed with the GPS dataset, which is provided by Shanghai Transportation Information Center. The whole GPS data in one day is taken to perform the experiments, which contains road section ID, the longitude and latitude coordinates of the center points of each road section, the speed of each road section, and the traffic state of each road section. The GPS data is sampled from the whole road sections in Shanghai, which includes 14786073 traffic samples. The sample time and the speed values of the road sections are adopted to perform the experiments. For comparison,K-means [14] and FuzzyC-means methods [15] are also employed to perform the experiments. As the peak detection methods [25, 26] are commonly used to detect the traffic peak periods. A peak detection method, Billauer’s method [26], is adopted to perform the experiments at the same time. The true values of the morning and evening peak periods are calibrated manually.


## 3.2. Results and Discussions

Due to limitations on space, some parts of detection results are shown in Figures5–7. In these figures, the points marked with “∘” are the peak points. The corresponding time of the peak point is presented with a point on the x-axis. The red dashed line between this point and the peak point is perpendicular to the x-axis. The blue dashed line at the left of the red dashed line has a crossover point with the the x-axis, and this crossover point denotes the start time of the peak period. Also, we can find that there is a crossover point between the right blue dashed line and the x-axis, which denotes the end time of the peak period. The curves in Figures 5(a), 5(b), 6(a), 6(b), 7(a), and 7(b) present the detection results ofK-means and FuzzyC-means. For these two curves, different colors denote different classes, and “×” is the center of one class. Each curve has two circles. The left and right circles represent the morning and evening peak points, respectively.Figure 5
The detection results on Road 5.
(a)
(b)
(c)
(d)Figure 6
The detection results on Road 6.
(a)
(b)
(c)
(d)Figure 7
The detection results on Road 8.
(a)
(b)
(c)
(d)Figures5–7 show that the proposed method has achieved higher accuracy and robustness compared withK-means method, FuzzyC-means method, and Billauer’s method. In Figure 5,K-means method and FuzzyC-means method have big errors in detecting the evening peak periods. And, Billauer’s method has detected the morning and evening peak periods faultily. Figure 6 shows thatK-means method has big error in detecting the morning peak period. It also indicates that FuzzyC-means method and Billauer’s method have detected the evening peak period faultily. From Figure 7, we can see thatK-means method, FuzzyC-means method, and Billauer’s method generate big errors in the evening peak period detection.As the accuracy of the four methods is decided by the peak times they detected. We present the true vales of the peak times in one figure, which are marked with “∗”, and we also present the peak times each method detected in the same figure. All peak times are presented in minutes. For example, if the peak time is 625, it denotes 10:25. Figures 8 and 9, respectively, show the results in detecting the morning and evening peak time. In these two figures, the curves of each method are generated by connecting the peak points with line segments. Thus, the curve more close to the true values (namely, the asterisks) has higher detection accuracy. From Figures 8 and 9, we can see that the curve of the proposed method is the most close to the true values, which indicates that the proposed method has the highest accuracy and its performance is the most robust.Figure 8
Performance comparison of four methods for morning peak period detection.Figure 9
Performance comparison of four methods for evening peak period detection.


## 4. Conclusions

In this research, we propose a new method to detect the traffic peak period. Different from the classical methods, the proposed method is from an image processing view, which introduces a concept in corner detection, sharpness, to detect the traffic peak period. It employs the speed values of one road to generate a speed curve image. With this image, the methods for detection of salient points in image processing are adopted to find the peak point candidates. If one candidate has the lowest speed value, this candidate is the peak point. The peak period is gotten by taking the corresponding time of the peak point as the center and moving forward and backward a time interval. Extensive experiments indicate that the proposed method has a higher accuracy. More importantly, as the proposed method solves the traffic peak period detection problem from an image processing view, it has more intuition. We believe that this method can be easily applied on the traffic peak period detection.



---

*Source: 2097932-2018-02-15.xml*