Prediction of Road Surface Quality during Cycling Using Smartphone Accelerometer Data †

Many cyclists use online-maps for planning their routes, however, only little information is known about the road surface of different cycling paths, farm or public roads. Cyclists prefer road surfaces fitting the type of bike they are using for a specific ride (e.g., time trial, road, MTB, cyclocross, gravel bike). Often riders upload their ride data including GPS, heart rate (HR) or power (P) on platforms like Strava or Garmin Connect. In this research we tried to evaluate whether it is possible to (1) evaluate the road surface quality using a 3D accelerometer mounted on the bicycle’s fork (f = 500 Hz) and whether (2) results of similar quality can be achieved using the accelerometer of a smartphone (f = 100 Hz) placed in the cyclist’s pocket. For data acquisition a cyclist rode on a cyclocross bicycle on three different road surfaces (cobblestones, gravel and tarmac) with three different speeds (10, 20 and 30 km/h) and three different tire pressures (3, 4 and 5 bar). Data of both measuring systems were analyzed using machine learning algorithms. Results showed that road surfaces could be predicted with more than 99% accuracy with the accelerometer and with more than 97% with the smartphone-data.


Introduction
The popularity of cycling has increased within the last decades, whereas the bicycle is now the first choice as a means of transportation in many countries worldwide due to its practical application, efficiency, low costs and related health benefits [1]. Along with its increasing demand, a necessity for planning and constructing safe bicycle paths has arisen. As it is a quite costly process, cyclists' route choices have often been surveyed in order to obtain reliable data which would favor the cyclists' needs and demands. Among the demands, comfort seems to be highly desired when choosing a path [2].
It has further been agreed that factors such as environmental, mechanical, biomechanical and physiological influences all impact the level of cycling comfort [3]. Of these, environmental factors such as traffic, lane width and geometry along with the surroundings have shown to significantly affect cyclists' assessment of the bicycle path comfort [4]. Different road surfaces affect cyclists' perception of comfort differently, whereas smoother surfaces are generally preferred yielding optimal comfortable features for riding and thereby requiring lower energy output. Oppositely, rougher road types that are less comfortable and harder to ride have shown to discourage certain cyclists from riding upon such surfaces [2,5,6].
Therefore, research has lately been concentrated around bicycle comfort, for which has been widely regarded as one of the most important aspects, commonly investigated through various vibration tests [1]. It has further been found that of the common types of road surfaces, tarmac exhibits the highest level of comfort, while also it decreases with increasing velocity [5]. Giubilato and Petrone [7] studied the vibration response to road surface, while they also showed that the level of comfort for different wheels varies with the road surface and speed.
However, regarding cycling as a sport the demands of athletes on road surface type and quality differ from those of commuters and leisure-time cyclists. Many athletes want to ride certain surface types (e.g., off-road, gravel-roads, tarmac) depending on the type of bike they are using. They would go for smooth tarmac if riding a time trial bicycle, for gravel roads with their gravel or cyclocrossbikes and off-road with mountain-bikes. Many of these cyclists use online route-planning for longer rides. However, most of the websites (cf. www.strava.com) use popularity of routes for planning by collecting the smartphone or GPS-device data of uploaded rides, but do not give any information on road surface type or quality. Hence adding information about road type and quality could improve individualized routing options for cyclists planning their ride.
In this research we tried to evaluate whether it is possible to (1) evaluate the road surface quality using a 3D accelerometer mounted on the bicycle's fork and whether (2) results of similar quality can be achieved using the accelerometer of a smartphone placed in the cyclist's pocket. Figure 1 shows the measurement setup of the bicycle, where a Merida 500 cyclocross bicycle of frame size 52 cm was used (measurement setup and trials conducted are described in more detail in the work of Christensen [8]). A tri-axial capacitance accelerometer (MMA7260Q, Freescale Semiconductor, Austin, TX, USA) was securely strapped to the front fork of the bicycle ( Figure 1). For data storage a data-logger (Logomatic v2, SparkFun Electronics, Boulder, CO, USA) was used with a sensitivity of 200 mV/g, acceleration range ± 6.0 g and sampling with a frequency of 500 Hz. The attached accelerometer was mounted in a tilted orientation determined to be 18.66° from vertical. Furthermore, a Samsung Galaxy S4 mini Smartphone (Samsung, Daegu, KOR), running Android 6.0 (Google LLC, Mountain View, CA, USA), was placed in the back pocket of the test subject's pants while conducting the test trials. The smartphone was recording data through the application Physics Toolbox Sensor Suite (Vieyra Software, Washington, DC, USA) and sampling with a frequency of 100 Hz.

