Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c0eae3f
merge real trajectory
WuJiang5521 Nov 30, 2023
d47656b
using real context
WuJiang5521 Dec 1, 2023
2cfb20d
1. real context
WuJiang5521 Dec 2, 2023
ceccf4f
add storyline and matrix
WuJiang5521 Dec 6, 2023
2547821
allow switch map style
WuJiang5521 Dec 6, 2023
18f601e
add interactions to matrix
WuJiang5521 Dec 6, 2023
465b436
add one more map style
WuJiang5521 Dec 6, 2023
579bd24
add one more map style
WuJiang5521 Dec 7, 2023
548d592
optimize storyline layout
WuJiang5521 Dec 7, 2023
b48fc72
allow time window
WuJiang5521 Dec 7, 2023
3696838
design change
ychen3221 Dec 7, 2023
323f26d
Merge remote-tracking branch 'origin/design_change_yueqiao'
WuJiang5521 Dec 7, 2023
e8b2865
improve the visualization for attention on context group
WuJiang5521 Dec 7, 2023
2ccf0c2
improve map view by:
WuJiang5521 Dec 7, 2023
4f87cda
better projection
WuJiang5521 Dec 7, 2023
2457485
trajectory / window adjustment
ychen3221 Dec 20, 2023
004cf2d
Update PredictedTrajectoryLayer.jsx
ychen3221 Dec 20, 2023
64274d4
update timeline
WuJiang5521 Dec 21, 2023
e4587f5
visual optimization
WuJiang5521 Jan 4, 2024
bc09e7e
add load & save function
WuJiang5521 Jan 4, 2024
bcdc155
add storyline opacity
WuJiang5521 Jan 4, 2024
ce97ce5
add traj summary matrix
WuJiang5521 Jan 11, 2024
0b1c669
Merge remote-tracking branch 'origin/trajectory-refinement'
WuJiang5521 Jan 11, 2024
93a4c70
context-change
ychen3221 Jan 12, 2024
5787049
add traj summary matrix
WuJiang5521 Jan 17, 2024
ff78dfe
Merge remote-tracking branch 'origin/trajectory-refinement'
WuJiang5521 Jan 17, 2024
6c2cb15
add comparison selection
WuJiang5521 Jan 17, 2024
a2ba339
add comparison selection
WuJiang5521 Jan 17, 2024
8bea888
add hero icon pictures
WuJiang5521 Jan 17, 2024
2347602
add hero icon
WuJiang5521 Jan 17, 2024
cefe33e
keep trajectory style consistent with the time window
WuJiang5521 Jan 17, 2024
7b74887
fix bug: the layout cannot adapt to window resize
WuJiang5521 Jan 17, 2024
2582dd6
allow to change the layout of map matrix based on the trajectory dire…
WuJiang5521 Jan 17, 2024
b1b1df0
allow sort the context groups
WuJiang5521 Jan 18, 2024
c820f4c
allow multiple view
WuJiang5521 Jan 18, 2024
c361875
add time info on traj
WuJiang5521 Jan 19, 2024
3256556
Fix bug: the image will not display sometimes
WuJiang5521 Jan 23, 2024
2e98653
save map style into case file
WuJiang5521 Jan 23, 2024
7572c80
update:
WuJiang5521 Jan 23, 2024
84c1394
update: add traj direction on projection point
WuJiang5521 Jan 24, 2024
ddf33cb
update: improve the interface for worker tag management
WuJiang5521 Jan 24, 2024
d8759e1
update: allow global projection order adjustment
WuJiang5521 Jan 24, 2024
0a71494
update: comparison in map matrix
WuJiang5521 Jan 24, 2024
8e617e3
update: move prediction action to system title bar
WuJiang5521 Jan 24, 2024
9959ba2
update: two styles of matrix
WuJiang5521 Jan 24, 2024
b4ae128
update: allow to view a strategy by hovering the convex hull
WuJiang5521 Jan 24, 2024
43d780e
update: multiple visualizations for different contextual factors
WuJiang5521 Jan 25, 2024
2c12f68
context-view
ychen3221 Jan 25, 2024
02d9493
Merge remote-tracking branch 'origin/trajectory-refinement'
WuJiang5521 Jan 25, 2024
77d977e
solve conflicts
WuJiang5521 Jan 25, 2024
cbceb5b
debug
ychen3221 Jan 25, 2024
1648464
fix bug: cannot sort context groups when selecting only the compared …
WuJiang5521 Jan 25, 2024
e482bf0
Merge remote-tracking branch 'origin/context-debug'
WuJiang5521 Jan 25, 2024
f6bf7a2
update: better layout for projection with d3-force
WuJiang5521 Feb 6, 2024
8d04b38
update: highlight the label at hovered time
WuJiang5521 Feb 6, 2024
157e7c7
update: improve storyline layout algorithm
WuJiang5521 Feb 13, 2024
8eb7521
context view update
ychen3221 Feb 27, 2024
ab00a58
update: thinner storyline
WuJiang5521 Feb 27, 2024
5009013
Merge remote-tracking branch 'origin/context-limit-update'
WuJiang5521 Feb 27, 2024
5317768
polish design
WuJiang5521 Mar 9, 2024
d092137
update
WuJiang5521 Mar 31, 2024
3cfc213
update
WuJiang5521 Mar 31, 2024
3e23284
update
WuJiang5521 Mar 31, 2024
9356f93
update
WuJiang5521 Mar 31, 2024
453744d
update case
WuJiang5521 Mar 31, 2024
b3a6630
update package.json
WuJiang5521 Apr 12, 2024
f41f551
Update README.md
WuJiang5521 Nov 7, 2024
04ede09
Merge pull request #8 from via-cs/WuJiang5521-patch-3
Christinacyq Nov 9, 2024
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
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
# Auto detect text files and perform LF normalization
* text=auto
case/secret_tundra.json filter=lfs diff=lfs merge=lfs -text
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Data
*.json
*.psd

