Skip to content
Open
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
23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: lint

on: [push, pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install pre-commit hook
run: |
pip install pre-commit
pre-commit install
- name: Linting
run: pre-commit run --all-files
51 changes: 51 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
exclude: ^(tests/data/|requirements.txt)
repos:
- repo: https://gitee.com/openmmlab/mirrors-flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--max-line-length=119"]
- repo: https://gitee.com/openmmlab/mirrors-isort
rev: 5.11.5
hooks:
- id: isort
- repo: https://gitee.com/openmmlab/mirrors-yapf
rev: v0.32.0
hooks:
- id: yapf
- repo: https://gitee.com/openmmlab/mirrors-pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: check-yaml
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://gitee.com/openmmlab/mirrors-codespell
rev: v2.2.1
hooks:
- id: codespell
- repo: https://gitee.com/openmmlab/mirrors-mdformat
rev: 0.7.9
hooks:
- id: mdformat
args: ["--number"]
additional_dependencies:
- mdformat-openmmlab
- mdformat_frontmatter
- linkify-it-py
- repo: https://gitee.com/openmmlab/mirrors-docformatter
rev: v1.3.1
hooks:
- id: docformatter
args: ["--in-place", "--wrap-descriptions", "119"]
- repo: https://gitee.com/openmmlab/mirrors-pyupgrade
rev: v3.0.0
hooks:
- id: pyupgrade
args: ["--py36-plus"]
49 changes: 23 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DynamicDet [[arXiv]](https://arxiv.org/abs/2304.05552)
# DynamicDet [\[arXiv\]](https://arxiv.org/abs/2304.05552)

This repo contains the official implementation of [**"DynamicDet: A Unified Dynamic Architecture for Object Detection"**](https://arxiv.org/abs/2304.05552).

Expand All @@ -12,23 +12,22 @@ This repo contains the official implementation of [**"DynamicDet: A Unified Dyna

MS COCO

| Model | Easy / Hard | Size | FLOPs | FPS | AP<sup>val</sup> | AP<sup>test</sup> |
| :----------------------------------------------------------- | :---------: | :--: | :----: | :--: | :--------------: | :---------------: |
| [**Dy-YOLOv7**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7.pt) | 90% / 10% | 640 | 112.4G | 110 | 51.4% | 52.1% |
| | 50% / 50% | 640 | 143.2G | 96 | 52.7% | 53.3% |
| | 10% / 90% | 640 | 174.0G | 85 | 53.3% | 53.8% |
| | 0% / 100% | 640 | 181.7G | 83 | 53.5% | 53.9% |
| | | | | | | |
| [**Dy-YOLOv7-X**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7x.pt) | 90% / 10% | 640 | 201.7G | 98 | 53.0% | 53.3% |
| | 50% / 50% | 640 | 248.9G | 78 | 54.2% | 54.4% |
| | 10% / 90% | 640 | 296.1G | 65 | 54.7% | 55.0% |
| | 0% / 100% | 640 | 307.9G | 64 | 54.8% | 55.0% |
| | | | | | | |
| [**Dy-YOLOv7-W6**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7-w6.pt) | 90% / 10% | 1280 | 384.2G | 74 | 54.9% | 55.2% |
| | 50% / 50% | 1280 | 480.8G | 58 | 55.9% | 56.1% |
| | 10% / 90% | 1280 | 577.4G | 48 | 56.4% | 56.7% |
| | 0% / 100% | 1280 | 601.6G | 46 | 56.5% | 56.8% |

| Model | Easy / Hard | Size | FLOPs | FPS | AP<sup>val</sup> | AP<sup>test</sup> |
| :----------------------------------------------------------------------------------------------- | :---------: | :--: | :----: | :-: | :--------------: | :---------------: |
| [**Dy-YOLOv7**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7.pt) | 90% / 10% | 640 | 112.4G | 110 | 51.4% | 52.1% |
| | 50% / 50% | 640 | 143.2G | 96 | 52.7% | 53.3% |
| | 10% / 90% | 640 | 174.0G | 85 | 53.3% | 53.8% |
| | 0% / 100% | 640 | 181.7G | 83 | 53.5% | 53.9% |
| | | | | | | |
| [**Dy-YOLOv7-X**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7x.pt) | 90% / 10% | 640 | 201.7G | 98 | 53.0% | 53.3% |
| | 50% / 50% | 640 | 248.9G | 78 | 54.2% | 54.4% |
| | 10% / 90% | 640 | 296.1G | 65 | 54.7% | 55.0% |
| | 0% / 100% | 640 | 307.9G | 64 | 54.8% | 55.0% |
| | | | | | | |
| [**Dy-YOLOv7-W6**](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/dy-yolov7-w6.pt) | 90% / 10% | 1280 | 384.2G | 74 | 54.9% | 55.2% |
| | 50% / 50% | 1280 | 480.8G | 58 | 55.9% | 56.1% |
| | 10% / 90% | 1280 | 577.4G | 48 | 56.4% | 56.7% |
| | 0% / 100% | 1280 | 601.6G | 46 | 56.5% | 56.8% |

<details>
<summary> Table Notes </summary>
Expand All @@ -39,7 +38,6 @@ MS COCO

</details>


## Quick Start

### Installation
Expand All @@ -50,7 +48,6 @@ conda install pytorch=1.11 cudatoolkit=11.3 torchvision -c pytorch
pip install -r requirements.txt
```


### Data preparation

Download MS COCO dataset images ([train](http://images.cocodataset.org/zips/train2017.zip), [val](http://images.cocodataset.org/zips/val2017.zip), [test](http://images.cocodataset.org/zips/test2017.zip)) and [labels](https://github.com/VDIGPKU/DynamicDet/releases/download/v0.1/coco2017labels-segments.zip).
Expand Down Expand Up @@ -95,21 +92,21 @@ python train_step2.py --workers 4 --device 0 --batch-size 1 --epochs 2 --img 640

### Getting the dynamic thresholds for variable-speed inference

```bash
```bash
python get_dynamic_thres.py --device 0 --batch-size 1 --img-size 640 --cfg cfg/dy-yolov7-step2.yaml --weight weights/dy-yolov7.pt --data data/coco.yaml --task val
```
```

### Testing

```bash
```bash
python test.py --img-size 640 --batch-size 1 --conf 0.001 --iou 0.65 --device 0 --cfg cfg/dy-yolov7-step2.yaml --weight weights/dy-yolov7.pt --data data/coco.yaml --dy-thres <DY_THRESHOLD>
```
```

### Inference

```bash
```bash
python detect.py --cfg cfg/dy-yolov7-step2.yaml --weight weights/dy-yolov7.pt --num-classes 80 --source <IMAGE/VIDEO> --device 0 --dy-thres <DY_THRESHOLD>
```
```

## Citation

Expand Down
Loading