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

Refactor config for the Release. #136

Merged
merged 12 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ coverage/
# downloaded repos and models
scalabel/bot/experimental/*

# python cache
__pycache__/

# python virtual environment
env/


# vscode workspace configuration
*.code-workspace

Expand Down
78 changes: 62 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
A modular library for 4D scene understanding
</p>

## Quickstart

You can checkout our [documentation](https://docs.vis.xyz/4d/index.html).

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

## Installation

Installation is as easy as
Expand All @@ -26,20 +32,20 @@ python3 -m pip install vis4d

```bash
# vis4d.engine
python -m vis4d fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
vis4d fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1

# vis4d.pl
python -m vis4d.pl fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
vis4d-pl fit --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
```

- To test a model

```bash
# vis4d.engine
python -m vis4d test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
vis4d test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1

# vis4d.pl
python -m vis4d.pl test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
vis4d-pl test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpus 1
```

## DDP
Expand All @@ -53,18 +59,17 @@ python -m vis4d.pl test --config vis4d/zoo/faster_rcnn/faster_rcnn_coco.py --gpu
./scripts/dist_train.sh <config-file> <num-gpus>

# vis4d.pl
python -m vis4d.pl fit --config <config-file> --gpus <num-gpus>
vis4d-pl fit --config <config-file> --gpus <num-gpus>
```

- SLURM batch job. Need to config the submission file.
- SLURM

```bash
# vis4d.engine
sbatch scripts/slurm_train.sh
srun vis4d fit --config <config-file> --gpus <num-gpus> --slurm True

# vis4d.pl
srun --cpus-per-task=4 --gres=gpumem:20G python -m vis4d.pl.run fit \
--config <config-file> --gpus <num-gpus>
srun vis4d-pl fit --config <config-file> --gpus <num-gpus>
```

### Testing
Expand All @@ -76,20 +81,61 @@ srun --cpus-per-task=4 --gres=gpumem:20G python -m vis4d.pl.run fit \
./scripts/dist_test.sh <config-file> <num-gpus>

# vis4d.pl
python -m vis4d.pl test --config <config-file> --gpus <num-gpus>
vis4d-pl test --config <config-file> --gpus <num-gpus>
```

- SLURM batch job. Need to config the submission file.
- SLURM

```bash
# vis4d.engine
sbatch scripts/slurm_test.sh
srun vis4d test --config <config-file> --gpus <num-gpus> --slurm True

# vis4d.pl
srun --cpus-per-task=4 --gres=gpumem:20G python -m vis4d.pl.run test \
--config <config-file> --gpus <num-gpus>
srun vis4d-pl test --config <config-file> --gpus <num-gpus>
```

## Contribute
## Acknowledgement
Vis4D is a group effort by our team at ETH Zurich.
[Yung-Hsu Yang](https://royyang0714.github.io/) built the current version and will be the main maintainer of the codebase.

Vis4D was originally written by [Tobias Fischer](https://tobiasfshr.github.io/) during the first three years of his Ph.D. at ETH Zurich, [Thomas E. Huang](https://www.thomasehuang.com/) helped contribute many models, [Tao Sun](https://www.suniique.com/) implemented the ViT models and designed the evaluation pipeline, and[René Zurbrügg](https://github.com/renezurbruegg) designed the config system.


## Contributors
**Project Leads**
- [Yung-Hsu Yang](https://royyang0714.github.io/)*
- [Tobias Fischer](https://tobiasfshr.github.io/)*

**Core Contributors**
- [Thomas E. Huang](https://www.thomasehuang.com/)
- [Tao Sun](https://www.suniique.com/)
- [René Zurbrügg](https://renezurbruegg.github.io/)

**Advisors**
- [Fisher Yu](https://www.yf.io/)

`*` denotes equal contribution

**We are open to contributions and suggestions, feel free to reach out to us.**

[Check out our contribution guidelines for this project](docs/source/contribute.rst)
[Check out our contribution guidelines for this project](docs/source/dev_guide/contribute.rst)

**Community Contributors**

<a href="https://github.com/SysCV/vis4d/graphs/contributors">
<img src="https://contrib.rocks/image?repo=SysCV/vis4d" />
</a>


## Citation

If you find Vis4D is useful for your research, please consider citing the following BibTeX entry.

```bibtex
@misc{vis4d_2024,
author = {{Yung-Hsu Yang and Tobias Fischer and Thomas E. Huang} and René Zurbrügg and Tao Sun and Fisher Yu},
title = {Vis4D},
howpublished = {\url{https://github.com/SysCV/vis4d}},
year = {2024}
}
```
36 changes: 19 additions & 17 deletions docs/source/user_guide/faster_rcnn_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,40 @@
"""Faster RCNN COCO training example."""
from __future__ import annotations

import tempfile

import lightning.pytorch as pl
import numpy as np
import tempfile
from torch.optim import SGD
from torch.optim.lr_scheduler import LinearLR, MultiStepLR

from vis4d.config import class_config
from vis4d.config.common.datasets.coco import (
CONN_COCO_BBOX_EVAL,
get_coco_detection_cfg,
)
from vis4d.config.common.models import get_faster_rcnn_cfg
from vis4d.config.default import (
get_default_callbacks_cfg,
get_default_cfg,
get_default_pl_trainer_cfg,
)
from vis4d.config.default.data_connectors import (
CONN_BBOX_2D_TEST,
CONN_BBOX_2D_TRAIN,
)
from vis4d.config.typing import (
ExperimentConfig,
ExperimentParameters,
ParameterSweepConfig,
)
from vis4d.config.util import get_lr_scheduler_cfg, get_optimizer_cfg
from vis4d.config.util.sweep import grid_search
from vis4d.config.sweep import grid_search
from vis4d.engine.callbacks import EvaluatorCallback
from vis4d.engine.connectors import CallbackConnector, DataConnector
from vis4d.eval.coco import COCODetectEvaluator
from vis4d.op.base import ResNet
from vis4d.zoo.base import (
get_default_callbacks_cfg,
get_default_cfg,
get_default_pl_trainer_cfg,
get_lr_scheduler_cfg,
get_optimizer_cfg,
)
from vis4d.zoo.base.data_connectors import (
CONN_BBOX_2D_TEST,
CONN_BBOX_2D_TRAIN,
)
from vis4d.zoo.base.datasets.coco import (
CONN_COCO_BBOX_EVAL,
get_coco_detection_cfg,
)
from vis4d.zoo.base.models.faster_rcnn import get_faster_rcnn_cfg


def get_config() -> ExperimentConfig:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/user_guide/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"from vis4d.vis.functional.image import imshow_bboxes\n",
"\n",
"from vis4d.config import instantiate_classes\n",
"from vis4d.config.common.datasets.coco import get_coco_detection_cfg"
"from vis4d.zoo.base.datasets.coco import get_coco_detection_cfg"
]
},
{
Expand Down
15 changes: 12 additions & 3 deletions docs/source/user_guide/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation
=======
Package
=======
We currently support Python 3.9+ and PyTorch 1.10.0+.
We currently support Python 3.10+ and PyTorch 2.0.0+.

We recommand to install in a new virtual environment, e.g. conda or virtualenv.

Expand All @@ -30,15 +30,24 @@ If you want to build the package from source and specify CUDA version, you can c
git clone https://github.com/SysCV/vis4d.git
cd vis4d

python3 -m pip install -r requirements/install.txt -f https://download.pytorch.org/whl/cu117/torch_stable.html
python3 -m pip install -r requirements/torch-lib.txt
python3 -m pip install -r requirements/install.txt -f https://download.pytorch.org/whl/cu118/torch_stable.html
python3 -m pip install -e .

More information about torch and pytorch-lightning installation

- `PyTorch <https://pytorch.org/get-started/locally>`_
- `PyTorch Lightning <https://lightning.ai/docs/pytorch/latest/>`_

-----------------------
Install CUDA Operations
-----------------------

Some functionalities in the library require CUDA operations. You can install them by running:

.. code:: bash

python3 -m pip install -r requirements/torch-lib.txt

================
Directory Layout
================
Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ plugins = ["numpy.typing.mypy_plugin"]
"terminaltables.*",
"timm.*",
"vis4d_cuda_ops.*",
"fvcore.*",
]
ignore_missing_imports = true

Expand All @@ -111,12 +112,12 @@ plugins = ["numpy.typing.mypy_plugin"]

[project]
name = "vis4d"
version = "0.0"
version = "0.1.2"
authors = [{name = "VIS @ ETH", email = "[email protected]"}]
description = "Vis4D Python package for Visual 4D scene understanding"
readme = "README.md"
license = { text="Apache 2.0"}
requires-python = ">=3.9.0"
license = {text = "Apache 2.0"}
requires-python = ">=3.10"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Apache Software License",
Expand All @@ -134,7 +135,7 @@ dependencies = {file = ["requirements/install.txt"]}
include = ["vis4d*"]

[project.urls]
"Documentation" = "https://vis.xyz/4d/"
"Documentation" = "https://docs.vis.xyz/4d"
"Source" = "https://github.com/syscv/vis4d"
"Tracker" = "https://github.com/syscv/"

Expand Down
4 changes: 2 additions & 2 deletions requirements/install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ tensorboard
termcolor
terminaltables
timm>=0.6.0
torch>=1.10
torchvision>=0.11
torch>=2.0.0
torchvision>=0.15.1
tqdm
utm
wheel
Expand Down
4 changes: 2 additions & 2 deletions scripts/install_gpu_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source $CONDA_PATH/etc/profile.d/conda.sh

if [ -z "$1" ]
then
CUDA_VERSION=11.7
CUDA_VERSION=11.8
else
CUDA_VERSION=$1
fi
Expand All @@ -14,4 +14,4 @@ conda activate vis4d-dev
conda install cudatoolkit=$CUDA_VERSION -c pytorch -c nvidia
python3 -m pip install -r requirements/install.txt -f https://download.pytorch.org/whl/cu${CUDA_VERSION//.}/torch_stable.html
python3 -m pip install -r requirements/torch-lib.txt
python3 setup.py develop
pip install -e .
25 changes: 0 additions & 25 deletions scripts/slurm_test.sh

This file was deleted.

25 changes: 0 additions & 25 deletions scripts/slurm_train.sh

This file was deleted.

1 change: 0 additions & 1 deletion tests/config/common/__init__.py

This file was deleted.

4 changes: 2 additions & 2 deletions tests/config/registry_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import pytest

from tests.util import get_test_data
from vis4d.config.util.registry import get_config_by_name, register_config
from vis4d.config.registry import get_config_by_name, register_config


class TestRegistry(unittest.TestCase):
Expand All @@ -16,7 +16,7 @@ class TestRegistry(unittest.TestCase):
def test_yaml(self) -> None:
"""Test reading a yaml config file."""
file = get_test_data(
"config_test/bdd100k/faster_rcnn/faster_rcnn_r50_1x_bdd100k.yaml"
"zoo_test/bdd100k/faster_rcnn/faster_rcnn_r50_1x_bdd100k.yaml"
)

# Config can be resolved
Expand Down
Loading
Loading