Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zarifikram #7

Open
wants to merge 167 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
3a09dbe
first exp
adhocmaster Jul 28, 2022
72c72f3
added the feature to show frames with pedestrian's only
adhocmaster Jul 28, 2022
6c65547
Merge branch 'pedestrians-only'
adhocmaster Jul 29, 2022
f225ce3
fixed frame rate for ped only visualization
adhocmaster Jul 29, 2022
b5c325c
Merge branch 'pedestrians-only'
adhocmaster Jul 29, 2022
d6601a3
writing loader
adhocmaster Jul 30, 2022
3eb71c4
Update extractor-test.ipynb
adhocmaster Jul 30, 2022
e37c10f
filter done
adhocmaster Jul 30, 2022
9c55031
more utility functions
adhocmaster Aug 17, 2022
7ed56b5
Update extractor-test.ipynb
adhocmaster Aug 18, 2022
fd80cec
trajectory viewer for ped
adhocmaster Aug 22, 2022
0e2c42a
ped jump done.
adhocmaster Aug 24, 2022
0eba720
18 done
adhocmaster Aug 24, 2022
6a095af
Update ped-trajectory-viewer.ipynb
adhocmaster Sep 4, 2022
e128007
documentation and crossing filter
adhocmaster Sep 5, 2022
938f36c
crossing data across location recordings
adhocmaster Sep 5, 2022
4602aef
coped track visualizer to ped visualizer
adhocmaster Sep 5, 2022
eb029c4
doc refactored
adhocmaster Sep 5, 2022
9a5466a
Merge remote-tracking branch 'upstream/master' into sync1
adhocmaster Sep 5, 2022
159ec1f
Merge branch 'extractors' into sync1
adhocmaster Sep 5, 2022
c5be9c9
doc update
adhocmaster Sep 5, 2022
3741eb4
visualization for location crossing
adhocmaster Sep 5, 2022
5c7d891
docs
adhocmaster Sep 5, 2022
af09c55
next is scene id
adhocmaster Sep 5, 2022
2372b42
viz doc
adhocmaster Sep 5, 2022
7a869ba
scene locations for location 2
adhocmaster Sep 6, 2022
6778d31
Update Untitled.ipynb
adhocmaster Sep 6, 2022
60f96e1
scene box needs rotation
adhocmaster Sep 8, 2022
435a4ce
trajectory clipping is done
adhocmaster Sep 15, 2022
be38a49
clipping done
adhocmaster Sep 15, 2022
80981a3
Update SceneData.py
adhocmaster Sep 17, 2022
e4f29da
Update SceneData.py
adhocmaster Sep 19, 2022
b9b0719
coordinate translation done for positions
adhocmaster Sep 21, 2022
c626ed8
Update extractor-test.ipynb
adhocmaster Sep 21, 2022
536b81b
done a lot
adhocmaster Sep 22, 2022
e272166
updated read me
adhocmaster Sep 23, 2022
eb2966e
Update README.md
adhocmaster Sep 23, 2022
4ba1e3f
missing scene config
adhocmaster Sep 23, 2022
e75c19e
updated git ignores. hand ind in repo now
adhocmaster Sep 23, 2022
17583ac
improved documentation on notebooks
adhocmaster Sep 24, 2022
f12cc48
scene based extractor
adhocmaster Sep 26, 2022
5ea48a5
working on scene extraction
adhocmaster Sep 27, 2022
88d7e69
documentation
adhocmaster Sep 27, 2022
98fa1de
organized scene ids and fix scene 11
adhocmaster Sep 27, 2022
3ffb7cc
Update extractor-by-scene-config.ipynb
adhocmaster Sep 27, 2022
0f71784
summary. fixes
adhocmaster Sep 28, 2022
eee6d67
done extracting. next pattern analysis
adhocmaster Sep 28, 2022
6e54182
updates
adhocmaster Sep 28, 2022
d2aad5d
scene merging by road width
adhocmaster Sep 29, 2022
cd59a6d
fix
adhocmaster Sep 30, 2022
34018a5
update gitignore
adhocmaster Sep 30, 2022
1e10a24
fix
adhocmaster Sep 30, 2022
dc52e27
updated
adhocmaster Oct 4, 2022
71cb8d5
more visualization. there are some outliers!
adhocmaster Oct 5, 2022
9711d14
Update trajectory-transformer.ipynb
adhocmaster Oct 5, 2022
9bebb48
updated read me
adhocmaster Nov 11, 2022
3a8d36d
initial scenario builder
adhocmaster Nov 11, 2022
6faea07
plan for bulder
adhocmaster Nov 11, 2022
2564ade
refactoring
adhocmaster Nov 11, 2022
7e021cd
other extracted
adhocmaster Nov 11, 2022
9740a11
location data fixed
adhocmaster Nov 11, 2022
821d9c5
file naming
adhocmaster Nov 12, 2022
f423c5f
refactoring, updated read me
adhocmaster Nov 12, 2022
fbb1ee7
more docs
adhocmaster Nov 12, 2022
02936c0
Update LocationData.py
adhocmaster Nov 12, 2022
d30f270
fps on process
adhocmaster Nov 13, 2022
98f66bd
down sampling done
adhocmaster Nov 13, 2022
359c082
progress on downsampling
adhocmaster Nov 13, 2022
41621ef
bug fix
adhocmaster Nov 13, 2022
b86ae12
methodology started
adhocmaster Nov 13, 2022
73c88e9
docs and export by scene
adhocmaster Nov 13, 2022
91d8135
Update read-from-preprocessed.ipynb
adhocmaster Nov 13, 2022
86403ab
more docs
adhocmaster Nov 13, 2022
b261132
Update PedScenarioBuilder.py
adhocmaster Nov 14, 2022
ced9dad
unit testing scenario builder
adhocmaster Nov 14, 2022
3456e9e
bug fix
adhocmaster Nov 14, 2022
add5cf1
working one method
adhocmaster Nov 14, 2022
88441f2
scene data exports
adhocmaster Nov 20, 2022
f31afc0
ignored zipped
adhocmaster Nov 20, 2022
8e2b0b8
fix clip parameters
adhocmaster Nov 22, 2022
496c06c
working on velocity
adhocmaster Nov 22, 2022
8dc17b0
added end marker
adhocmaster Nov 23, 2022
af06b21
pedMeta done
adhocmaster Nov 23, 2022
ba4a674
scene meta complete. next job would be using directions to rotate traj
adhocmaster Nov 23, 2022
0ef195f
helper methods to get track directions
adhocmaster Nov 25, 2022
57b7668
doc fix
adhocmaster Nov 25, 2022
152f9d0
started better read me
adhocmaster Nov 25, 2022
0cdfb64
doc
adhocmaster Nov 25, 2022
a92d0d4
updated read me
adhocmaster Nov 25, 2022
68c3536
visualization
adhocmaster Nov 25, 2022
9f14363
TODO for horizontal peds
adhocmaster Nov 25, 2022
3ff79a8
need to re-clip local trajectories
adhocmaster Nov 25, 2022
1cd553a
velocity and acceleration done
adhocmaster Nov 25, 2022
e694888
speed makes it difficult at 2.5 fps
adhocmaster Nov 25, 2022
f20aefe
working on direction filter
adhocmaster Nov 25, 2022
66828d5
why some scene data went missing?
adhocmaster Nov 25, 2022
3cdc500
fix
adhocmaster Nov 25, 2022
31cba2b
better summary
adhocmaster Dec 1, 2022
13c2ba9
fixed issue with _pedLocal and _clipped. we need to remove local ones
adhocmaster Dec 1, 2022
5aa9d49
2.5 fps is is too low for running pedestrians. As some pedestrians mo…
adhocmaster Dec 1, 2022
b6fd8ae
we need to explore why some trajectories are deleted in clip stage
adhocmaster Dec 1, 2022
b3b9360
2.5 fps is too low. Build with 5 fps
adhocmaster Dec 1, 2022
b45cdd0
updated exported attrs
adhocmaster Dec 1, 2022
1e2a651
gotta fix a lot
adhocmaster Dec 2, 2022
528bb11
Update debug.ipynb
adhocmaster Dec 2, 2022
33a8ccb
added warnings to sceneData
adhocmaster Dec 2, 2022
88010fa
doc updated
adhocmaster Dec 2, 2022
7a13b8e
refactoring clip
adhocmaster Dec 2, 2022
0818a77
refactor working. added problematic id
adhocmaster Dec 2, 2022
9ca73b1
we need to break up multiple entries into single entries
adhocmaster Dec 2, 2022
c7ab5d3
added sceneId to uniqueTrackId
adhocmaster Dec 2, 2022
8ae40bd
little bug
adhocmaster Dec 3, 2022
3f04fea
lil more
adhocmaster Dec 3, 2022
4f9b028
sceneId int?
adhocmaster Dec 3, 2022
9bbcef0
Update extractor-by-scene-config.ipynb
adhocmaster Dec 3, 2022
261027d
bug fix with sceneid/ gotta fix clip method which uses original track id
adhocmaster Dec 3, 2022
30ad55f
update
adhocmaster Dec 7, 2022
3aeaadd
wip local coordinate system
adhocmaster Dec 11, 2022
641b05d
issue with reentry
adhocmaster Dec 11, 2022
84a35c9
wip local
adhocmaster Dec 11, 2022
6b13203
updates
adhocmaster Dec 13, 2022
f05ec1e
# TODO it's too slow, do everything on original data
adhocmaster Dec 14, 2022
a152a17
important env fix
adhocmaster Dec 16, 2022
21356da
fast ped
adhocmaster Dec 16, 2022
03dc00a
Merge branch 'extractors' of https://github.com/adhocmaster/drone-dat…
adhocmaster Dec 16, 2022
f498dab
split done
adhocmaster Dec 17, 2022
3bc0233
min track length set to 0.1 as peds may stop
adhocmaster Dec 17, 2022
425d443
no long is too long
adhocmaster Dec 17, 2022
fd8930b
fix
adhocmaster Dec 17, 2022
0991278
now debugging other data
adhocmaster Dec 17, 2022
487ae92
fixed car
adhocmaster Dec 17, 2022
f3a5b52
min for other is 0.2
adhocmaster Dec 23, 2022
991dafd
shapley fixxed
adhocmaster Dec 23, 2022
a256af3
docs update
adhocmaster Mar 3, 2023
da8c807
tasks updated on the dataset
adhocmaster Mar 3, 2023
9da015c
Update README.md
adhocmaster Mar 8, 2023
ab1cd2f
parameterize location data
adhocmaster Mar 16, 2023
6313f0e
python version
adhocmaster Mar 16, 2023
9ecac84
updated colMapper
adhocmaster Mar 16, 2023
d2cff84
Update .gitignore
zarifikram Mar 16, 2023
4be6e2a
fix None sceneData
adhocmaster Mar 16, 2023
36cfd20
Values
zarifikram Mar 16, 2023
1aa378d
Merge branch 'zarifikram' into extractors
adhocmaster Mar 16, 2023
33bcd11
update
adhocmaster Mar 16, 2023
9746e89
debug print
zarifikram Mar 16, 2023
3b3bfeb
more clear modes
adhocmaster Apr 7, 2023
e6860fc
Wrote getPedDf(), wrote a new ipynb for my work
zarifikram Apr 10, 2023
2bc2a96
location 4 done
zarifikram Apr 13, 2023
dc77672
Data Extractor Works
zarifikram Apr 13, 2023
82458ce
Location added
zarifikram May 4, 2023
6943180
Create loc-2.psd
adhocmaster May 4, 2023
a02e901
Merge branch 'extractors' into zarifikram
zarifikram May 4, 2023
eceeeb0
Merge pull request #5 from adhocmaster/zarifikram
zarifikram May 4, 2023
57ddbb1
Digit bug fixed
zarifikram May 4, 2023
1767eb7
downsample param
adhocmaster May 4, 2023
2554a8e
re ided the scene annottions
adhocmaster May 4, 2023
2a242bb
build local information
adhocmaster May 4, 2023
d41cfd8
problem with outliers
adhocmaster May 8, 2023
ae92166
Merge branch 'extractors' into zarifikram
zarifikram May 8, 2023
0aeb930
Merge branch 'extractors' into zarifikram
zarifikram May 8, 2023
204b97d
something is wrong in speed outliers
adhocmaster May 12, 2023
c63da61
added lost track in warnings and problematic ids
adhocmaster May 12, 2023
ae21cb9
bugs
adhocmaster May 12, 2023
4c7e1c2
Merge branch 'extractors' into zarifikram
zarifikram May 12, 2023
b7bed50
more fix
adhocmaster May 17, 2023
477a1e8
config updated
zarifikram May 17, 2023
423c877
Merge branch 'extractors' into zarifikram
adhocmaster Sep 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
.idea/
data/
*.csv
*.pyc
*.mp4
*.dill
*.dll
*.zip
data/ind
*.ai
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "C:\\Users\\adhocmaster\\anaconda3\\envs\\drone-dataset-tools38\\python.exe"
}
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Drone-Dataset Tools


