Skip to content

Commit aafc3dc

Browse files
authored
CC-3DT++ for CR-3DT. (#142)
* feat: Update CC-3DT++. * feat: Support CC-3DT++ for CR-3DT * feat: Update CC-3DT++ and config refactor. * fix: Fix test.
1 parent 1688775 commit aafc3dc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+583
-145
lines changed

README.md

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<!-- pypi-strip -->
33
<picture>
44
<!-- /pypi-strip -->
5-
<img alt="vis4d" src="https://dl.cv.ethz.ch/vis4d/vis4d_logo.svg" width="400">
5+
<img alt="vis4d" src="docs/source/_static/vis4d_logo.svg" width="400">
66
<!-- pypi-strip -->
77
</picture>
88
<!-- /pypi-strip -->
@@ -12,7 +12,7 @@
1212

1313
## Quickstart
1414

15-
You can checkout our [documentation](https://docs.vis.xyz/4d/index.html).
15+
You can checkout our [documentation](https://vis4d.readthedocs.io).
1616

1717
You can use the [template](https://github.com/SysCV/vis4d-template) here to start your own project with Vis4D.
1818

@@ -24,7 +24,7 @@ Installation is as easy as
2424
python3 -m pip install vis4d
2525
```
2626

27-
[For more detailed information, check out our installation guide](docs/source/user_guide/install.rst)
27+
[For more detailed information, check out our installation guide](https://vis4d.readthedocs.io/en/latest/user_guide/install.html)
2828

2929
## Basic CLI usage
3030

@@ -33,19 +33,13 @@ python3 -m pip install vis4d
3333
```bash
3434
# vis4d.engine
3535
vis4d fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
36-
37-
# vis4d.pl
38-
vis4d-pl fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
3936
```
4037

4138
- To test a model
4239

4340
```bash
4441
# vis4d.engine
4542
vis4d test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
46-
47-
# vis4d.pl
48-
vis4d-pl test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
4943
```
5044

5145
## DDP
@@ -55,43 +49,27 @@ vis4d-pl test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
5549
- Local machine / SLURM interactivate job (`job-name=bash`)
5650

5751
```bash
58-
# vis4d.engine
59-
./scripts/dist_train.sh <config-file> <num-gpus>
60-
61-
# vis4d.pl
62-
vis4d-pl fit --config <config-file> --gpus <num-gpus>
52+
vis4d fit --config <config-file> --gpus <num-gpus>
6353
```
6454

6555
- SLURM
6656

6757
```bash
68-
# vis4d.engine
69-
srun vis4d fit --config <config-file> --gpus <num-gpus> --slurm True
70-
71-
# vis4d.pl
72-
srun vis4d-pl fit --config <config-file> --gpus <num-gpus>
58+
srun vis4d fit --config <config-file> --gpus <num-gpus>
7359
```
7460

7561
### Testing
7662

7763
- Local machine / SLURM interactivate job (`job-name=bash`)
7864

7965
```bash
80-
# vis4d.engine
81-
./scripts/dist_test.sh <config-file> <num-gpus>
82-
83-
# vis4d.pl
84-
vis4d-pl test --config <config-file> --gpus <num-gpus>
66+
vis4d test --config <config-file> --gpus <num-gpus>
8567
```
8668

8769
- SLURM
8870

8971
```bash
90-
# vis4d.engine
91-
srun vis4d test --config <config-file> --gpus <num-gpus> --slurm True
92-
93-
# vis4d.pl
94-
srun vis4d-pl test --config <config-file> --gpus <num-gpus>
72+
srun vis4d test --config <config-file> --gpus <num-gpus>
9573
```
9674

9775
## Acknowledgement

docs/source/user_guide/visualization.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@
270270
},
271271
{
272272
"cell_type": "code",
273-
"execution_count": 10,
273+
"execution_count": null,
274274
"metadata": {},
275275
"outputs": [
276276
{
@@ -286,7 +286,7 @@
286286
],
287287
"source": [
288288
"img = draw_masks(images[1], masks[1], class_ids = class_ids[1])\n",
289-
"img = draw_bboxes(img, boxes[0], class_ids = classes[0], scores = scores[0], track_ids = tracks[0], class_id_mapping = {1 : \"Human\", 51: \"Pan\"})\n",
289+
"img = draw_bboxes(img, boxes[0], class_ids = classes[0], scores = scores[0], track_ids = tracks[0], class_id_mapping = {1 : \"Human\", 51: \"Pan\"}).as_numpy_image()\n",
290290
"imshow(img)"
291291
]
292292
},

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,10 @@ dependencies = {file = ["requirements/install.txt"]}
136136
include = ["vis4d*"]
137137

138138
[project.urls]
139-
"Documentation" = "https://docs.vis.xyz/4d"
139+
"Documentation" = "https://vis4d.readthedocs.io"
140140
"Source" = "https://github.com/syscv/vis4d"
141-
"Tracker" = "https://github.com/syscv/"
141+
"Tracker" = "https://github.com/syscv/vis4d/issues"
142142

143143
[project.scripts]
144144
vis4d = "vis4d.engine.run:entrypoint"
145-
vis4d-pl = "vis4d.pl.run:entrypoint"
146145
vis4d-zoo = "vis4d.zoo.run:entrypoint"

scripts/eval_nusc/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# nuScenes 3D Detection and Tracking Evaluation
2+
3+
This folder contains the code and python environment to run nuScenes 3D detection and tracking evaluation locally.
4+
5+
### Installation
6+
- Python: 3.6
7+
8+
```bash
9+
pip install -r nusc.txt
10+
```
11+
12+
### Run
13+
```bash
14+
# Detection
15+
python run.py \
16+
--input $FOLDER_OF_PREDICTION \
17+
--version $VERSION \
18+
--dataroot $NUSC_DATA_ROOT \
19+
--mode detection
20+
21+
# Tracking
22+
python run.py \
23+
--input $FOLDER_OF_PREDICTION \
24+
--version $VERSION \
25+
--dataroot $NUSC_DATA_ROOT \
26+
--mode tracking
27+
```

scripts/eval_nusc/nusc.txt

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
argon2-cffi==21.3.0
2+
argon2-cffi-bindings==21.2.0
3+
async-generator==1.10
4+
attrs==22.2.0
5+
backcall==0.2.0
6+
bleach==4.1.0
7+
cachetools==4.2.4
8+
certifi==2021.5.30
9+
cffi==1.15.1
10+
comm==0.1.4
11+
cycler==0.11.0
12+
dataclasses==0.8
13+
decorator==5.1.1
14+
defusedxml==0.7.1
15+
descartes==1.1.0
16+
entrypoints==0.4
17+
fire==0.5.0
18+
importlib-metadata==4.8.3
19+
importlib-resources==5.4.0
20+
ipykernel==5.5.6
21+
ipython==7.16.3
22+
ipython-genutils==0.2.0
23+
ipywidgets==7.8.1
24+
jedi==0.17.2
25+
Jinja2==3.0.3
26+
joblib==1.1.1
27+
jsonschema==3.2.0
28+
jupyter==1.0.0
29+
jupyter-client==7.1.2
30+
jupyter-console==6.4.3
31+
jupyter-core==4.9.2
32+
jupyterlab-pygments==0.1.2
33+
jupyterlab-widgets==1.1.7
34+
kiwisolver==1.3.1
35+
MarkupSafe==2.0.1
36+
matplotlib==3.3.4
37+
mistune==0.8.4
38+
motmetrics==1.1.3
39+
nbclient==0.5.9
40+
nbconvert==6.0.7
41+
nbformat==5.1.3
42+
nest-asyncio==1.5.8
43+
notebook==6.4.10
44+
numpy==1.19.5
45+
nuscenes-devkit==1.1.10
46+
opencv-python==4.5.4.58
47+
packaging==21.3
48+
pandas==1.1.5
49+
pandocfilters==1.5.0
50+
parso==0.7.1
51+
pexpect==4.9.0
52+
pickleshare==0.7.5
53+
Pillow==8.4.0
54+
prometheus-client==0.17.1
55+
prompt-toolkit==3.0.36
56+
ptyprocess==0.7.0
57+
pycocotools==2.0.7
58+
pycparser==2.21
59+
Pygments==2.14.0
60+
pyparsing==3.1.1
61+
pyquaternion==0.9.9
62+
pyrsistent==0.18.0
63+
python-dateutil==2.8.2
64+
pytz==2023.3.post1
65+
pyzmq==25.1.2
66+
qtconsole==5.2.2
67+
QtPy==2.0.1
68+
scikit-learn==0.24.2
69+
scipy==1.5.4
70+
Send2Trash==1.8.2
71+
Shapely==1.8.5
72+
six==1.16.0
73+
termcolor==1.1.0
74+
terminado==0.12.1
75+
testpath==0.6.0
76+
threadpoolctl==3.1.0
77+
tornado==6.1
78+
tqdm==4.64.1
79+
traitlets==4.3.3
80+
typing_extensions==4.1.1
81+
wcwidth==0.2.13
82+
webencodings==0.5.1
83+
widgetsnbextension==3.6.6
84+
zipp==3.6.0

scripts/eval_nusc/run.py

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
"""nuScenes evaluation pipeline for Vis4D."""
2+
3+
import argparse
4+
import os
5+
import json
6+
7+
from nuscenes import NuScenes
8+
from nuscenes.eval.detection.evaluate import NuScenesEval
9+
from nuscenes.eval.detection.config import config_factory
10+
11+
from nuscenes.eval.tracking.evaluate import TrackingEval as track_eval
12+
from nuscenes.eval.tracking.utils import print_final_metrics
13+
from nuscenes.eval.tracking.data_classes import TrackingConfig, TrackingMetrics
14+
from nuscenes.eval.common.config import config_factory as track_configs
15+
16+
17+
def eval_detection(
18+
version: str,
19+
dataroot: str,
20+
output_dir: str,
21+
result_path: str,
22+
eval_set: str,
23+
) -> None:
24+
"""Evaluate detection results."""
25+
nusc = NuScenes(version=version, dataroot=dataroot, verbose=True)
26+
27+
nusc_eval = NuScenesEval(
28+
nusc,
29+
config=config_factory("detection_cvpr_2019"),
30+
result_path=result_path,
31+
eval_set=eval_set,
32+
output_dir=output_dir,
33+
verbose=True,
34+
)
35+
_ = nusc_eval.main(render_curves=False)
36+
37+
38+
def eval_tracking(
39+
version: str, output_dir: str, result_path: str, root: str, eval_set: str
40+
) -> None:
41+
"""Evaluate tracking results."""
42+
nusc_eval = track_eval(
43+
config=track_configs("tracking_nips_2019"),
44+
result_path=result_path,
45+
eval_set=eval_set,
46+
output_dir=output_dir,
47+
verbose=True,
48+
nusc_version=version,
49+
nusc_dataroot=root,
50+
)
51+
_ = nusc_eval.main()
52+
53+
54+
def evaluate(
55+
version: str,
56+
dataroot: str,
57+
mode: str,
58+
output_dir: str,
59+
result_path: str,
60+
root: str,
61+
) -> None:
62+
"""nuScenes evaluation."""
63+
if "mini" in version:
64+
eval_set = "mini_val"
65+
else:
66+
eval_set = "val"
67+
68+
if mode == "tracking":
69+
eval_tracking(version, output_dir, result_path, root, eval_set)
70+
else:
71+
eval_detection(version, dataroot, output_dir, result_path, eval_set)
72+
73+
74+
def print_metric_summary(metric_summary_path: str) -> None:
75+
"""Print metric summary."""
76+
with open(metric_summary_path, "r") as f:
77+
metrics = json.load(f)
78+
79+
cfg = TrackingConfig.deserialize(metrics["cfg"])
80+
tm = TrackingMetrics(cfg=cfg)
81+
tm.add_runtime(metrics["eval_time"])
82+
tm.label_metrics = metrics["label_metrics"]
83+
84+
print_final_metrics(metrics)
85+
86+
87+
if __name__ == "__main__":
88+
"""Main."""
89+
parser = argparse.ArgumentParser(description="NuScenes eval for Vis4D.")
90+
parser.add_argument(
91+
"--input",
92+
"-i",
93+
help=(
94+
"Folder path to the nuScenes format detection / tracking results."
95+
),
96+
)
97+
parser.add_argument(
98+
"--version",
99+
"-v",
100+
choices=["trainval", "mini"],
101+
help="NuScenes dataset version to convert.",
102+
)
103+
parser.add_argument(
104+
"--dataroot",
105+
"-d",
106+
help="NuScenes dataset root.",
107+
default="./data/nuscenes",
108+
)
109+
parser.add_argument(
110+
"-m",
111+
"--mode",
112+
default="tracking",
113+
choices=["tracking", "detection"],
114+
help="Conversion mode: detection or tracking.",
115+
)
116+
args = parser.parse_args()
117+
118+
if args.mode == "detection":
119+
metric = "detect_3d"
120+
else:
121+
metric = "track_3d"
122+
123+
evaluate(
124+
f"v1.0-{args.version}",
125+
args.dataroot,
126+
args.mode,
127+
args.input,
128+
os.path.join(args.input, f"{metric}_predictions.json"),
129+
args.dataroot,
130+
)

tests/vis4d-test-data

Submodule vis4d-test-data updated 41 files

0 commit comments

Comments
 (0)