# Logs
logs
Expand Down
40 changes: 13 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
# RoadSign for DOTA 2
## T-Foresight

## How to start it
#### This is the repository for submission T-Foresight: Interpret Moving Strategies based on Context-Aware Trajectory Prediction.

1. install `NodeJS`
2. install `yarn`
3. run `yarn install` command
4. run `yarn run dev` command
5. visit `http://127.0.0.1:5173`
This repository provides the source codes.

## Main techniques used
### How to run it

- [React](https://react.dev/): UI framework
- [MobX](https://mobx.js.org/README.html): Data management
- [MUI](https://mui.com/material-ui/getting-started/): UI elements
- [Konva](https://konvajs.org/docs/react/Intro.html): Canvas drawing
- [I18N](https://react.i18next.com/): Change the language (we need an English version in our paper, and a Chinese version for user study)
We have a frontend (T-Foresight, in the folder `frontend\`) and a backend (the implementation of our proposed analytics workflow, in the folder `backend\`).
To save your review time, we provide the analysis progress of our domain experts for review (in the folder `case\`), so that you can just run the frontend and explore our system.

## Project structures
**Frontend**. Our frontend is built based on Vite, React, and MobX. You can run it in three steps.
1. *Install dependencies*. Please run `cd frontend` to change the root directory as `frontend\` and then run `yarn install` to install necessary dependencies.
2. *Run the interface*. Run `run dev` to start the user interface and open `http://localhost:5173` in your explorer (Chrome is recommended). Now, you can see the user interface.
3. *Load the data*. At the app bar, click on `IMPORT DATA` and select the file `case\secret_tundra.json` to load the game. Then click on `IMPORT CASE` and select one of the other two files, either `secret_tundra-case1.json` or `secret_tundra-case2.json`, to load the analysis progress. Now, you can explore the case!

- `src/components` is for some common and reusable UI elements
- `src/model` declares the data structure
- `src/store` declares the data center
- `src/utils` consists of some tool functions
- `src/views` contains the main UI designs

## Example files

Here are some example files with detailed comments, which demonstrate how the code works.

- `src/store/store.js` demonstrates how we manage the data
- `src/store/App.jsx` demonstrates how we render the views based on data
- `src/model/D2Data.d.ts` demonstrates how we define data types
**Backend**. Our backend is build based on FastAPI. You can use it in two steps.
1. *Install dependencies*. Please run `cd backend` to change the root directory as `backend\` and run `pip install -r requirements.text` to install necessary packages.
2. *Run the server*. Please run `uvicorn main:app --reload` to start the server. But we cannot upload our dataset since it is so large. So you cannot use the functions of the backend.
53 changes: 53 additions & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
from fastapi import FastAPI

from src.alg.data import search_inst, search_similar_inst
from src.alg.interpret import aggregate_workers, proj, extend_stage
from src.model.model import Model

app = FastAPI()


@app.post("/prediction")
async def root(data):
game_name = data["gameName"]
team_id = data["teamId"]
player_id = data["playerId"]
frame = data["frame"]
context_limit = data["contextLimit"]

inst = search_inst('./data', game_name, team_id, player_id, frame)
similar_inst = search_similar_inst('./data', inst, team_id, player_id, context_limit)

model = Model.load('./model/v3')
feature_vectors = [[] for _ in model.workers]
stages = []
for simi_inst in similar_inst:
predictions = model.predict(simi_inst)
feature_vectors_4_single_inst = [[] for _ in model.workers]
for i, worker_pred in enumerate(predictions):
fv = []
for g_name in worker_pred['attention']:
for i_name in worker_pred['attention'][g_name]:
fv.append(worker_pred['attention'][g_name][i_name])
for pos in worker_pred['trajectory']:
fv.append(pos[0])
fv.append(pos[1])
feature_vectors[i].extend(fv)
feature_vectors_4_single_inst[i].extend(fv)

pred_groups = aggregate_workers(feature_vectors_4_single_inst)
extend_stage(stages, pred_groups)

pred_groups = aggregate_workers(feature_vectors)
pred_projection = proj(pred_groups, feature_vectors)

return {
"predictions": model.predict(inst),
"predGroups": pred_groups,
"predProjection": pred_projection,
"predInstances": {
"stages": stages,
"numPredictors": model.K,
"totalInstances": len(similar_inst)
},
}
12 changes: 12 additions & 0 deletions backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
fastapi==0.11.0
numpy==1.16.3
numba==0.43.1
scipy==1.2.1
matplotlib==3.0.3
scikit-learn==0.20.3

--find-links https://download.pytorch.org/whl/cu118

torch==2.2.2
torchvision==0.17.2
torchaudio==2.2.2
Loading