The goal of this repository is to make using [drone datasets](https://www.drone-dataset.com/) as easy as possible.
Therefore, we provide source code in Python for import and visualization.
Thus, this source code not only allows to visualize trajectories and thus get an overview, but also serves as a template for your own projects.

## Extractor documentation:
Read the documentation [here](./doc/extractors.md) for the extractor API.
Read the documentation [here](./doc/visualization.md) for the visualization API..

## Installation and Quick Start

1. Create a new Python environment or select a pre-existing one.
Expand Down Expand Up @@ -90,6 +95,7 @@ All available options are listed in the following table:
| `--annotate_orientation` | `False` | Annotate every track by its current orientation. |
| `--annotate_age` | `False` | Annotate every track by its current age. |
| `--show_maximized` | `False` | Show the track Visualizer maximized. Might affect performance. |
| `--ped_only` | `False` | Only render frames with pedestrians and a button to jump to the next pedestrian's initial frame. |

*Please note that drawing additional features may decrease the playback animation update rate.*

Expand Down
Binary file added data/.DS_Store
Binary file not shown.
Binary file added data/crossing.zip
Binary file not shown.
194 changes: 194 additions & 0 deletions data/scenes/ind.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
{
"2": {

"210": {
"centerXPixel": 628.5,
"centerYPixel": 286.5,
"centerX": 61.44,
"centerY": -28.01,
"angle": 12.17,
"roadWidth": 5.0,
"boxWidth": 10.0
},

"211": {
"centerXPixel": 688.5,
"centerYPixel": 273.5,
"centerX": 67.30,
"centerY": -26.74,
"angle": 12.17,
"roadWidth": 5.0,
"boxWidth": 5.0
},

"220": {
"centerXPixel": 383.5,
"centerYPixel": 322.5,
"centerX": 37.49,
"centerY": -31.53,
"angle": 16.0,
"roadWidth": 6.0,
"boxWidth": 15.0
},

"221": {
"centerXPixel": 302.5,
"centerYPixel": 345.5,
"centerX": 29.57,
"centerY": -33.77,
"angle": 16.0,
"roadWidth": 9.0,
"boxWidth": 15.0
},

"222": {
"centerXPixel": 188.5,
"centerYPixel": 375.5,
"centerX": 18.43,
"centerY": -36.71,
"angle": 16.0,
"roadWidth": 9.0,
"boxWidth": 20.0
},

"230": {
"centerXPixel": 490.5,
"centerYPixel": 392.5,
"centerX": 47.95,
"centerY": -38.36,
"angle": 111.79,
"roadWidth": 6.0,
"boxWidth": 15.0
},

"231": {
"centerXPixel": 518.5,
"centerYPixel": 461.5,
"centerX": 50.67,
"centerY": -45.11,
"angle": 111.79,
"roadWidth": 6.0,
"boxWidth": 10.0
},

"240": {
"centerXPixel": 450.5,
"centerYPixel": 180.5,
"centerX": 44.04,
"centerY": -17.64,
"angle": 134.74,
"roadWidth": 6.0,
"boxWidth": 10.0
}

},

"4":{

"440": {
"centerXPixel": 700,
"centerYPixel": 499,
"centerX": 106.68,
"centerY": -76.05,
"angle": 26.11,
"roadWidth": 18.0,
"boxWidth": 50.0
},

"441": {
"centerXPixel": 1085,
"centerYPixel": 315,
"centerX": 165.35,
"centerY": -48.01,
"angle": 23.74,
"roadWidth": 18.0,
"boxWidth": 25.0
},

"430": {
"centerXPixel": 908.28,
"centerYPixel": 240.47,
"centerX": 138.42,
"centerY": -36.65,
"angle": 84.42,
"roadWidth": 18.0,
"boxWidth": 40.0
}
},

"1":{

"140": {
"centerXPixel": 663.27,
"centerYPixel": 230.52,
"centerX": 64.84,
"centerY": -22.53,
"angle": 49.09,
"roadWidth": 6.0,
"boxWidth": 15.0
},

"130": {
"centerXPixel": 716.38,
"centerYPixel": 498.85,
"centerX": 70.03068040678744,
"centerY": -48.765745722836925,
"angle": 132.18,
"roadWidth": 6.0,
"boxWidth": 30.0
},

"131": {
"centerXPixel": 414.91,
"centerYPixel": 166.13,
"centerX": 40.56007929811019,
"centerY": -16.240259270191235,
"angle": 132.18,
"roadWidth": 6.0,
"boxWidth": 30.0
},

"120": {
"centerXPixel": 522.15,
"centerYPixel": 400.08,
"centerX": 51.043468235299784,
"centerY": -39.11035290927653,
"angle": 45,
"roadWidth": 6.0,
"boxWidth": 10.0
}
},

"3":{

"340": {
"centerXPixel": 596.30,
"centerYPixel": 523.31,
"centerX": 58.292100179468086,
"centerY": -51.156865579267894,
"angle": 51,
"roadWidth": 20.0,
"boxWidth": 6.0
},

"330": {
"centerXPixel": 525.85,
"centerYPixel": 207.48,
"centerX": 51.40516666002566,
"centerY": -20.28248355733027,
"angle": 14.84,
"roadWidth": 6.0,
"boxWidth": 6.0
},

"331": {
"centerXPixel": 583.68,
"centerYPixel": 267.57,
"centerX": 57.05841528215987,
"centerY": -26.156661487540294,
"angle": 82.85,
"roadWidth": 2.0,
"boxWidth": 6.0
}
}
}
3 changes: 3 additions & 0 deletions data/scenes/ind_crazy_pedestrians.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"19": [19, 40, 47, 49, 75, 125, 150, 178, 232, 242, 282, 283, 288, 302, 341, 343]
}
3 changes: 3 additions & 0 deletions data/scenes/ind_invalid_pedestrians.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"19": [41, 63]
}
78 changes: 78 additions & 0 deletions doc/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Pedestrian trajectory extraction and processing