Materials and Methods
All measurements were conducted the same day, where the following surfaces were tested: cobblestones, gravel, and tarmac ( Figure 2). The surfaces generally showed similarity in structure and condition, where straight and flat sections of approximately 100 m were selected for testing. Each surface, three different speeds (10, 20, 30 km/h) and three tire pressures (3, 4, 5 bar) were tested resulting in nine trials per surface. Data files from the data-logging device were exported as .txt files, while recordings from the smartphone were exported as .csv files. Data was processed in Matlab 2017b (The MathWorks Inc., Natick, MA, USA). Data were trimmed to contain the vibrational test trials only and an offset correction for all channels was conducted thus resulting in acceleration values oscillating around zero. The acceleration signals were then divided into time windows containing one or two seconds of the data acquired, respectively.
Additionally two different classification parameters were added to the feature list. Firstly 27 unique classifiers including surface, tire pressure and riding velocity, secondly only three unique classifiers consisting of the three surfaces examined.
After having prepared the data in the fashion mentioned above, machine learning algorithms (MLA) were applied onto the datasets. A classification learner routine was conducted with the two different classifiers and all features. This was done for the features extracted from both the one and two second windows for acceleration sensor as well as phone data. Firstly the 27 unique classifiers, secondly only three classifiers were applied using a total of 22 different machine learning algorithms from the categories decision tree, linear and quadratic discriminant, support vector machine (SVM) and k nearest neighbor (kNN). For validation a 5-fold cross validation was used, the algorithm showing the best prediction accuracy was chosen and confusion matrices plotted.
Furthermore the number of features was reduced and the most successful MLA was performed again to evaluate whether a result of similar accuracy could be achieved with fewer features.

Results
The results of the machine learning algorithms applied to the data showed distinctive differences depending on the sensor, the size of the time window and the number of classifiers used for the classification learner (Table 1). Table 1. Classification learner results for different datasets, window-sizes (ws), unique classifiers (class) and number of features (feat). MLA is the name of the most accurate machine learning algorithm (MLA) along with its prediction accuracy in percent (acc). The datasets differ in used sensor (a-sensor and phone) and size of the time windows (WS: 1 s or 2 s). As expected, a finer classification (i.e., using 27 unique classifiers) resulted in less accuracy of the model than using only 3 unique classifiers. Whereas for the acceleration sensor data for both number of classifiers high prediction accuracy could be reached (27 classifiers: >95%, 3 classifiers: >99%), for phone data 27 classifiers yielded accuracy less than 50%. The results for classification with only three classifiers yielded more than 97% of prediction accuracy. Furthermore, it could be noted, that window-sizes of 1 s mostly resulted in less accuracy than larger window-sizes of 2 s.
However, when closer inspecting the confusion matrix for phone data for 27 classifiers, it was observed that although many predictions were not correct they were mainly confused between different speeds and pressure settings but the surface type itself was still correctly classified ( Figure 3b) which is highlighted by the red squares.
For a-sensor data only few observations were classified incorrectly (Figure 3a). Figure 4 shows the resulting confusion matrices when only 3 classifiers (cobblestones, gravel, tarmac) were used. For both sensor systems (a-sensor: Figure 4a and phone: Figure 4b) only few predictions were incorrect. It was interesting to observe, however, that a feature reduction nearly always immediately resulted in a decrease of prediction accuracy.

Discussion
The main purpose of this study was to determine whether road surface quality could be quantified and therefore the type of road surface identified by using algorithm parameters that are applied momentarily. We wanted to (1) evaluate the road surface quality using a 3D accelerometer and find out whether (2) results of similar quality can be achieved using the acceleration sensor of a smartphone placed in the cyclist's pocket.
For this purpose data were collected on different surfaces, with different speeds, and tire pressures. They were analyzed ex-post using machine learning algorithms, with either 27 classifiers (3 surfaces, 3 speeds, 3 tire pressures), or three classifiers (3 surfaces). A total of 64 features for different time-windows were extracted from the data and used for classification learning. Results showed that when 27 classifiers and a time-window of one second are used it was possible to correctly identify more than 97% of the data with the acceleration sensor, but less than 50% with the phone. In case only three classifiers are used more than 97% can be correctly identified with both systems (a-sensor: 99.2%, phone: 97.7%).
It is concluded that road surface (cobblestones, gravel, tarmac) can be predicted with high accuracy when using an acceleration sensor mounted on the fork with a recording frequency of 500 Hz (up to 99.2% correctly classified) and that furthermore even different speeds and tire pressures along with surface can be classified correctly (up to 97.9%, cf. Figure 3a). Using the smartphone sensor's data accuracy for 27 classifiers was less successful resulting only in 48.2% of correctly classified data. However, it has to be noted that the surface still could be identified correctly and mostly different riding speeds and tire pressures were confused (cf. Figure 3b), these results are also supported by the confusion matrix for 3 classifiers (Figure 4b) where a total of 97.7% could be classified correctly as being cobblestones, gravel or tarmac.
From these results it can be concluded that given the data collected and analyzed so far it is possible to identify the surface correctly with data from a smartphone worn in a cyclist's pocket. It has to be pointed out, however, that this study has only limited explanatory power given the low number of observations. Future research should include more bicycle types (e.g., road, mountain) and different placements of the smartphone in the cyclist's pocket (e.g., front pocket, cycling jersey's back-pocket, backpack). Whether it will be possible to quantify different quality grades for one surface needs to be examined in further trials.

Conflicts of Interest:
The authors declare no conflict of interest.