Pedestrian Trajectory Prediction
Can a phone's motion and location sensors predict where a pedestrian will walk next, without roadside cameras? I recorded the data in 2021 and built the planned models in 2026.
The question
"Learning an Unwalked Path" was my research project in the University of Arizona's McNair Achievement Program. It asks whether the phone already in a pedestrian's pocket can predict where they will walk next, without roadside cameras. The motivation is safety: 6,205 pedestrians were killed in U.S. traffic crashes in 2019 (NHTSA).
At a glance
- Program
- McNair Achievement Program
- Recorded
- Two walks, 2021
- Phone
- iPhone 12 Pro Max, 25 Hz
- Models
- Five families, 2026
In 2021 I designed the sampling, recorded two walks, analyzed the signals and presented a talk and poster in August; the models were chosen but never trained. In 2026 I trained every planned model family on one walk and tested it on the other. Every model result on this page comes from 2026.
Watch the predictions (2026 models)
A recorded walk across campus, with each model's guess of where the walker would be next drawn against where they went. Pick a model and a look-ahead from the menu, or zoom out to the whole walk.
0:00meters off
| ahead | now | whole walk | ||
|---|---|---|---|---|
| LSTM | CV | LSTM | CV | |
The phone now, and the last 60 s
Loading the walk…
Error along the walk, predicting 10 s ahead
Close-up: following the walker
The heavy line is where the walker went over the next 30 s. The solid line is the LSTM prediction and the dashed line keeps walking straight; the large dots are 10 s ahead.
The phone beside the numbers is the walker's, seen from their right with the arrow pointing the way they walked; its bob with each step is exaggerated. bounce is the spread of vertical acceleration, turn is rotation about the vertical. Map data © OpenStreetMap contributors.
About this replay: the 2021 walk, with the 2026 models' predictions computed offline
Every second, each model looks at the previous 30 seconds and predicts where the walker will be 1, 2, 5, 10, 20 and 30 seconds later. The models were trained on the other walk, and the predictions were computed offline in Python; this page only draws them. The heavy line is the smoothed GPS track the models are scored against (the Kalman filter's backward pass); both guesses start from the phone's real-time estimate (its forward pass), and where no GPS fixes arrived there is nothing to score.
The route color follows the square root of the selected model's error on one scale for every walk, model and look-ahead, so maps can be compared; the error strip is scaled to the 99th percentile of what it shows. The phone is drawn from its own attitude estimate, turned to true north and then to the direction of travel; its bob is vertical acceleration with gravity removed, exaggerated, not measured height. Map data © OpenStreetMap contributors.
Collecting the data (2021)
I generated random "routines" modeled on a student's or instructor's day on campus: one parking lot, five classrooms and two eateries, starting and ending at parking. The walker visited each stop in order but chose the path freely, so the motion stayed natural.
An iPhone 12 Pro Max in the walker's front right pocket logged acceleration, rotation rate, heading and GPS at 25 Hz: 267,135 data points over 113 and 65 minutes of walking, one walk in jeans and one in gym shorts.
First look at the signals (2021)
Moving averages of the raw signals showed three things. Clothing changed the signal: Z acceleration pointed in opposite directions between the two routines. Large changes in acceleration lined up with decisions at the curb. And GPS was the weak input, inconsistent near large buildings and when the walker stopped.
Building the models (2026)
I kept the 2021 plan's five model families and its test: train on one routine, predict the other. A Kalman filter corrects the GPS. Its forward pass uses only past fixes, as a phone would in real time, and feeds the models; its backward pass gives the reference path for scoring.
Each model sees the last 30 seconds: filtered position and velocity, plus motion summaries such as phone bounce, step rhythm and turning rate, rotated to the direction of travel. The families are symbolic regression, an extreme learning machine (ELM), a 1-D CNN, an LSTM and a transformer, with ridge regression as a linear reference. The benchmark is constant velocity (keep walking straight at the current speed), which is known to be hard to beat for pedestrians. The score is mean distance in meters from the reference path.
What the models found (2026)
Each bar is one model's mean error compared with constant velocity; left of the line is better.
- better than constant velocity
- worse
- ± 1 standard deviation over five training seeds
Show the numbers as a table
Up close, constant velocity is hard to beat: one and two seconds ahead it is off by 0.9 to 2.2 m, and the best models are within a few percent of it either way. Further out the models pull ahead: thirty seconds ahead, ridge regression, the LSTM and the transformer are 10 to 19% better, about 15.5 m against 17.5 m on walk 2, and 19.3 to 20.6 m against 23.7 m on walk 1.
The numbers
| Constant velocity, 1 and 2 s ahead | 0.9 to 2.2 m |
|---|---|
| Ridge regression, LSTM and transformer, 30 s ahead | 10 to 19% better |
| Walk 2, 30 s ahead | about 15.5 mconstant velocity 17.5 m |
| Walk 1, 30 s ahead | 19.3 to 20.6 mconstant velocity 23.7 m |
| LSTM, 10 s ahead, before a turn, stop or start | 9.2 mconstant velocity 12.6 m |
The gain comes from turns, stops and starts. Ten seconds ahead on walk 2, before a turn, stop or start, the LSTM is off by 9.2 m and constant velocity by 12.6 m; on straight stretches they are even. Motion sensors alone carry real signal: given only motion summaries and the direction of travel, the CNN and the LSTM beat constant velocity by 12 to 16% at 30 seconds.
The simplest models held their own. Ridge regression, which is linear, matched or beat the three neural networks; with about three hours of data from one person, a bigger model has nothing extra to learn from. And clothing mattered. Networks trained on the jeans walk did worse than constant velocity on the gym-shorts walk until I rescaled the motion features by each walk's own first five minutes, a calibration a phone could do on its own.
What the formulas say
Symbolic regression searches for a short, readable formula instead of fitting weights. It kept arriving at formulas this small:
forward in 1 s ≈ GPS speedforward in 10 s ≈ 2 × bouncesideways in 10 s ≈ −(turning over the last 10 s)
Distances are in meters. bounce is the spread of the phone's vertical acceleration: about 6 m/s² while walking, near zero standing still, so the formula is a walking detector with a scale attached.
What I took from it
Measure against the simplest baseline first. Most of the time people keep walking, so constant velocity is usually right; a model earns its cost only at the turns, stops and starts.
Write down the odd things in exploratory plots; they come back. The clothing flip I noted in 2021 was why the 2026 networks first lost to the baseline, and rescaling by each walk's first five minutes fixed it. With this little data, a linear model and good features did as well as anything deep.
The limits are plain. Two walks by one person can't separate the clothing effect from the route or the day, or say how the models would do for someone else. And the reference is smoothed GPS, not surveyed ground truth: errors of a meter or two at the 1 and 2 second horizons are within its own precision.
Where it goes next
I have a traffic safety study planned but not started. One design it considers would run this pipeline on public datasets of many pedestrians and repeat the turn, stop and start analysis, to see whether the result holds for strangers at the curb. Another would map where and when Tucson pedestrians are hit, giving this page its local context.
Want the details behind this one, or to talk about similar work?