This tool provides extraction and processing scripts for jaywalker trajectories. It currently extracts data from InD dataset. But the approach can be used for any BEV dataset.

## Architecture & Tutorials
1. [Methodology for Extraction](extractors-methodology.md)
2. [Quick start](how-to-use.md)
3. [Extractors](extractors.md)
4. [Visualization tools](visualization.md)
5. [Threads to validity](threats-to-validity.md)

## Goal

The raw dataset has pedestrian and vehicle trajectories. The following figure shows the pedestrian trajectories. The goal of this project is to extract pedestrians that cross the road and clip their trajectories to the interesting zone only.
<img src="./images/location2-raw.PNG" width="600">

In the following figures, the purple ones are complete trajectories and the blue ones are clipped to the crossing area of the road.
<img src="./images/location-2-scene-10-all.PNG" width="600">
<img src="./images/location-2-scene-21-all.PNG" width="600">



## Scene coordinate system:
<img src="./images/scene-coordinate-system.PNG" width="600">

The original data has position and dynamics in the image coordinate system which is the top-left pixel of the background image. Our extracted data transforms trajectories into scene coordinate system where the origin is at the center of the scene bounding box and x axis is rotated counter-clockwise to aligh with the road reference line (length).

So, our scene data looks like this (plotted in the image coordinate system)
<img src="./images/scene-data.PNG" width="600">

