Preprocessing: Added functions for outlier and anomaly detection.#535
Preprocessing: Added functions for outlier and anomaly detection.#535awestphal1 wants to merge 39 commits intoPedestrianDynamics:mainfrom
Conversation
…correct adjustments
JuleAdrian
left a comment
There was a problem hiding this comment.
I left a few comments concerning the notebook.
I could not check all details of the maths, but we discussed about it and according to your examples, it seems to work.
| "for i in range(len(changed_index_orig)):\n", | ||
| " original_trajectory = trajectory_data.data[trajectory_data.data[\"id\"] == changed_index_orig[i]]\n", | ||
| " trajectory_corrected = trajectory_data_corrected.data[trajectory_data_corrected.data[\"id\"] == changed_index_new[i]]\n", | ||
| " pedpy.plot_trajectories(\n", |
There was a problem hiding this comment.
Some comments about the plots being made:
- Can you choose PedPy colors?
- The colors you chose have not enough contrast. At least on my screen, I cannot really distinguish between black and blue trajectories (see attached example). Please adjust the colors.
- Please include a legend (which color represents what?)
- Idea: Include titles to the plots stating which type of error wad detected.
There was a problem hiding this comment.
Done. I tried to find a combination of two PedPy colors, that works with light- and with darkmode. I did not add a title, because depending on the parameters a trajectory could have outliers and a displacement later, so it is difficult to define a clear type.
| " max_distance_wall=0.05,\n", | ||
| " back_distance_wall=-0.5,\n", | ||
| ")\n", | ||
| "print(\"Valid after: \", pedpy.is_trajectory_valid(traj_data=valid_trajectory, walkable_area=walk_area))" |
There was a problem hiding this comment.
It would be nice to include two plots, the not corrected and the corrected trajectories.
There was a problem hiding this comment.
Done. I added two exemplary plots to give an idea of how the function modifies the trajectory. I will add a plotting function to the notebook, similar to the one used for outlier detection, when I include a list of modified person IDs in the return values.
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "traj_data_low_tolerance = pedpy.detect_anomalies_in_trajectories(\n", |
There was a problem hiding this comment.
From the description above, it is not clear what the parameters do that you use in this example. Can you include parameters that you use in the description?
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #529
Sometimes, due to tracking problems, anomalies occur in the trajectory data, such as outliers or vertical displacements, where the tracker loses the person and continues tracking something else instead.
The function detects and handles such anomalies by correcting outliers and cropping the trajectory data of a single person ID if a displacement is found.
The blue line is the original trajectory, the red one the corrected one.