## Issues with the data
The dataset is annotated by a model trained with a deep learning object tracking method. So, it sometimes fail to classify and track objects correctly. Our exploratory analysis discovered some issues with the dataset:

1. Unrealistic paths - there are long pedestrian trajectories that run along the road (over 50 meters). There is a high probability that bicyles or scooters are classified as pedestrians.
2. Unrealistic speed - Some pedestrians seems to be too fast. Interestingly, then can run as fast as 30 km/h which professional atheletes or sprintters can achieve on track or in the field. We re-labeled them as fast_pedestrian as they interact with other traffic participants.
3. Incomplete trajectories - Pedestrians can pop up or vanish in the middle of the road. This happens when tracking fails. In the following example we have a trajectory that was both started and ended in the middle of the road. We cannot simply omit these trajectories as they interact with other trajectories.

<img src="./images/incomplete-trajectory.PNG" width="600">

## Interesting Patterns in midblocks
1. Sharpe and unpredictable change in direction
2. Lateral displacement is significant
3. Wide variety of patterns in the paths.

<img src="./images/incomplete-trajectory.PNG" width="600">

## Derived Data

**Additional attributes for track**

| Attribute | Description |
| --- | ------ |
| uniqueTrackId | Unique track identifier in a location. First two digits denote the recordingId and last three digits denote the trackId in the recording. |
| sceneId | Every scene in a location has a sceneId |
| roadWidth | Approximate road width along the scene y-axis |
| sceneX | track x position in the scene coordinate system |
| sceneY | track y position in the scene coordinate system |

**Scene meta data**

The meta data is developed in clipped trajectories in the scene coordinate system.

| Attribute | Description |
| --- | ------ |
| uniqueTrackId | Unique track identifier in a location. First two digits denote the recordingId and last three digits denote the trackId in the recording. |
| initialFrame | starting frame in the recording |
| finalFrame | ending frame in the recording |
| numFrames | Life span in frames. Depends on the FPS of the data. |
| class | type of the actor |
| horizontalDirection | Positive x is EAST |
| verticalDirection | Positive y is NORTH |


## Application
1. Trajectory inpainting or forking - helps the partial trajectories recorded in dashcams.
2. Scenario reconstruction and dataset augmentation
3. Generative behavior modeling

Binary file added doc/diagrams-plans.pptx
Binary file not shown.
27 changes: 27 additions & 0 deletions doc/extractors-methodology.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Extracting by scene configuration

We define a scene as a rectangular area on the road where interesting pedestrian crossing behavior can be found. A scene configuration has the center of the area in world coordinates, and a wdith and height. Reactangular areas have two sides running parallel to the road's center line.

Overall steps:
1. create some scene configuration (bounding boxes of scene areas)
2. Create splines from trajectories.
3. Keep the trajectories that overlaps with the scene bounding boxes. To do that, we only check overlap of trajectories with the middle half of the bounding boxes.
4. Clip trajectories within 1 meter of the bounding box sides.


For location 2, here goes the bounding boxes. The data is available [here](../data/scenes/ind.json).

<img src="./images/location-scene-annotation.png" width="600">


# Steps

```mermaid
flowchart TD
LocRec[Get recordings for a location] --> Down[Downsample recording data from 25.0 fps to 2.5 fps]
Down -- List of RecordingData --> Scene[Get Scene trajectories for each RecordingData]
Scene --> div[Divide trajectories between pedestrian and non-pedestrian data]
div --> comb[Combine data by scene]
comb --> Export

```
Loading