├── .gitignore
├── .pre-commit-config.yaml
├── CNAME
├── LICENSE
├── README.md
├── build_static_site.py
├── download_data.py
├── faq
└── index.html
├── gradio_app.py
├── index.html
├── methodology
└── index.html
├── models
└── object_detection
│ ├── __init__.py
│ ├── configs.py
│ ├── d-fine
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_D-FINE-L.json
│ ├── results_D-FINE-M.json
│ ├── results_D-FINE-N.json
│ ├── results_D-FINE-S.json
│ ├── results_D-FINE-X.json
│ └── run.py
│ ├── deim
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_DEIM-D-FINE-L.json
│ ├── results_DEIM-D-FINE-M.json
│ ├── results_DEIM-D-FINE-N.json
│ ├── results_DEIM-D-FINE-S.json
│ ├── results_DEIM-D-FINE-X.json
│ ├── results_DEIM-RT-DETRv2-L.json
│ ├── results_DEIM-RT-DETRv2-M*.json
│ ├── results_DEIM-RT-DETRv2-M.json
│ ├── results_DEIM-RT-DETRv2-S.json
│ ├── results_DEIM-RT-DETRv2-X.json
│ └── run.py
│ ├── rt-detr
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_rtdetr_r101vd.json
│ ├── results_rtdetr_r18vd.json
│ ├── results_rtdetr_r34vd.json
│ ├── results_rtdetr_r50vd.json
│ ├── results_rtdetrv2_r101vd.json
│ ├── results_rtdetrv2_r18vd.json
│ ├── results_rtdetrv2_r34vd.json
│ ├── results_rtdetrv2_r50vd.json
│ ├── results_rtdetrv2_r50vd_m.json
│ └── run.py
│ ├── rtmdet
│ ├── README.md
│ ├── requirements.txt
│ ├── results_rtmdet_l_syncbn_fast_8xb32-300e_coco.json
│ ├── results_rtmdet_m_syncbn_fast_8xb32-300e_coco.json
│ ├── results_rtmdet_s_syncbn_fast_8xb32-300e_coco.json
│ ├── results_rtmdet_tiny_syncbn_fast_8xb32-300e_coco.json
│ ├── results_rtmdet_x_syncbn_fast_8xb32-300e_coco.json
│ └── run.py
│ ├── utils.py
│ ├── yolov10
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_yolov10b.json
│ ├── results_yolov10l.json
│ ├── results_yolov10m.json
│ ├── results_yolov10n.json
│ ├── results_yolov10s.json
│ ├── results_yolov10x.json
│ └── run.py
│ ├── yolov11
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_yolo11l.json
│ ├── results_yolo11m.json
│ ├── results_yolo11n.json
│ ├── results_yolo11s.json
│ ├── results_yolo11x.json
│ └── run.py
│ ├── yolov12
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_yolov12l.json
│ ├── results_yolov12m.json
│ ├── results_yolov12n.json
│ ├── results_yolov12s.json
│ ├── results_yolov12x.json
│ └── run.py
│ ├── yolov8
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_yolov8l.json
│ ├── results_yolov8m.json
│ ├── results_yolov8n.json
│ ├── results_yolov8s.json
│ ├── results_yolov8x.json
│ └── run.py
│ └── yolov9
│ ├── __init__.py
│ ├── requirements.txt
│ ├── results_yolov9c.json
│ ├── results_yolov9e.json
│ ├── results_yolov9m.json
│ ├── results_yolov9s.json
│ ├── results_yolov9t.json
│ └── run.py
├── pyproject.toml
├── requirements.txt
├── run_overnight.sh
└── static
├── aggregate_results.js
├── aggregate_results.json
├── common.css
├── dark-theme.css
├── favicon.ico
├── github.svg
├── light-theme.css
├── script.js
└── theme-toggle.js
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | data/*
3 | **/*.pt
4 | **/*.pth
5 |
6 | **/*.json.old
7 |
8 | # yolov9 repo
9 | **/yolov9-repo
10 | # D-FINE repo
11 | **/D-FINE
12 | # mmyolo-weights
13 | **/mmyolo-weights
14 | ## deim repo
15 | **/DEIM_repo
16 |
17 | # Byte-compiled / optimized / DLL files
18 | __pycache__/
19 | *.py[cod]
20 | *$py.class
21 |
22 | # C extensions
23 | *.so
24 |
25 | # Distribution / packaging
26 | .Python
27 | build/
28 | develop-eggs/
29 | dist/
30 | downloads/
31 | eggs/
32 | .eggs/
33 | lib/
34 | lib64/
35 | parts/
36 | sdist/
37 | var/
38 | wheels/
39 | share/python-wheels/
40 | *.egg-info/
41 | .installed.cfg
42 | *.egg
43 | MANIFEST
44 |
45 | # PyInstaller
46 | # Usually these files are written by a python script from a template
47 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
48 | *.manifest
49 | *.spec
50 |
51 | # Installer logs
52 | pip-log.txt
53 | pip-delete-this-directory.txt
54 |
55 | # Unit test / coverage reports
56 | htmlcov/
57 | .tox/
58 | .nox/
59 | .coverage
60 | .coverage.*
61 | .cache
62 | nosetests.xml
63 | coverage.xml
64 | *.cover
65 | *.py,cover
66 | .hypothesis/
67 | .pytest_cache/
68 | cover/
69 |
70 | # Translations
71 | *.mo
72 | *.pot
73 |
74 | # Django stuff:
75 | *.log
76 | local_settings.py
77 | db.sqlite3
78 | db.sqlite3-journal
79 |
80 | # Flask stuff:
81 | instance/
82 | .webassets-cache
83 |
84 | # Scrapy stuff:
85 | .scrapy
86 |
87 | # Sphinx documentation
88 | docs/_build/
89 |
90 | # PyBuilder
91 | .pybuilder/
92 | target/
93 |
94 | # Jupyter Notebook
95 | .ipynb_checkpoints
96 |
97 | # IPython
98 | profile_default/
99 | ipython_config.py
100 |
101 | # pyenv
102 | # For a library or package, you might want to ignore these files since the code is
103 | # intended to run in multiple environments; otherwise, check them in:
104 | # .python-version
105 |
106 | # pipenv
107 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
108 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
109 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
110 | # install all needed dependencies.
111 | #Pipfile.lock
112 |
113 | # pdm
114 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
115 | #pdm.lock
116 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
117 | # in version control.
118 | # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
119 | .pdm.toml
120 | .pdm-python
121 | .pdm-build/
122 |
123 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
124 | __pypackages__/
125 |
126 | # Celery stuff
127 | celerybeat-schedule
128 | celerybeat.pid
129 |
130 | # SageMath parsed files
131 | *.sage.py
132 |
133 | # Environments
134 | .env
135 | .venv
136 | env/
137 | venv/
138 | ENV/
139 | env.bak/
140 | venv.bak/
141 |
142 | # Spyder project settings
143 | .spyderproject
144 | .spyproject
145 |
146 | # Rope project settings
147 | .ropeproject
148 |
149 | # mkdocs documentation
150 | /site
151 |
152 | # mypy
153 | .mypy_cache/
154 | .dmypy.json
155 | dmypy.json
156 |
157 | # Pyre type checker
158 | .pyre/
159 |
160 | # pytype static type analyzer
161 | .pytype/
162 |
163 | # Cython debug symbols
164 | cython_debug/
165 |
166 | # PyCharm
167 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
168 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
169 | # and can be added to the global gitignore or merged into this file. For a more nuclear
170 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
171 | .idea/
172 | # Vscode
173 | .vscode/
174 |
175 | # OSX folder attributes
176 | .DS_Store
177 |
178 | # ruff cache
179 | .ruff_cache
180 |
181 | # exclude torch pt files
182 | *.pt
183 | *.pth
184 |
--------------------------------------------------------------------------------
/.pre-commit-config.yaml:
--------------------------------------------------------------------------------
1 | ci:
2 | autofix_prs: true
3 | autoupdate_schedule: weekly
4 | autofix_commit_msg: "fix(pre_commit): 🎨 auto format pre-commit hooks"
5 | autoupdate_commit_msg: "chore(pre_commit): ⬆ pre_commit autoupdate"
6 |
7 | repos:
8 | - repo: https://github.com/pre-commit/pre-commit-hooks
9 | rev: v5.0.0
10 | hooks:
11 | - id: trailing-whitespace
12 | exclude: CNAME
13 | - id: check-yaml
14 | exclude: mkdocs.yml
15 | - id: check-executables-have-shebangs
16 | - id: check-toml
17 | - id: check-case-conflict
18 | - id: check-added-large-files
19 | - id: detect-private-key
20 | - id: pretty-format-json
21 | args: ["--autofix", "--no-sort-keys", "--indent=4"]
22 | - id: end-of-file-fixer
23 | exclude: CNAME
24 | - id: mixed-line-ending
25 |
26 | - repo: https://github.com/PyCQA/bandit
27 | rev: "1.8.3"
28 | hooks:
29 | - id: bandit
30 | args: ["-c", "pyproject.toml"]
31 | additional_dependencies: ["bandit[toml]"]
32 |
33 | - repo: https://github.com/astral-sh/ruff-pre-commit
34 | rev: v0.11.10
35 | hooks:
36 | - id: ruff
37 | args: [--fix, --exit-non-zero-on-fix]
38 | - id: ruff-format
39 | types_or: [python, pyi, jupyter]
40 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | leaderboard.roboflow.com
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Roboflow
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Model Leaderboard Website
2 |
3 | This project is a **model leaderboard** website for evaluating a variety of models on the COCO dataset. Models are compared compares models across a variety of metrics, computed with [supervision](https://github.com/roboflow/supervision).
4 |
5 | ## Project Structure
6 |
7 | ```text
8 | model-leaderboard/
9 | │
10 | ├── data/ # Directory for storing datasets (e.g., COCO)
11 | ├── models/ # Model-specific directories
12 | │ ├── object_detection/ # Houses individual model folders
13 | │ │ ├── yolov8n/ # Example of a model folder
14 | │ │ ├── yolov9t/ # Example of another model folder
15 | │ │ └── yolov10m/ # And so on...
16 | │ └── utils.py # Shared utility code (minimal cross-model dependencies)
17 | │
18 | ├── index.html # Main page for the static side
19 | ├── static/ # Static files, serving as the backend for the site
20 | │ └── ...
21 | ├── download_data.py # Script for downloading the ground truth dataset
22 | ├── build_static_site.py # Must be run to aggregate results for the static site
23 | └── requirements.txt # Dependencies for data download and leaderboard front end
24 | ```
25 |
26 | Each model is expected to have:
27 |
28 | ```text
29 | model_name/
30 | │
31 | ├── requirements.txt # Dependencies for running the model
32 | ├── run.py # Script that runs model on dataset in /data, compares with ground truth
33 | ├── results.json # Model results, created with run.py
34 | ├── (any other scripts)
35 | └── (optional) README.md # Links to original model page & instructions on how to produce results.py
36 | ```
37 |
38 | Each model is expected to be run in a separate python virtual environment, with its own set of dependencies.
39 |
40 | Before we automate the models to be run regularly, the naming standards are relaxed.
41 | The only requirements is to store results for `results.json` in the model directory. For consistency, we advice to keep the scripts in `run.py`.
42 |
43 | ### Key Files
44 |
45 | 1. **`download_data.py`**: Downloads the dataset (currently configured for COCO) and places it into the `data/` directory.
46 | 2. **`build_static_site.py`**: Aggregates the results of the models to be shown on the GitHub Pages site.
47 | 3. **`run_overnight.sh`**: An early version of a script to run the entire process, generating model results and comparing to downloaded data. We hacked it together for the first iteration of the leaderboard. Requires `uv`.
48 | 4. **`gradio_app.py`**: The initial version of the leaderboard UI. Displays model results in a gradio page.
49 |
50 | 5. **Model-Specific Folders**"
51 |
52 | - Each object detection model is housed in its own folder under `models/object_detection/`. These folders include `run.py`, which generates evaluation results in the form of a `results.json` file.
53 |
54 | 6. **`utils.py`**: Contains shared utility code across models.
55 |
56 | ## Getting Started
57 |
58 | ### 1. Download the Dataset
59 |
60 | Run the `download_data.py` script to download the COCO dataset (or any supported dataset in the future):
61 |
62 | ```bash
63 | python -m venv .venv
64 | source .venv/bin/activate
65 | pip install -r requirements.txt
66 | python download_data.py
67 | deactivate
68 | ```
69 |
70 | ### 2. Run the model
71 |
72 | Each model folder contains its own script to run predictions and generate results.
73 |
74 | ```bash
75 | cd models/object_detection/yolov8n
76 | python -m venv .venv
77 | source .venv/bin/activate
78 | pip install -r requirements.txt
79 | python run.py # Or any other scripts
80 | deactivate
81 | ```
82 |
83 | ### 3. Run All Models
84 |
85 | Currently, you may use `run_overnight.sh` to run all models.
86 | This is an early version of the script and is due to change.
87 |
88 | ```bash
89 | ./run_overnight.sh
90 | ```
91 |
92 | ### 4. Launch the Leaderboard
93 |
94 | Once the results are generated, you can launch the Gradio app to visualize the leaderboard:
95 |
96 | ```bash
97 | source .venv/bin/activate
98 | python gradio_app.py
99 | ```
100 |
101 | ## Notes
102 |
103 | - The leaderboard is currently configured to work with the COCO dataset, running the benchmark on the test set.
104 | - Model dependencies are handled separately in each model folder, with each model having its own `requirements.txt` to avoid dependency conflicts.
105 |
106 | ## Contributing
107 |
108 | Feel free to contribute by adding new models, improving the existing evaluation process, or expanding dataset support. To add a new model, simply create a new folder under `models/object_detection/` and follow the structure of existing models.
109 |
110 | Make sure that the model's `run.py` script generates a `results.json` file in the model directory. If there are more scripts, please provide a `README.md` in the model folder how to run the model. Optionally, you may modify the `run_overnight.sh` script to help us automate the benchmarking in the future.
111 |
--------------------------------------------------------------------------------
/build_static_site.py:
--------------------------------------------------------------------------------
1 | import json
2 | from pathlib import Path
3 |
4 | # Temporarily disabled from appearing on the board, e.g. if there's still some issues
5 | BLACKLIST = ["yolov9"]
6 |
7 | results_list = []
8 | for model_dir in Path("models/object_detection").iterdir():
9 | if model_dir.is_file() or model_dir.name.startswith("_"):
10 | continue
11 |
12 | if model_dir.name in BLACKLIST:
13 | continue
14 |
15 | for results_file in model_dir.glob("results*.json"):
16 | with open(results_file) as f:
17 | results = json.load(f)
18 | results_list.append(results)
19 |
20 | json_results = json.dumps(results_list, indent=2)
21 | js_results = "const results = " + json_results + ";"
22 |
23 | # Used to generate programmatic model comparison pages
24 | with open("static/aggregate_results.json", "w") as f:
25 | f.write(json_results)
26 |
27 | # Displayed in the table
28 | with open("static/aggregate_results.js", "w") as f:
29 | f.write(js_results)
30 |
31 | print("Results aggregated and saved to static/aggregate_results.js")
32 | print("Results aggregated and saved to static/aggregate_results.json")
33 |
--------------------------------------------------------------------------------
/download_data.py:
--------------------------------------------------------------------------------
1 | import os
2 | from zipfile import ZipFile
3 |
4 | import requests
5 | from tqdm import tqdm
6 |
7 | IMAGE_PATH = "data/coco-val-2017/images"
8 | ANNOTATIONS_PATH = "data/coco-val-2017/labels"
9 | # Create directories
10 | os.makedirs(IMAGE_PATH, exist_ok=True)
11 | os.makedirs(ANNOTATIONS_PATH, exist_ok=True)
12 |
13 |
14 | # Function to download a file with progress bar
15 | def download_file(url, dest_path):
16 | response = requests.get(url, stream=True)
17 | total_size = int(response.headers.get("content-length", 0))
18 | block_size = 1024 # 1 Kibibyte
19 | t = tqdm(total=total_size, unit="iB", unit_scale=True)
20 | with open(dest_path, "wb") as file:
21 | for data in response.iter_content(block_size):
22 | t.update(len(data))
23 | file.write(data)
24 | t.close()
25 | if total_size != 0 and t.n != total_size:
26 | print("ERROR: Something went wrong")
27 |
28 |
29 | # Download and unzip test2017.zip
30 | print("Downloading val2017.zip...")
31 | test2017_zip_path = "data/val2017.zip"
32 | download_file("http://images.cocodataset.org/zips/val2017.zip", test2017_zip_path)
33 | print("Unzipping val2017.zip...")
34 | with ZipFile(test2017_zip_path, "r") as zip_ref:
35 | zip_ref.extractall(IMAGE_PATH)
36 | os.remove(test2017_zip_path)
37 | print("val2017.zip downloaded and unzipped successfully.")
38 |
39 | # Download and unzip image_info_test2017.zip
40 | print("Downloading annotations_trainval2017.zip...")
41 | image_info_zip_path = "data/annotations_trainval2017.zip"
42 | download_file(
43 | "http://images.cocodataset.org/annotations/annotations_trainval2017.zip",
44 | image_info_zip_path,
45 | )
46 | print("Unzipping annotations_trainval2017.zip...")
47 | with ZipFile(image_info_zip_path, "r") as zip_ref:
48 | zip_ref.extractall(ANNOTATIONS_PATH)
49 | os.remove(image_info_zip_path)
50 | print("annotations_trainval2017.zip downloaded and unzipped successfully.")
51 |
--------------------------------------------------------------------------------
/faq/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Methodology ○ Computer Vision Model Leaderboard
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
56 |
73 |
74 |
Frequently Asked Questions
75 |
76 |
What is mAP?
77 |
78 | Mean Average Precision (mAP) is a metric used to evaluate the object detection models. It is the average of the precision-recall curves at different IoU thresholds.
79 |
80 |
81 |
What is the difference between mAP 50, mAP 75 and mAP 50:95?
82 |
83 | mAP can be evaluated at multiple IoU thresholds . mAP 50, for example, evaluates it while considering detections that overlap with an IoU of 0.5 or greater - everything else is a false positive. mAP 50:95 is an average of all considered IoU thresholds - 0.5, 0.6, … 0.8, 0.9, 0.95. It is the primary metric showing how well the model performs, across increasing levels of rigour.
84 |
85 |
86 |
What do the small, medium, and large labels next to the mAP scores mean?
87 |
88 | The small, medium, and large labels next to the mAP scores indicate the size of the objects in the images. This is important because object detection models can struggle with detecting small objects. The COCO dataset has three categories of object sizes: small (less than 32x32 pixels), medium (between 32x32 and 96x96 pixels), and large (greater than 96x96 pixels). You can learn more about the definition on the COCO detection evaluation description page .
89 |
90 |
91 |
What is F1 Score?
92 |
93 | Recall measures how many of the target objects were detected. Even if the model detected more cars than there were in the image, but captured all targets among them - the recall will be 100%.
94 |
95 | Precision measures how many of the detected objects are correct. If the model found a box on some cars in an image, but classified 20% as bicycles, precision is 80%, regardless of how many were found.
96 |
97 | What if you want high recall and high precision? F1 Score simply combines the two into a single metric. With a high F1 score, you can be sure that model produced both high precision and recall in its results.
98 |
99 |
Here is the formula for F1 Score, where P is precision and R is recall:
100 |
101 |
102 |
103 |
104 | F1
105 | =
106 |
107 | 2 P R
108 | P + R
109 |
110 |
111 |
112 |
113 |
114 |
Is this project open source?
115 |
116 | Yes! You can find the code for this project on GitHub .
117 |
118 |
119 |
What is the gear icon next to model names?
120 |
121 | Hovering over it shows the parameters used to run the model. We aim to make the parameters as similar as possible to the ones used by the original authors.
122 |
123 |
124 |
What parameters were used to run each model?
125 |
126 | We aim to make the parameters as similar as possible to the ones used by the original authors. Hover over the gear icon next to the model name to see the parameters used.
127 |
128 |
129 |
Can I suggest a model to benchmark?
130 |
131 | Yes! If there is a model that you would like to see benchmarked, you may open a PR with the model instructions. Please have a look at the README to learn about the structure of the repository.
132 |
133 |
134 |
135 |
136 |
137 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
--------------------------------------------------------------------------------
/gradio_app.py:
--------------------------------------------------------------------------------
1 | import json
2 | import sys
3 | from pathlib import Path
4 | from typing import Any, Dict, List
5 |
6 | import gradio as gr
7 |
8 | TITLE = """Model Leaderboard """
9 | DESC = """
10 |
20 | """ # noqa: E501 title/docs
21 |
22 |
23 | def load_results() -> List[Dict]:
24 | results: List[Dict] = []
25 | results_file: Path = Path("static/aggregate_results.json")
26 | if not results_file.exists():
27 | print("aggregate_results.json file not found")
28 | sys.exit(1)
29 | with open(results_file) as f:
30 | results = json.load(f)
31 | results.sort(key=lambda x: x["metadata"]["model"])
32 | return results
33 |
34 |
35 | def get_result_header() -> List[str]:
36 | return [
37 | "Model",
38 | "Parameters (M)",
39 | "mAP 50:95",
40 | "mAP 50",
41 | "mAP 75",
42 | "mAP 50:95 (Small)",
43 | "mAP 50:95 (Medium)",
44 | "mAP 50:95 (Large)",
45 | "F1 50",
46 | "F1 75",
47 | "F1 50 (Small)",
48 | "F1 75 (Small)",
49 | "F1 50 (Medium)",
50 | "F1 75 (Medium)",
51 | "F1 50 (Large)",
52 | "F1 75 (Large)",
53 | ]
54 |
55 |
56 | def parse_result(result: Dict) -> List[Any]:
57 | round_digits = 3
58 |
59 | param_count = ""
60 | if "param_count" in result["metadata"]:
61 | param_count = round(result["metadata"]["param_count"] / 1e6, 2)
62 |
63 | return [
64 | result["metadata"]["model"],
65 | param_count,
66 | round(result["map50_95"], round_digits),
67 | round(result["map50"], round_digits),
68 | round(result["map75"], round_digits),
69 | round(result["small_objects"]["map50_95"], round_digits),
70 | round(result["medium_objects"]["map50_95"], round_digits),
71 | round(result["large_objects"]["map50_95"], round_digits),
72 | round(result["f1_50"], round_digits),
73 | round(result["f1_75"], round_digits),
74 | round(result["f1_small_objects"]["f1_50"], round_digits),
75 | round(result["f1_small_objects"]["f1_75"], round_digits),
76 | round(result["f1_medium_objects"]["f1_50"], round_digits),
77 | round(result["f1_medium_objects"]["f1_75"], round_digits),
78 | round(result["f1_large_objects"]["f1_50"], round_digits),
79 | round(result["f1_large_objects"]["f1_75"], round_digits),
80 | ]
81 |
82 |
83 | raw_results = load_results()
84 | results = [parse_result(result) for result in raw_results]
85 | header = get_result_header()
86 |
87 | with gr.Blocks() as demo:
88 | gr.Markdown("# Model Leaderboard")
89 | gr.HTML(TITLE)
90 | gr.HTML(DESC)
91 | gr.DataFrame(headers=header, value=results)
92 |
93 | demo.launch()
94 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Computer Vision Model Leaderboard
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
56 |
73 |
74 |
75 |
76 |
77 | Model
78 | Parameters (M)
79 | Github/Paper
80 | mAP 50:95
81 | mAP 50
82 | mAP 75
83 | mAP 50:95 (Small)
84 | mAP 50:95 (Medium)
85 | mAP 50:95 (Large)
86 | F1 50
87 | F1 75
88 | F1 50 (Small)
89 | F1 75 (Small)
90 | F1 50 (Medium)
91 | F1 75 (Medium)
92 | F1 50 (Large)
93 | F1 75 (Large)
94 | License
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------
/methodology/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | FAQ ○ Computer Vision Model Leaderboard
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
56 |
73 |
74 |
Methodology
75 |
76 | The Roboflow computer vision model leaderboard benchmarks popular object detection models against the Microsoft COCO dataset. The Microsoft COCO dataset is commonly used to evaluate and compare the performance of object detection models.
77 |
78 |
79 | Benchmark data in the table was computed independently by the Roboflow team, following public inference instructions from each model vendor. We aim to achieve as close to the original benchmark results as possible by following all instructions.
80 |
81 |
82 | This project is open source, with code available that we use for benchmarking . This means you can verify the results of the data in the leaderboard table.
83 |
84 |
85 | We used the validation set of the COCO dataset, to evaluate model performance on common objects. This means that the benchmark is less relevant for evaluating domain adaptiveness: how a new architecture does on a specific domain.
86 |
87 |
88 | The Roboflow 100 benchmark was designed to measure model performance across domains. If you are interested in learning more about domain-specific model benchmarking, refer to the Roboflow 100 website .
89 |
90 |
91 |
92 |
93 |
94 |
95 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
--------------------------------------------------------------------------------
/models/object_detection/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/configs.py:
--------------------------------------------------------------------------------
1 | CONFIDENCE_THRESHOLD = 0.001
2 | DATASET_DIR = "../../../data/coco-val-2017"
3 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/d-fine/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/d-fine/requirements.txt:
--------------------------------------------------------------------------------
1 | supervision @ git+https://github.com/roboflow/supervision.git@develop
2 | torch>=2.0.1
3 | torchvision>=0.15.2
4 | faster-coco-eval>=1.6.5
5 | PyYAML
6 | tensorboard
7 | scipy
8 | calflops
9 | transformers
10 | tqdm
11 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/results_D-FINE-L.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/Peterande/D-FINE",
4 | "paper_url": "https://arxiv.org/abs/2410.13842",
5 | "model": "D-FINE-L",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 30724195,
12 | "run_date": "2024-11-30T15:31:29.563018+00:00"
13 | },
14 | "map50_95": 0.5219932815159587,
15 | "map50": 0.6952979708509999,
16 | "map75": 0.5653622772704325,
17 | "small_objects": {
18 | "map50_95": 0.2477807526608342,
19 | "map50": 0.39281358142909667,
20 | "map75": 0.2682646010589643
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4757793179580914,
24 | "map50": 0.6506829538892683,
25 | "map75": 0.5321307963239714
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6679411840312329,
29 | "map50": 0.7990835690433563,
30 | "map75": 0.7183590809069729
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.055112414649932884,
45 | "f1_75": 0.045577933029039445,
46 | "f1_small_objects": {
47 | "f1_50": 0.0538862414751944,
48 | "f1_75": 0.03414610933748649
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09175005181275003,
52 | "f1_75": 0.07934473563523216
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.08174917885040568,
56 | "f1_75": 0.07779861089961485
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/results_D-FINE-M.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/Peterande/D-FINE",
4 | "paper_url": "https://arxiv.org/abs/2410.13842",
5 | "model": "D-FINE-M",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 19248189,
12 | "run_date": "2024-11-30T15:27:16.048157+00:00"
13 | },
14 | "map50_95": 0.5058476134984426,
15 | "map50": 0.6784489386840735,
16 | "map75": 0.5458102809213676,
17 | "small_objects": {
18 | "map50_95": 0.22101506894321837,
19 | "map50": 0.35919423860167804,
20 | "map75": 0.23411438906708412
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4625887037623695,
24 | "map50": 0.6360438151828612,
25 | "map75": 0.5153654469224979
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6525501696792834,
29 | "map50": 0.7865990282572766,
30 | "map75": 0.7028242508843852
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05439085557470057,
45 | "f1_75": 0.04462990245971832,
46 | "f1_small_objects": {
47 | "f1_50": 0.054219329911978476,
48 | "f1_75": 0.033933781321204996
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09002828069737208,
52 | "f1_75": 0.07714710066070882
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07786530182363084,
56 | "f1_75": 0.07370602951705649
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/results_D-FINE-N.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/Peterande/D-FINE",
4 | "paper_url": "https://arxiv.org/abs/2410.13842",
5 | "model": "D-FINE-N",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 3753799,
12 | "run_date": "2024-11-30T14:53:36.827013+00:00"
13 | },
14 | "map50_95": 0.41166844751896103,
15 | "map50": 0.5804468688476232,
16 | "map75": 0.44032133935943624,
17 | "small_objects": {
18 | "map50_95": 0.14772166810764642,
19 | "map50": 0.25995371220767033,
20 | "map75": 0.15252458599054255
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.35285141528183744,
24 | "map50": 0.5253203750965515,
25 | "map75": 0.3862506701611196
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5746650046013381,
29 | "map50": 0.7198294931560041,
30 | "map75": 0.6225356620937137
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05058755898129688,
45 | "f1_75": 0.037554961513929404,
46 | "f1_small_objects": {
47 | "f1_50": 0.04851364560060535,
48 | "f1_75": 0.021423510193421754
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.0776416142825443,
52 | "f1_75": 0.06009583714479435
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07216459506892758,
56 | "f1_75": 0.06711776075482231
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/results_D-FINE-S.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/Peterande/D-FINE",
4 | "paper_url": "https://arxiv.org/abs/2410.13842",
5 | "model": "D-FINE-S",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 10237491,
12 | "run_date": "2024-11-30T15:25:06.497738+00:00"
13 | },
14 | "map50_95": 0.4667940572641105,
15 | "map50": 0.6315233422975106,
16 | "map75": 0.5075257211881392,
17 | "small_objects": {
18 | "map50_95": 0.2023262851372202,
19 | "map50": 0.32968181064456004,
20 | "map75": 0.21768401657888195
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.41703368286419307,
24 | "map50": 0.5832924172471692,
25 | "map75": 0.4675721643466931
26 | },
27 | "large_objects": {
28 | "map50_95": 0.612227433009285,
29 | "map50": 0.7454489601512843,
30 | "map75": 0.6625822766791043
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.053318704601921355,
45 | "f1_75": 0.04302370379707862,
46 | "f1_small_objects": {
47 | "f1_50": 0.05341393465811958,
48 | "f1_75": 0.03234633429835207
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.08474685091911431,
52 | "f1_75": 0.0709119555892223
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07746434221415874,
56 | "f1_75": 0.07309819351528968
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/results_D-FINE-X.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/Peterande/D-FINE",
4 | "paper_url": "https://arxiv.org/abs/2410.13842",
5 | "model": "D-FINE-X",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 61601635,
12 | "run_date": "2024-11-30T15:34:31.249037+00:00"
13 | },
14 | "map50_95": 0.5412884800986779,
15 | "map50": 0.7166391180688009,
16 | "map75": 0.5843090799180614,
17 | "small_objects": {
18 | "map50_95": 0.26577391016604135,
19 | "map50": 0.4204213608890482,
20 | "map75": 0.2849821329125042
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.49187707994641156,
24 | "map50": 0.667776251420199,
25 | "map75": 0.5506275489522772
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6894573901354175,
29 | "map50": 0.8207794964547676,
30 | "map75": 0.7393501736230832
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05502261232306097,
45 | "f1_75": 0.045594707812090164,
46 | "f1_small_objects": {
47 | "f1_50": 0.05357001873043499,
48 | "f1_75": 0.033972001296026455
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09390118651490137,
52 | "f1_75": 0.08149773985318125
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.08145177470815365,
56 | "f1_75": 0.07772815532345857
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/d-fine/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import os
3 | import sys
4 | from pathlib import Path
5 | from typing import List, Optional
6 |
7 | import supervision as sv
8 | import torch
9 | import torch.nn as nn
10 | import torchvision.transforms as T
11 | from PIL import Image
12 | from supervision.metrics import F1Score, MeanAveragePrecision
13 | from tqdm import tqdm
14 |
15 | sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "./D-FINE/")))
16 |
17 | from src.core import YAMLConfig
18 |
19 | sys.path.append(str(Path(__file__).resolve().parent.parent))
20 |
21 | from configs import CONFIDENCE_THRESHOLD, DATASET_DIR
22 | from utils import (
23 | load_detections_dataset,
24 | result_json_already_exists,
25 | run_shell_command,
26 | write_result_json,
27 | )
28 |
29 | LICENSE = "Apache-2.0"
30 | RUN_PARAMETERS = dict(
31 | imgsz=640,
32 | conf=CONFIDENCE_THRESHOLD,
33 | )
34 | GIT_REPO_URL = "https://github.com/Peterande/D-FINE"
35 | PAPER_URL = "https://arxiv.org/abs/2410.13842"
36 |
37 | TRANSFORMS = T.Compose(
38 | [T.Resize((RUN_PARAMETERS["imgsz"], RUN_PARAMETERS["imgsz"])), T.ToTensor()]
39 | )
40 |
41 | DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
42 |
43 |
44 | MODEL_DICT = {
45 | "D-FINE-N": {
46 | "model_url": "https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_n_coco.pth",
47 | "model_filename": "dfine_n_coco.pth",
48 | "model_name": "D-FINE-N",
49 | "model_yaml": "./D-FINE/configs/dfine/dfine_hgnetv2_n_coco.yml",
50 | },
51 | "D-FINE-S": {
52 | "model_url": "https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_s_coco.pth",
53 | "model_filename": "dfine_s_coco.pth",
54 | "model_name": "D-FINE-S",
55 | "model_yaml": "./D-FINE/configs/dfine/dfine_hgnetv2_s_coco.yml",
56 | },
57 | "D-FINE-M": {
58 | "model_url": "https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_m_coco.pth",
59 | "model_filename": "dfine_m_coco.pth",
60 | "model_name": "D-FINE-M",
61 | "model_yaml": "./D-FINE/configs/dfine/dfine_hgnetv2_m_coco.yml",
62 | },
63 | "D-FINE-L": {
64 | "model_url": "https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_l_coco.pth",
65 | "model_filename": "dfine_l_coco.pth",
66 | "model_name": "D-FINE-L",
67 | "model_yaml": "./D-FINE/configs/dfine/dfine_hgnetv2_l_coco.yml",
68 | },
69 | "D-FINE-X": {
70 | "model_url": "https://github.com/Peterande/storage/releases/download/dfinev1.0/dfine_x_coco.pth",
71 | "model_filename": "dfine_x_coco.pth",
72 | "model_name": "D-FINE-X",
73 | "model_yaml": "./D-FINE/configs/dfine/dfine_hgnetv2_x_coco.yml",
74 | },
75 | } # noqa: E501 // docs
76 |
77 |
78 | def download_weight(url, model_filename):
79 | run_shell_command(
80 | [
81 | "wget",
82 | "-O",
83 | model_filename,
84 | url,
85 | ]
86 | )
87 |
88 |
89 | def run_on_image(model, image_array):
90 | im_pil = Image.fromarray(image_array)
91 | w, h = im_pil.size
92 | orig_size = torch.tensor([[w, h]]).to(DEVICE)
93 | im_data = TRANSFORMS(im_pil).unsqueeze(0).to(DEVICE)
94 | output = model(im_data, orig_size)
95 | labels, boxes, scores = output
96 | class_id = labels.detach().cpu().numpy().astype(int)
97 | xyxy = boxes.detach().cpu().numpy()
98 | confidence = scores.detach().cpu().numpy()
99 |
100 | detections = sv.Detections(
101 | xyxy=xyxy[0],
102 | confidence=confidence[0],
103 | class_id=class_id[0],
104 | )
105 | return detections
106 |
107 |
108 | def run(
109 | model_ids: List[str],
110 | skip_if_result_exists=False,
111 | dataset: Optional[sv.DetectionDataset] = None,
112 | ) -> None:
113 | """
114 | Run the evaluation for the given models and dataset.
115 |
116 | Arguments:
117 | model_ids: List of model ids to evaluate. Evaluate all models if None.
118 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
119 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
120 | """ # noqa: E501 // docs
121 | if not model_ids:
122 | model_ids = list(MODEL_DICT.keys())
123 |
124 | for model_id in model_ids:
125 | print(f"\nEvaluating model: {model_id}")
126 | model_values = MODEL_DICT[model_id]
127 |
128 | if skip_if_result_exists and result_json_already_exists(model_id):
129 | print(f"Skipping {model_id}. Result already exists!")
130 | continue
131 |
132 | if dataset is None:
133 | dataset = load_detections_dataset(DATASET_DIR)
134 |
135 | if not os.path.exists(model_values["model_filename"]):
136 | download_weight(model_values["model_url"], model_values["model_filename"])
137 |
138 | cfg = YAMLConfig(
139 | model_values["model_yaml"], resume=model_values["model_filename"]
140 | )
141 |
142 | if "HGNetv2" in cfg.yaml_cfg:
143 | cfg.yaml_cfg["HGNetv2"]["pretrained"] = False
144 |
145 | if model_values["model_filename"]:
146 | checkpoint = torch.load(model_values["model_filename"], map_location=DEVICE)
147 | if "ema" in checkpoint:
148 | state = checkpoint["ema"]["module"]
149 | else:
150 | state = checkpoint["model"]
151 | else:
152 | raise AttributeError("Only support resume to load model.state_dict by now.")
153 |
154 | cfg.model.load_state_dict(state)
155 |
156 | class Model(nn.Module):
157 | def __init__(self):
158 | super().__init__()
159 | self.model = cfg.model.deploy()
160 | self.postprocessor = cfg.postprocessor.deploy()
161 |
162 | def forward(self, images, orig_target_sizes):
163 | outputs = self.model(images)
164 | outputs = self.postprocessor(outputs, orig_target_sizes)
165 | return outputs
166 |
167 | model = Model().to(DEVICE)
168 |
169 | predictions = []
170 | targets = []
171 | print("Evaluating...")
172 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
173 | detections = run_on_image(model, image)
174 | detections = detections[detections.confidence > CONFIDENCE_THRESHOLD]
175 | predictions.append(detections)
176 | targets.append(target_detections)
177 |
178 | mAP_metric = MeanAveragePrecision()
179 | f1_score = F1Score()
180 |
181 | f1_score_result = f1_score.update(predictions, targets).compute()
182 | mAP_result = mAP_metric.update(predictions, targets).compute()
183 |
184 | write_result_json(
185 | model_id=model_id,
186 | model_name=model_values["model_name"],
187 | model_git_url=GIT_REPO_URL,
188 | paper_url=PAPER_URL,
189 | model=model,
190 | mAP_result=mAP_result,
191 | f1_score_result=f1_score_result,
192 | license_name=LICENSE,
193 | run_parameters=RUN_PARAMETERS,
194 | )
195 |
196 |
197 | if __name__ == "__main__":
198 | parser = argparse.ArgumentParser()
199 | parser.add_argument(
200 | "model_ids",
201 | nargs="*",
202 | help="Model ids to evaluate. If not provided, evaluate all models.",
203 | )
204 | parser.add_argument(
205 | "--skip_if_result_exists",
206 | action="store_true",
207 | help="If specified, skip the evaluation if the result json already exists.",
208 | )
209 | args = parser.parse_args()
210 |
211 | run(args.model_ids, args.skip_if_result_exists)
212 |
--------------------------------------------------------------------------------
/models/object_detection/deim/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/deim/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/deim/requirements.txt:
--------------------------------------------------------------------------------
1 | supervision @ git+https://github.com/roboflow/supervision.git@develop
2 | torch>=2.0.1
3 | torchvision>=0.15.2
4 | faster-coco-eval>=1.6.5
5 | PyYAML
6 | tensorboard
7 | scipy
8 | calflops
9 | transformers
10 | tqdm
11 | gdown
12 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-D-FINE-L.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-D-FINE-L",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 30769891,
12 | "run_date": "2025-02-20T20:06:01.399749+00:00"
13 | },
14 | "map50_95": 0.5305782111290365,
15 | "map50": 0.701972573092591,
16 | "map75": 0.5781382139623187,
17 | "small_objects": {
18 | "map50_95": 0.25411214249813463,
19 | "map50": 0.4018464220893677,
20 | "map75": 0.27742390441437914
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4908228351897662,
24 | "map50": 0.6643237291278714,
25 | "map75": 0.5522393255913339
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6691866567459411,
29 | "map50": 0.7995531262181084,
30 | "map75": 0.7240016978175483
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05579846532045357,
45 | "f1_75": 0.0462902363147331,
46 | "f1_small_objects": {
47 | "f1_50": 0.05588369629465948,
48 | "f1_75": 0.03572922744649411
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09461024393911491,
52 | "f1_75": 0.08208596088673967
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07744327270061774,
56 | "f1_75": 0.07386063394484454
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-D-FINE-M.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-D-FINE-M",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 19248189,
12 | "run_date": "2025-02-20T20:01:13.578883+00:00"
13 | },
14 | "map50_95": 0.5104083956132938,
15 | "map50": 0.6787658686920188,
16 | "map75": 0.5546481608923564,
17 | "small_objects": {
18 | "map50_95": 0.2511620530274855,
19 | "map50": 0.39609602904756624,
20 | "map75": 0.2694485952300316
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.46537729743667916,
24 | "map50": 0.6370586076621214,
25 | "map75": 0.5231311528869892
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6495194977191837,
29 | "map50": 0.7775466993372471,
30 | "map75": 0.6992232127804593
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05522070206068534,
45 | "f1_75": 0.045248111882742706,
46 | "f1_small_objects": {
47 | "f1_50": 0.05492631598200806,
48 | "f1_75": 0.034264094185322225
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09301255405640022,
52 | "f1_75": 0.07945573383848067
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07646877806104325,
56 | "f1_75": 0.07268313003126045
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-D-FINE-N.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-D-FINE-N",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 10237491,
12 | "run_date": "2025-02-20T19:56:45.022172+00:00"
13 | },
14 | "map50_95": 0.4727460130112636,
15 | "map50": 0.6373947504602839,
16 | "map75": 0.5122212141115503,
17 | "small_objects": {
18 | "map50_95": 0.20001449762090254,
19 | "map50": 0.3301205387009533,
20 | "map75": 0.209960751715719
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.42557760229157154,
24 | "map50": 0.59352658625712,
25 | "map75": 0.47802013045089115
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6120464052534242,
29 | "map50": 0.7426743646011116,
30 | "map75": 0.659565466848395
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.0547603360640866,
45 | "f1_75": 0.04410745481955724,
46 | "f1_small_objects": {
47 | "f1_50": 0.05446772353799717,
48 | "f1_75": 0.032202508685830133
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.08905474656815826,
52 | "f1_75": 0.07463922497314308
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07871211613944469,
56 | "f1_75": 0.07451788396115948
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-D-FINE-S.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-D-FINE-S",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 10237491,
12 | "run_date": "2025-02-20T19:58:49.232343+00:00"
13 | },
14 | "map50_95": 0.4727460130112636,
15 | "map50": 0.6373947504602839,
16 | "map75": 0.5122212141115503,
17 | "small_objects": {
18 | "map50_95": 0.20001449762090254,
19 | "map50": 0.3301205387009533,
20 | "map75": 0.209960751715719
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.42557760229157154,
24 | "map50": 0.59352658625712,
25 | "map75": 0.47802013045089115
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6120464052534242,
29 | "map50": 0.7426743646011116,
30 | "map75": 0.659565466848395
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.0547603360640866,
45 | "f1_75": 0.04410745481955724,
46 | "f1_small_objects": {
47 | "f1_50": 0.05446772353799717,
48 | "f1_75": 0.032202508685830133
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.08905474656815826,
52 | "f1_75": 0.07463922497314308
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07871211613944469,
56 | "f1_75": 0.07451788396115948
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-D-FINE-X.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-D-FINE-X",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 61695555,
12 | "run_date": "2025-02-20T20:09:10.609249+00:00"
13 | },
14 | "map50_95": 0.5482012039465322,
15 | "map50": 0.7189047783103304,
16 | "map75": 0.597967652165565,
17 | "small_objects": {
18 | "map50_95": 0.265548943897823,
19 | "map50": 0.416150303983979,
20 | "map75": 0.2886551166846735
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.5073919478477555,
24 | "map50": 0.6816750292398559,
25 | "map75": 0.5750115413243927
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6902311427531072,
29 | "map50": 0.8180779346770715,
30 | "map75": 0.7420462579566929
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05679880130095285,
45 | "f1_75": 0.047285277022998465,
46 | "f1_small_objects": {
47 | "f1_50": 0.05556824916828816,
48 | "f1_75": 0.035701899942226174
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09702051786410001,
52 | "f1_75": 0.08483196304564948
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.0790509041837203,
56 | "f1_75": 0.07553735726829071
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-RT-DETRv2-L.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-RT-DETRv2-L",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 42144876,
12 | "run_date": "2025-02-20T20:19:01.483998+00:00"
13 | },
14 | "map50_95": 0.5257220834444374,
15 | "map50": 0.7003831378646848,
16 | "map75": 0.571233987999587,
17 | "small_objects": {
18 | "map50_95": 0.2633876023881778,
19 | "map50": 0.4132813582831061,
20 | "map75": 0.28808623053184956
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.48163150411798367,
24 | "map50": 0.6590597630556143,
25 | "map75": 0.5399958205252996
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6654751949311057,
29 | "map50": 0.7969340355074662,
30 | "map75": 0.722820091919793
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05656097976755521,
45 | "f1_75": 0.046441633787031755,
46 | "f1_small_objects": {
47 | "f1_50": 0.054914762855029234,
48 | "f1_75": 0.034438928720988755
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.10002070574438046,
52 | "f1_75": 0.0856411113679184
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07726264739479823,
56 | "f1_75": 0.07334438697215113
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-RT-DETRv2-M*.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-RT-DETRv2-M*",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 32994576,
12 | "run_date": "2025-02-20T20:16:27.600662+00:00"
13 | },
14 | "map50_95": 0.5143623139936142,
15 | "map50": 0.6887818452005019,
16 | "map75": 0.5589661661595199,
17 | "small_objects": {
18 | "map50_95": 0.25091761735780815,
19 | "map50": 0.3978105991761154,
20 | "map75": 0.2728097610686857
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4654318534981864,
24 | "map50": 0.6451386869003961,
25 | "map75": 0.5193315060825865
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6593499222633901,
29 | "map50": 0.7921349712763117,
30 | "map75": 0.7164013326586189
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05623841290022541,
45 | "f1_75": 0.04591312282710465,
46 | "f1_small_objects": {
47 | "f1_50": 0.054984076637264664,
48 | "f1_75": 0.03412758547945647
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09780618685665284,
52 | "f1_75": 0.08279587375042227
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07375978587365739,
56 | "f1_75": 0.07007165424540572
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-RT-DETRv2-M.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-RT-DETRv2-M",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 31236356,
12 | "run_date": "2025-02-20T20:13:52.050453+00:00"
13 | },
14 | "map50_95": 0.49016576880229606,
15 | "map50": 0.6605780649546811,
16 | "map75": 0.529338670817596,
17 | "small_objects": {
18 | "map50_95": 0.23985943814144325,
19 | "map50": 0.3764782246195876,
20 | "map75": 0.25464778499819896
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.44887419934506634,
24 | "map50": 0.6181328695492796,
25 | "map75": 0.49813802852554784
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6236151150596891,
29 | "map50": 0.7603156568264783,
30 | "map75": 0.6759902405586351
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.055958165666215975,
45 | "f1_75": 0.04567158378953439,
46 | "f1_small_objects": {
47 | "f1_50": 0.05567988801021649,
48 | "f1_75": 0.03473933157495782
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09335487723063632,
52 | "f1_75": 0.07917378612346948
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07590553801542865,
56 | "f1_75": 0.07176129327670185
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-RT-DETRv2-S.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-RT-DETRv2-S",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 19979152,
12 | "run_date": "2025-02-20T20:11:19.137640+00:00"
13 | },
14 | "map50_95": 0.47160354082098516,
15 | "map50": 0.6366777182915276,
16 | "map75": 0.5128284728434012,
17 | "small_objects": {
18 | "map50_95": 0.2316247389269901,
19 | "map50": 0.36311507449405256,
20 | "map75": 0.2514675647174292
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4230785326333056,
24 | "map50": 0.5879297439754769,
25 | "map75": 0.47404768672600694
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6012874472434862,
29 | "map50": 0.732993585136058,
30 | "map75": 0.6533321504906515
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.056693300892318846,
45 | "f1_75": 0.04590880270234649,
46 | "f1_small_objects": {
47 | "f1_50": 0.056876645930155775,
48 | "f1_75": 0.034959490463296994
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09137861333562725,
52 | "f1_75": 0.0767188770884723
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07905882630657635,
56 | "f1_75": 0.07459310779515928
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/deim/results_DEIM-RT-DETRv2-X.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ShihuaHuang95/DEIM",
4 | "paper_url": "https://arxiv.org/abs/2412.04234",
5 | "model": "DEIM-RT-DETRv2-X",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 74872812,
12 | "run_date": "2025-02-20T20:22:13.172898+00:00"
13 | },
14 | "map50_95": 0.5373029281866407,
15 | "map50": 0.7129681118790253,
16 | "map75": 0.5826231912303913,
17 | "small_objects": {
18 | "map50_95": 0.2715300119181288,
19 | "map50": 0.4225112550083713,
20 | "map75": 0.2951068333295187
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.49480097270514384,
24 | "map50": 0.6759652087713575,
25 | "map75": 0.5566162467925686
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6841670526908471,
29 | "map50": 0.8148792562496683,
30 | "map75": 0.7330816329694259
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.056369521424623294,
45 | "f1_75": 0.046393229525545254,
46 | "f1_small_objects": {
47 | "f1_50": 0.05478029345318489,
48 | "f1_75": 0.03445371039425962
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.10017150770468486,
52 | "f1_75": 0.08609549358217748
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07839474844350999,
56 | "f1_75": 0.074737604660142
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/rt-detr/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/requirements.txt:
--------------------------------------------------------------------------------
1 | torch>=2.0.1
2 | torchvision>=0.15.2
3 | PyYAML
4 | tensorboard
5 | supervision @ git+https://github.com/roboflow/supervision.git@develop
6 | tqdm
7 | pycocotools
8 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetr_r101vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv1 r101vd",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 92486124,
12 | "run_date": "2024-09-23T00:21:53.772495+00:00"
13 | },
14 | "map50_95": 0.5243300327374072,
15 | "map50": 0.7039518895314949,
16 | "map75": 0.567804955644081,
17 | "small_objects": {
18 | "map50_95": 0.24785495423638104,
19 | "map50": 0.4006674653470536,
20 | "map75": 0.2710220439441845
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.47685825939112725,
24 | "map50": 0.6625457345615451,
25 | "map75": 0.535002975581649
26 | },
27 | "large_objects": {
28 | "map50_95": 0.675820203665162,
29 | "map50": 0.8126340925145898,
30 | "map75": 0.7285503198138372
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.055002367478898175,
45 | "f1_75": 0.044801037891291674,
46 | "f1_small_objects": {
47 | "f1_50": 0.05454378845982463,
48 | "f1_75": 0.03349339245023226
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09350859896632002,
52 | "f1_75": 0.07973878658212949
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07539115839654872,
56 | "f1_75": 0.07182353249020428
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetr_r18vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv1 r18vd",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 21955472,
12 | "run_date": "2024-09-23T00:13:40.227469+00:00"
13 | },
14 | "map50_95": 0.4475030676297468,
15 | "map50": 0.6156237779572044,
16 | "map75": 0.4840745641950413,
17 | "small_objects": {
18 | "map50_95": 0.1903557604217221,
19 | "map50": 0.3089236487784832,
20 | "map75": 0.20308444784374644
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.39524155476087713,
24 | "map50": 0.561293029737317,
25 | "map75": 0.4427824332908067
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5894997261827915,
29 | "map50": 0.7265982743927857,
30 | "map75": 0.6411468239795823
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.053371116537810466,
45 | "f1_75": 0.04239322395192036,
46 | "f1_small_objects": {
47 | "f1_50": 0.05425970668777465,
48 | "f1_75": 0.031303239161977504
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.08500153986627708,
52 | "f1_75": 0.07000788375061538
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07171836156682274,
56 | "f1_75": 0.06735933629335475
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetr_r34vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv1 r34vd",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 33212676,
12 | "run_date": "2024-09-23T00:15:53.484978+00:00"
13 | },
14 | "map50_95": 0.47111442819735466,
15 | "map50": 0.6444973848870641,
16 | "map75": 0.508935911594047,
17 | "small_objects": {
18 | "map50_95": 0.21051584478386856,
19 | "map50": 0.34105471041443125,
20 | "map75": 0.22164556950501305
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.42145927945624584,
24 | "map50": 0.5926057024799771,
25 | "map75": 0.4698293535009732
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6165598066953086,
29 | "map50": 0.755263259616,
30 | "map75": 0.667420318296039
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.053745432714569996,
45 | "f1_75": 0.04303912632299453,
46 | "f1_small_objects": {
47 | "f1_50": 0.05440093689866381,
48 | "f1_75": 0.032358600850793104
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.08658033405706038,
52 | "f1_75": 0.07186071097655883
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.073251962690366,
56 | "f1_75": 0.06901239395674584
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetr_r50vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv1 r50vd",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 49972332,
12 | "run_date": "2024-09-23T00:18:34.977017+00:00"
13 | },
14 | "map50_95": 0.5148052539985135,
15 | "map50": 0.6922127474679616,
16 | "map75": 0.558997224099962,
17 | "small_objects": {
18 | "map50_95": 0.24458802092882242,
19 | "map50": 0.38689885245134964,
20 | "map75": 0.263016054638632
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4667201473419317,
24 | "map50": 0.6472867660110201,
25 | "map75": 0.5228654414090164
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6591424467339808,
29 | "map50": 0.7966885597912683,
30 | "map75": 0.7127943119656797
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05444841836097603,
45 | "f1_75": 0.04400212012671933,
46 | "f1_small_objects": {
47 | "f1_50": 0.05379096903297764,
48 | "f1_75": 0.03261229057778585
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09426047509837394,
52 | "f1_75": 0.07970749291579406
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07435390724868844,
56 | "f1_75": 0.07027811474263318
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetrv2_r101vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv2-X",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 92486124,
12 | "run_date": "2024-09-23T00:36:00.602945+00:00"
13 | },
14 | "map50_95": 0.524330135379127,
15 | "map50": 0.7039527758683545,
16 | "map75": 0.5678049718241299,
17 | "small_objects": {
18 | "map50_95": 0.24785492909149323,
19 | "map50": 0.4006674653470536,
20 | "map75": 0.2710220492958572
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4768583569258813,
24 | "map50": 0.6625460400176398,
25 | "map75": 0.5350030177768078
26 | },
27 | "large_objects": {
28 | "map50_95": 0.675820230218495,
29 | "map50": 0.8126341241234787,
30 | "map75": 0.7285502979309774
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05500236299955658,
45 | "f1_75": 0.044801033467918534,
46 | "f1_small_objects": {
47 | "f1_50": 0.05454378845982463,
48 | "f1_75": 0.03349339245023226
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09350859896632002,
52 | "f1_75": 0.07973878658212949
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07539119526112004,
56 | "f1_75": 0.07182356986223006
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetrv2_r18vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv2-S",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 21955472,
12 | "run_date": "2024-09-23T00:25:32.473961+00:00"
13 | },
14 | "map50_95": 0.4687995594739721,
15 | "map50": 0.6370584442700051,
16 | "map75": 0.5068775665451742,
17 | "small_objects": {
18 | "map50_95": 0.21535478708745526,
19 | "map50": 0.3395428793596645,
20 | "map75": 0.22778600330760204
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.41591835004016675,
24 | "map50": 0.5827107821612142,
25 | "map75": 0.46111270923584735
26 | },
27 | "large_objects": {
28 | "map50_95": 0.60757163483514,
29 | "map50": 0.7449516529285525,
30 | "map75": 0.6571583698150866
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05489119320669778,
45 | "f1_75": 0.04446234049068596,
46 | "f1_small_objects": {
47 | "f1_50": 0.055466136295587554,
48 | "f1_75": 0.03394097035234522
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.08779669621363051,
52 | "f1_75": 0.0735618499533047
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07563666994700585,
56 | "f1_75": 0.07128785595007565
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetrv2_r34vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv2-M*",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 33212676,
12 | "run_date": "2024-09-23T00:27:41.586842+00:00"
13 | },
14 | "map50_95": 0.4867825440454518,
15 | "map50": 0.6591044524702077,
16 | "map75": 0.5255439550758244,
17 | "small_objects": {
18 | "map50_95": 0.22517464073284382,
19 | "map50": 0.3616161608257908,
20 | "map75": 0.2380460844855324
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.43619245605646295,
24 | "map50": 0.6090810274677497,
25 | "map75": 0.48462339743332017
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6273765615214366,
29 | "map50": 0.7658607828593057,
30 | "map75": 0.6792628879214015
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05509647324342255,
45 | "f1_75": 0.044924997682578134,
46 | "f1_small_objects": {
47 | "f1_50": 0.05463693287388067,
48 | "f1_75": 0.03372508413469393
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09032468725870704,
52 | "f1_75": 0.07686256376961177
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07621153453216076,
56 | "f1_75": 0.07202891395291544
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetrv2_r50vd.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv2-M",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 38364780,
12 | "run_date": "2024-09-23T00:30:06.914466+00:00"
13 | },
14 | "map50_95": 0.5057647922140187,
15 | "map50": 0.6812943207851568,
16 | "map75": 0.5482094806381007,
17 | "small_objects": {
18 | "map50_95": 0.22601771533549928,
19 | "map50": 0.35776425722949756,
20 | "map75": 0.24745473591662773
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.45756539029705195,
24 | "map50": 0.6369386230810548,
25 | "map75": 0.5139974844350771
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6547944494390048,
29 | "map50": 0.7943383115502267,
30 | "map75": 0.7096514804332894
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.055647575325199775,
45 | "f1_75": 0.0452843444851405,
46 | "f1_small_objects": {
47 | "f1_50": 0.05389092791069118,
48 | "f1_75": 0.03289760323611028
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.0941548273166887,
52 | "f1_75": 0.07993164626581387
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07519198198582225,
56 | "f1_75": 0.0714592012655044
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/results_rtdetrv2_r50vd_m.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/lyuwenyu/RT-DETR",
4 | "paper_url": "https://arxiv.org/abs/2304.08069",
5 | "model": "RT-DETRv2-L",
6 | "license": "Apache-2.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 49972332,
12 | "run_date": "2024-09-23T00:32:50.133187+00:00"
13 | },
14 | "map50_95": 0.5219432048195001,
15 | "map50": 0.7014642165353273,
16 | "map75": 0.5637984313455033,
17 | "small_objects": {
18 | "map50_95": 0.2498701685478955,
19 | "map50": 0.3996864221475997,
20 | "map75": 0.2697685071948783
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4768529921674922,
24 | "map50": 0.6548019470037263,
25 | "map75": 0.5339029559083259
26 | },
27 | "large_objects": {
28 | "map50_95": 0.667671045384316,
29 | "map50": 0.8063987452700319,
30 | "map75": 0.7188082840384038
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05580583753272465,
45 | "f1_75": 0.04553311026492095,
46 | "f1_small_objects": {
47 | "f1_50": 0.05412276343757983,
48 | "f1_75": 0.03337345531600436
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.09500222610404424,
52 | "f1_75": 0.08138220551736451
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07920992898991662,
56 | "f1_75": 0.07500634010758714
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rt-detr/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import sys
3 | from pathlib import Path
4 | from typing import List, Optional
5 |
6 | import supervision as sv
7 | import torch
8 | import torchvision.transforms as T
9 | from PIL import Image
10 | from supervision.metrics import F1Score, MeanAveragePrecision
11 | from tqdm import tqdm
12 |
13 | sys.path.append(str(Path(__file__).resolve().parent.parent))
14 |
15 | from configs import CONFIDENCE_THRESHOLD, DATASET_DIR
16 | from utils import (
17 | load_detections_dataset,
18 | result_json_already_exists,
19 | write_result_json,
20 | )
21 |
22 | MODEL_DICT = {
23 | "rtdetr_r18vd": {"name": "RT-DETRv1 r18vd", "hub_id": "rtdetr_r18vd"},
24 | "rtdetr_r34vd": {"name": "RT-DETRv1 r34vd", "hub_id": "rtdetr_r34vd"},
25 | "rtdetr_r50vd": {"name": "RT-DETRv1 r50vd", "hub_id": "rtdetr_r50vd"},
26 | "rtdetr_r101vd": {"name": "RT-DETRv1 r101vd", "hub_id": "rtdetr_r101vd"},
27 | "rtdetrv2_r18vd": {"name": "RT-DETRv2-S", "hub_id": "rtdetrv2_r18vd"},
28 | "rtdetrv2_r34vd": {"name": "RT-DETRv2-M*", "hub_id": "rtdetrv2_r34vd"},
29 | "rtdetrv2_r50vd": {"name": "RT-DETRv2-M", "hub_id": "rtdetrv2_r50vd_m"},
30 | "rtdetrv2_r50vd_m": {"name": "RT-DETRv2-L", "hub_id": "rtdetrv2_r50vd"},
31 | "rtdetrv2_r101vd": {"name": "RT-DETRv2-X", "hub_id": "rtdetrv2_r101vd"},
32 | }
33 |
34 |
35 | LICENSE = "Apache-2.0"
36 | HUB_URL = "lyuwenyu/RT-DETR"
37 | RUN_PARAMETERS = dict(
38 | imgsz=640,
39 | conf=CONFIDENCE_THRESHOLD,
40 | )
41 | GIT_REPO_URL = "https://github.com/lyuwenyu/RT-DETR"
42 | PAPER_URL = "https://arxiv.org/abs/2304.08069"
43 |
44 |
45 | TRANSFORMS = T.Compose(
46 | [T.Resize((RUN_PARAMETERS["imgsz"], RUN_PARAMETERS["imgsz"])), T.ToTensor()]
47 | )
48 | DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
49 |
50 |
51 | def run(
52 | model_ids: List[str],
53 | skip_if_result_exists=False,
54 | dataset: Optional[sv.DetectionDataset] = None,
55 | ) -> None:
56 | """
57 | Run the evaluation for the given models and dataset.
58 |
59 | Arguments:
60 | model_ids: List of model ids to evaluate. Evaluate all models if None.
61 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
62 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
63 | """ # noqa: E501 // docs
64 | if not model_ids:
65 | model_ids = list(MODEL_DICT.keys())
66 |
67 | for model_id in model_ids:
68 | print(f"\nEvaluating model: {model_id}")
69 | model_values = MODEL_DICT[model_id]
70 |
71 | if skip_if_result_exists and result_json_already_exists(model_id):
72 | print(f"Skipping {model_id}. Result already exists!")
73 | continue
74 |
75 | if dataset is None:
76 | dataset = load_detections_dataset(DATASET_DIR)
77 |
78 | model = torch.hub.load(HUB_URL, model_values["hub_id"], pretrained=True)
79 | model = model.to(DEVICE)
80 |
81 | predictions = []
82 | targets = []
83 | print("Evaluating...")
84 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
85 | img = Image.fromarray(image)
86 | width, height = img.size
87 | orig_size = torch.tensor([width, height])[None].to(DEVICE)
88 | im_data = TRANSFORMS(img)[None].to(DEVICE)
89 |
90 | results = model(im_data, orig_size)
91 | labels, boxes, scores = results
92 | class_id = labels.detach().cpu().numpy().astype(int)
93 | xyxy = boxes.detach().cpu().numpy()
94 | confidence = scores.detach().cpu().numpy()
95 |
96 | detections = sv.Detections(
97 | xyxy=xyxy[0],
98 | confidence=confidence[0],
99 | class_id=class_id[0],
100 | )
101 |
102 | detections = detections[detections.confidence > CONFIDENCE_THRESHOLD]
103 | predictions.append(detections)
104 |
105 | target_detections.mask = None
106 | targets.append(target_detections)
107 |
108 | mAP_metric = MeanAveragePrecision()
109 | f1_metric = F1Score()
110 | f1_result = f1_metric.update(predictions, targets).compute()
111 | mAP_result = mAP_metric.update(predictions, targets).compute()
112 |
113 | write_result_json(
114 | model_id=model_id,
115 | model_name=model_values["name"],
116 | model_git_url=GIT_REPO_URL,
117 | paper_url=PAPER_URL,
118 | model=model,
119 | mAP_result=mAP_result,
120 | f1_score_result=f1_result,
121 | license_name=LICENSE,
122 | run_parameters=RUN_PARAMETERS,
123 | )
124 |
125 |
126 | if __name__ == "__main__":
127 | parser = argparse.ArgumentParser()
128 | parser.add_argument(
129 | "model_ids",
130 | nargs="*",
131 | help="Model ids to evaluate. If not provided, evaluate all models.",
132 | )
133 | parser.add_argument(
134 | "--skip_if_result_exists",
135 | action="store_true",
136 | help="If specified, skip the evaluation if the result json already exists.",
137 | )
138 | args = parser.parse_args()
139 |
140 | run(args.model_ids, args.skip_if_result_exists)
141 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/README.md:
--------------------------------------------------------------------------------
1 | # RTMDet Installation Guide
2 |
3 | This guide will help you set up Python 3.9 and install RTMDet along with OpenMIM
4 |
5 | ## Step 1: Set Up a Virtual Environment
6 |
7 | First, ensure you have Python 3.9 installed. You can check this by running and following comamnd and create virtualenvironments:
8 |
9 | ```sh
10 | python3.9 --version
11 | python3.9 -m venv .venv
12 | source .venv/bin/activate
13 | ```
14 |
15 | ## Step 2: Install requirements
16 |
17 | ```sh
18 | pip install openmim
19 | mim install -r requirements.txt
20 | ```
21 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/requirements.txt:
--------------------------------------------------------------------------------
1 | https://download.pytorch.org/whl/cu118/torch-2.0.0%2Bcu118-cp39-cp39-linux_x86_64.whl
2 | https://download.openmmlab.com/mmcv/dist/cu118/torch2.0.0/mmcv-2.0.0-cp39-cp39-manylinux1_x86_64.whl
3 | supervision @ git+https://github.com/roboflow/supervision.git@develop
4 | openmim==0.3.9
5 | mmdet==3.3.0
6 | mmengine==0.10.5
7 | mmyolo==0.6.0
8 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/results_rtmdet_l_syncbn_fast_8xb32-300e_coco.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/open-mmlab/mmyolo/tree/main/configs/rtmdet",
4 | "paper_url": "https://arxiv.org/abs/2212.07784",
5 | "model": "RTMDet-l",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 52315804,
12 | "run_date": "2024-09-23T02:44:35.648853+00:00"
13 | },
14 | "map50_95": 0.5062431026930081,
15 | "map50": 0.6822713528807453,
16 | "map75": 0.552470545227493,
17 | "small_objects": {
18 | "map50_95": 0.2356686618529939,
19 | "map50": 0.372615556532781,
20 | "map75": 0.25208955641500647
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.46594759881472436,
24 | "map50": 0.6514727526021955,
25 | "map75": 0.5198676423072635
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6464732327266226,
29 | "map50": 0.7900282126284217,
30 | "map75": 0.7058076059425709
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05531823313118092,
45 | "f1_75": 0.04542934511571345,
46 | "f1_small_objects": {
47 | "f1_50": 0.06119915689149719,
48 | "f1_75": 0.03836892145477396
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.07505402197985796,
52 | "f1_75": 0.06332868604087104
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.09115047938045687,
56 | "f1_75": 0.08450031511677494
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/results_rtmdet_m_syncbn_fast_8xb32-300e_coco.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/open-mmlab/mmyolo/tree/main/configs/rtmdet",
4 | "paper_url": "https://arxiv.org/abs/2212.07784",
5 | "model": "RTMDet-m",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 24709188,
12 | "run_date": "2024-09-23T02:37:49.630440+00:00"
13 | },
14 | "map50_95": 0.48535066916147096,
15 | "map50": 0.6607049475508446,
16 | "map75": 0.531475507320353,
17 | "small_objects": {
18 | "map50_95": 0.2201439867612042,
19 | "map50": 0.3465088244131632,
20 | "map75": 0.2403171863947742
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.44030792587786527,
24 | "map50": 0.6228541655761869,
25 | "map75": 0.49451482617851844
26 | },
27 | "large_objects": {
28 | "map50_95": 0.625890774022884,
29 | "map50": 0.7789356056967076,
30 | "map75": 0.6825013203277369
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.054617483111037333,
45 | "f1_75": 0.04412471964295952,
46 | "f1_small_objects": {
47 | "f1_50": 0.05965303405294159,
48 | "f1_75": 0.03591382413978633
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.07372920050595458,
52 | "f1_75": 0.060873287120914145
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.0933220321748441,
56 | "f1_75": 0.0860701700079945
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/results_rtmdet_s_syncbn_fast_8xb32-300e_coco.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/open-mmlab/mmyolo/tree/main/configs/rtmdet",
4 | "paper_url": "https://arxiv.org/abs/2212.07784",
5 | "model": "RTMDet-s",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 8886924,
12 | "run_date": "2024-09-23T02:33:02.571049+00:00"
13 | },
14 | "map50_95": 0.43884390387565153,
15 | "map50": 0.6099215664056953,
16 | "map75": 0.4771239324201934,
17 | "small_objects": {
18 | "map50_95": 0.16907088913570323,
19 | "map50": 0.27735569273645844,
20 | "map75": 0.18161027212724581
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.388863839838892,
24 | "map50": 0.5659413183752309,
25 | "map75": 0.43058881328827125
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5870105310486934,
29 | "map50": 0.7419594769103826,
30 | "map75": 0.6440220702339187
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.04988311132575794,
45 | "f1_75": 0.038791749401449555,
46 | "f1_small_objects": {
47 | "f1_50": 0.05386625077485213,
48 | "f1_75": 0.028392506988554753
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.06750792274596967,
52 | "f1_75": 0.05357777849502396
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.07715824357094489,
56 | "f1_75": 0.07029191887371607
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/results_rtmdet_tiny_syncbn_fast_8xb32-300e_coco.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/open-mmlab/mmyolo/tree/main/configs/rtmdet",
4 | "paper_url": "https://arxiv.org/abs/2212.07784",
5 | "model": "RTMDet-tiny",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 4896168,
12 | "run_date": "2024-09-23T02:29:25.974497+00:00"
13 | },
14 | "map50_95": 0.40516442847618367,
15 | "map50": 0.5690609152583831,
16 | "map75": 0.43926359421134265,
17 | "small_objects": {
18 | "map50_95": 0.1399772349713988,
19 | "map50": 0.234896774109904,
20 | "map75": 0.14667939327126447
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.35137093290680516,
24 | "map50": 0.5161420691514612,
25 | "map75": 0.3884770744047453
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5544068105044913,
29 | "map50": 0.7098826664605629,
30 | "map75": 0.607657675893561
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.05115173742152011,
45 | "f1_75": 0.03866251488920745,
46 | "f1_small_objects": {
47 | "f1_50": 0.054774256812043835,
48 | "f1_75": 0.027264200575657104
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.06471982396658556,
52 | "f1_75": 0.04950546877922435
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.08170988295326313,
56 | "f1_75": 0.07323947683724118
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/results_rtmdet_x_syncbn_fast_8xb32-300e_coco.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/open-mmlab/mmyolo/tree/main/configs/rtmdet",
4 | "paper_url": "https://arxiv.org/abs/2212.07784",
5 | "model": "RTMDet-x",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 94855572,
12 | "run_date": "2024-09-23T02:54:35.626133+00:00"
13 | },
14 | "map50_95": 0.5209716330832249,
15 | "map50": 0.6958011733601689,
16 | "map75": 0.5728153975103335,
17 | "small_objects": {
18 | "map50_95": 0.25265192304587114,
19 | "map50": 0.392029710670392,
20 | "map75": 0.27307442016473715
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.47657971083262485,
24 | "map50": 0.656230860968036,
25 | "map75": 0.5384045845210627
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6595025818284241,
29 | "map50": 0.8022158939722328,
30 | "map75": 0.7220228933441815
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.054119924973050584,
45 | "f1_75": 0.04473847756154315,
46 | "f1_small_objects": {
47 | "f1_50": 0.06148389892622576,
48 | "f1_75": 0.03937410656746626
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.07367794650081896,
52 | "f1_75": 0.06236223618041832
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.08746983223678406,
56 | "f1_75": 0.08163011681669821
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/rtmdet/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import sys
3 | from pathlib import Path
4 | from typing import List, Optional
5 |
6 | import supervision as sv
7 | import torch
8 | from mmdet.apis import inference_detector, init_detector
9 | from supervision.metrics import F1Score, MeanAveragePrecision
10 | from tqdm import tqdm
11 |
12 | sys.path.append(str(Path(__file__).resolve().parent.parent))
13 |
14 | from configs import CONFIDENCE_THRESHOLD, DATASET_DIR
15 | from utils import (
16 | load_detections_dataset,
17 | result_json_already_exists,
18 | run_shell_command,
19 | write_result_json,
20 | )
21 |
22 | MODEL_DICT: dict = {
23 | "rtmdet_tiny_syncbn_fast_8xb32-300e_coco": {
24 | "model_name": "RTMDet-tiny",
25 | "config": "./mmyolo-weights/rtmdet_tiny_syncbn_fast_8xb32-300e_coco.py",
26 | "checkpoint_file": "./mmyolo-weights/rtmdet_tiny_syncbn_fast_8xb32-300e_coco_20230102_140117-dbb1dc83.pth", # noqa: E501 // docs
27 | },
28 | "rtmdet_s_syncbn_fast_8xb32-300e_coco": {
29 | "model_name": "RTMDet-s",
30 | "config": "./mmyolo-weights/rtmdet_s_syncbn_fast_8xb32-300e_coco.py",
31 | "checkpoint_file": "./mmyolo-weights/rtmdet_s_syncbn_fast_8xb32-300e_coco_20221230_182329-0a8c901a.pth", # noqa: E501 // docs
32 | },
33 | "rtmdet_m_syncbn_fast_8xb32-300e_coco": {
34 | "model_name": "RTMDet-m",
35 | "config": "./mmyolo-weights/rtmdet_m_syncbn_fast_8xb32-300e_coco.py",
36 | "checkpoint_file": "./mmyolo-weights/rtmdet_m_syncbn_fast_8xb32-300e_coco_20230102_135952-40af4fe8.pth", # noqa: E501 // docs
37 | },
38 | "rtmdet_l_syncbn_fast_8xb32-300e_coco": {
39 | "model_name": "RTMDet-l",
40 | "config": "./mmyolo-weights/rtmdet_l_syncbn_fast_8xb32-300e_coco.py",
41 | "checkpoint_file": "./mmyolo-weights/rtmdet_l_syncbn_fast_8xb32-300e_coco_20230102_135928-ee3abdc4.pth", # noqa: E501 // docs
42 | },
43 | "rtmdet_x_syncbn_fast_8xb32-300e_coco": {
44 | "model_name": "RTMDet-x",
45 | "config": "./mmyolo-weights/rtmdet_x_syncbn_fast_8xb32-300e_coco.py",
46 | "checkpoint_file": "./mmyolo-weights/rtmdet_x_syncbn_fast_8xb32-300e_coco_20221231_100345-b85cd476.pth", # noqa: E501 // docs
47 | },
48 | }
49 |
50 | LICENSE = "GPL-3.0"
51 | DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
52 | RUN_PARAMETERS = dict(
53 | imgsz=640,
54 | conf=CONFIDENCE_THRESHOLD,
55 | )
56 | GIT_REPO_URL = "https://github.com/open-mmlab/mmyolo/tree/main/configs/rtmdet"
57 | PAPER_URL = "https://arxiv.org/abs/2212.07784"
58 |
59 |
60 | def run_on_image(model, image) -> sv.Detections:
61 | result = inference_detector(model, image)
62 | detections = sv.Detections.from_mmdetection(result)
63 | return detections
64 |
65 |
66 | def download_weight(config_name):
67 | run_shell_command(
68 | [
69 | "mim",
70 | "download",
71 | "mmyolo",
72 | "--config",
73 | config_name,
74 | "--dest",
75 | "mmyolo-weights/",
76 | ]
77 | )
78 |
79 |
80 | def run(
81 | model_ids: List[str],
82 | skip_if_result_exists=False,
83 | dataset: Optional[sv.DetectionDataset] = None,
84 | ) -> None:
85 | """
86 | Run the evaluation for the given models and dataset.
87 |
88 | Arguments:
89 | model_ids: List of model ids to evaluate. Evaluate all models if None.
90 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
91 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
92 | """ # noqa: E501 // docs
93 | if not model_ids:
94 | model_ids = list(MODEL_DICT.keys())
95 |
96 | for model_id in model_ids:
97 | print(f"\nEvaluating model: {model_id}")
98 | model_values = MODEL_DICT[model_id]
99 |
100 | if skip_if_result_exists and result_json_already_exists(model_id):
101 | print(f"Skipping {model_id}. Result already exists!")
102 | continue
103 |
104 | if dataset is None:
105 | dataset = load_detections_dataset(DATASET_DIR)
106 |
107 | download_weight(model_id)
108 |
109 | model = init_detector(
110 | model_values["config"], model_values["checkpoint_file"], DEVICE
111 | )
112 |
113 | predictions = []
114 | targets = []
115 | print("Evaluating...")
116 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
117 | # Run model
118 | detections = run_on_image(model, image)
119 | detections = detections[detections.confidence > CONFIDENCE_THRESHOLD]
120 | predictions.append(detections)
121 | targets.append(target_detections)
122 |
123 | mAP_metric = MeanAveragePrecision()
124 | f1_score = F1Score()
125 |
126 | f1_score_result = f1_score.update(predictions, targets).compute()
127 | mAP_result = mAP_metric.update(predictions, targets).compute()
128 |
129 | write_result_json(
130 | model_id=model_id,
131 | model_name=model_values["model_name"],
132 | model_git_url=GIT_REPO_URL,
133 | paper_url=PAPER_URL,
134 | model=model,
135 | mAP_result=mAP_result,
136 | f1_score_result=f1_score_result,
137 | license_name=LICENSE,
138 | run_parameters=RUN_PARAMETERS,
139 | )
140 |
141 |
142 | if __name__ == "__main__":
143 | parser = argparse.ArgumentParser()
144 | parser.add_argument(
145 | "model_ids",
146 | nargs="*",
147 | help="Model ids to evaluate. If not provided, evaluate all models.",
148 | )
149 | parser.add_argument(
150 | "--skip_if_result_exists",
151 | action="store_true",
152 | help="If specified, skip the evaluation if the result json already exists.",
153 | )
154 | args = parser.parse_args()
155 |
156 | run(args.model_ids, args.skip_if_result_exists)
157 |
--------------------------------------------------------------------------------
/models/object_detection/utils.py:
--------------------------------------------------------------------------------
1 | import json
2 | import os
3 | import subprocess
4 | from datetime import datetime, timezone
5 | from typing import Any, List, Optional
6 |
7 | import supervision as sv
8 | from supervision.metrics import F1ScoreResult, MeanAveragePrecisionResult
9 | from torch import nn
10 |
11 |
12 | def load_detections_dataset(dataset_dir: str) -> sv.DetectionDataset:
13 | print("Loading detections dataset...")
14 | dataset = sv.DetectionDataset.from_coco(
15 | images_directory_path=f"{dataset_dir}/images/val2017",
16 | annotations_path=f"{dataset_dir}/labels/annotations/instances_val2017.json",
17 | )
18 |
19 | return dataset
20 |
21 |
22 | def download_file(url: str, output_filename: str) -> None:
23 | command = ["wget", url, "-O", output_filename]
24 | subprocess.run(
25 | command, check=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
26 | )
27 |
28 |
29 | def run_shell_command(command: List[str], working_directory=None) -> None:
30 | subprocess.run(
31 | command, check=True, text=True, stdout=None, stderr=None, cwd=working_directory
32 | )
33 |
34 |
35 | def count_model_params(model: nn.Module) -> int:
36 | param_count = sum(p.numel() for p in model.parameters())
37 | return param_count
38 |
39 |
40 | def _make_result_filename(model_id: str) -> str:
41 | return f"results_{model_id}.json"
42 |
43 |
44 | def result_json_already_exists(model_id: str) -> bool:
45 | result_file = _make_result_filename(model_id)
46 | return os.path.exists(result_file)
47 |
48 |
49 | def write_result_json(
50 | model_id: str,
51 | model_name: str,
52 | model_git_url: str,
53 | paper_url: Optional[str],
54 | model: nn.Module,
55 | mAP_result: MeanAveragePrecisionResult,
56 | f1_score_result: F1ScoreResult,
57 | license_name: str,
58 | run_parameters: dict[str, Any] = {},
59 | ) -> None:
60 | result: dict[str, Any] = {}
61 |
62 | result["metadata"] = {
63 | "model": model_name,
64 | "license": license_name,
65 | "github_url": model_git_url,
66 | "paper_url": paper_url,
67 | "run_parameters": run_parameters,
68 | "param_count": count_model_params(model),
69 | "run_date": datetime.now(timezone.utc).isoformat(),
70 | }
71 |
72 | result["map50_95"] = mAP_result.map50_95
73 | result["map50"] = mAP_result.map50
74 | result["map75"] = mAP_result.map75
75 |
76 | result["small_objects"] = {
77 | "map50_95": mAP_result.small_objects.map50_95,
78 | "map50": mAP_result.small_objects.map50,
79 | "map75": mAP_result.small_objects.map75,
80 | }
81 |
82 | result["medium_objects"] = {
83 | "map50_95": mAP_result.medium_objects.map50_95,
84 | "map50": mAP_result.medium_objects.map50,
85 | "map75": mAP_result.medium_objects.map75,
86 | }
87 |
88 | result["large_objects"] = {
89 | "map50_95": mAP_result.large_objects.map50_95,
90 | "map50": mAP_result.large_objects.map50,
91 | "map75": mAP_result.large_objects.map75,
92 | }
93 |
94 | result["iou_thresholds"] = list(mAP_result.iou_thresholds)
95 |
96 | result["f1_50"] = f1_score_result.f1_50
97 | result["f1_75"] = f1_score_result.f1_75
98 |
99 | result["f1_small_objects"] = {
100 | "f1_50": f1_score_result.small_objects.f1_50,
101 | "f1_75": f1_score_result.small_objects.f1_75,
102 | }
103 |
104 | result["f1_medium_objects"] = {
105 | "f1_50": f1_score_result.medium_objects.f1_50,
106 | "f1_75": f1_score_result.medium_objects.f1_75,
107 | }
108 |
109 | result["f1_large_objects"] = {
110 | "f1_50": f1_score_result.large_objects.f1_50,
111 | "f1_75": f1_score_result.large_objects.f1_75,
112 | }
113 |
114 | result["f1_iou_thresholds"] = list(f1_score_result.iou_thresholds)
115 |
116 | result_file = _make_result_filename(model_id)
117 | if os.path.exists(result_file):
118 | os.rename(result_file, f"{result_file}.old")
119 |
120 | with open(result_file, "w") as f:
121 | json.dump(result, f, indent=4)
122 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/yolov10/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/yolov10/requirements.txt:
--------------------------------------------------------------------------------
1 | supervision @ git+https://github.com/roboflow/supervision.git@develop
2 | ultralytics @ git+https://github.com/THU-MIG/yolov10.git@cd2f79c70299c9041fb6d19617ef1296f47575b1
3 | tqdm
4 | safetensors
5 | huggingface_hub
6 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/results_yolov10b.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/THU-MIG/yolov10",
4 | "paper_url": "https://arxiv.org/abs/2405.14458",
5 | "model": "yolov10b",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 20534512,
15 | "run_date": "2024-09-30T05:52:31.175907+00:00"
16 | },
17 | "map50_95": 0.5144131631757074,
18 | "map50": 0.6823977217818035,
19 | "map75": 0.5628675385891679,
20 | "small_objects": {
21 | "map50_95": 0.2565106658531823,
22 | "map50": 0.3970774560681853,
23 | "map75": 0.2797342004838285
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.4830814964720022,
27 | "map50": 0.6548616180390597,
28 | "map75": 0.5443189308098335
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6501428216905192,
32 | "map50": 0.7838676391542665,
33 | "map75": 0.7069441622037982
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.14999323533265066,
48 | "f1_75": 0.12775961534999047,
49 | "f1_small_objects": {
50 | "f1_50": 0.08495493321574396,
51 | "f1_75": 0.056609885218594225
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.19096833329082782,
55 | "f1_75": 0.16944258841987322
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.3543327618160558,
59 | "f1_75": 0.3354952949345133
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/results_yolov10l.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/THU-MIG/yolov10",
4 | "paper_url": "https://arxiv.org/abs/2405.14458",
5 | "model": "yolov10l",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 25839728,
15 | "run_date": "2024-09-30T05:53:38.085356+00:00"
16 | },
17 | "map50_95": 0.5193999622446913,
18 | "map50": 0.6877618065155005,
19 | "map75": 0.5671128439859524,
20 | "small_objects": {
21 | "map50_95": 0.258523955122621,
22 | "map50": 0.4048260311189716,
23 | "map75": 0.2813030440141851
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.48599001747068804,
27 | "map50": 0.6582109022500109,
28 | "map75": 0.5477617205050493
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6591621527876248,
32 | "map50": 0.7929580616060907,
33 | "map75": 0.714848309773967
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.15800699193206252,
48 | "f1_75": 0.1350550612526741,
49 | "f1_small_objects": {
50 | "f1_50": 0.08980090169265482,
51 | "f1_75": 0.06006266004557769
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.2016467076845786,
55 | "f1_75": 0.1790199800317417
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.3619305472910582,
59 | "f1_75": 0.34427398106951784
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/results_yolov10m.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/THU-MIG/yolov10",
4 | "paper_url": "https://arxiv.org/abs/2405.14458",
5 | "model": "yolov10m",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 16543024,
15 | "run_date": "2024-09-30T05:51:31.405525+00:00"
16 | },
17 | "map50_95": 0.49853164436258285,
18 | "map50": 0.6674081642568298,
19 | "map75": 0.544032338381202,
20 | "small_objects": {
21 | "map50_95": 0.2431589329852204,
22 | "map50": 0.379405694858442,
23 | "map75": 0.25825078064504225
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.4666675696906227,
27 | "map50": 0.6402606338739345,
28 | "map75": 0.5265880018968241
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6337626996738237,
32 | "map50": 0.7692663005582833,
33 | "map75": 0.6871564804347694
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.1421664959671861,
48 | "f1_75": 0.12019016660426923,
49 | "f1_small_objects": {
50 | "f1_50": 0.08146360442899019,
51 | "f1_75": 0.052993972128646594
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.17723076960368064,
55 | "f1_75": 0.1561196386587452
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.33381526775799925,
59 | "f1_75": 0.3153008880097011
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/results_yolov10n.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/THU-MIG/yolov10",
4 | "paper_url": "https://arxiv.org/abs/2405.14458",
5 | "model": "yolov10n",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 2762608,
15 | "run_date": "2024-09-30T05:49:45.354372+00:00"
16 | },
17 | "map50_95": 0.37655721169022977,
18 | "map50": 0.5260541878594017,
19 | "map75": 0.4090613902624434,
20 | "small_objects": {
21 | "map50_95": 0.12030443755349704,
22 | "map50": 0.20373576664083062,
23 | "map75": 0.1269964173339701
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.322821701919836,
27 | "map50": 0.4725700820887715,
28 | "map75": 0.35947529913199133
29 | },
30 | "large_objects": {
31 | "map50_95": 0.5222208049397794,
32 | "map50": 0.6636617755984061,
33 | "map75": 0.5711835140906704
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.09213326892206306,
48 | "f1_75": 0.07273121791160295,
49 | "f1_small_objects": {
50 | "f1_50": 0.059275792916839896,
51 | "f1_75": 0.032479320440400104
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.10615649066343963,
55 | "f1_75": 0.0860462307402727
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.192710090292798,
59 | "f1_75": 0.17697278938665642
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/results_yolov10s.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/THU-MIG/yolov10",
4 | "paper_url": "https://arxiv.org/abs/2405.14458",
5 | "model": "yolov10s",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 8096880,
15 | "run_date": "2024-09-30T05:50:36.247710+00:00"
16 | },
17 | "map50_95": 0.45376716567603814,
18 | "map50": 0.6203405115920764,
19 | "map75": 0.4948915753398186,
20 | "small_objects": {
21 | "map50_95": 0.1852792391826148,
22 | "map50": 0.2996373746510235,
23 | "map75": 0.19644748879955434
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.40760951147970853,
27 | "map50": 0.5762023873222245,
28 | "map75": 0.4569578837765637
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6016623416977711,
32 | "map50": 0.7464756776302359,
33 | "map75": 0.6561054889111075
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.11776907553160045,
48 | "f1_75": 0.09684311163630535,
49 | "f1_small_objects": {
50 | "f1_50": 0.06988920081320053,
51 | "f1_75": 0.042531717025131435
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.13966315173389962,
55 | "f1_75": 0.11911611430200084
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.2798763607662566,
59 | "f1_75": 0.26080795012111857
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/results_yolov10x.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/THU-MIG/yolov10",
4 | "paper_url": "https://arxiv.org/abs/2405.14458",
5 | "model": "yolov10x",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 31738160,
15 | "run_date": "2024-09-30T05:54:54.747611+00:00"
16 | },
17 | "map50_95": 0.5322232811173985,
18 | "map50": 0.7001348258892859,
19 | "map75": 0.5797371628199249,
20 | "small_objects": {
21 | "map50_95": 0.2725325849208779,
22 | "map50": 0.422035032168101,
23 | "map75": 0.29557686597950306
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.5005172680410123,
27 | "map50": 0.6724527341047721,
28 | "map75": 0.5629335768715251
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6688200456656187,
32 | "map50": 0.7988220751428566,
33 | "map75": 0.7207933687780973
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.15901106960883638,
48 | "f1_75": 0.13644785088234243,
49 | "f1_small_objects": {
50 | "f1_50": 0.09115302081910993,
51 | "f1_75": 0.061742712925171236
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.20669043084126867,
55 | "f1_75": 0.18433524709887086
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.3660040115131003,
59 | "f1_75": 0.34837677460770816
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov10/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import sys
3 | from pathlib import Path
4 | from typing import List, Optional
5 |
6 | import supervision as sv
7 | from supervision.metrics import F1Score, MeanAveragePrecision
8 | from tqdm import tqdm
9 | from ultralytics import YOLOv10
10 |
11 | sys.path.append(str(Path(__file__).resolve().parent.parent))
12 | from utils import (
13 | load_detections_dataset,
14 | result_json_already_exists,
15 | write_result_json,
16 | )
17 |
18 | MODEL_IDS = ["yolov10n", "yolov10s", "yolov10m", "yolov10b", "yolov10l", "yolov10x"]
19 | DATASET_DIR = "../../../data/coco-val-2017"
20 | LICENSE = "APGL-3.0"
21 |
22 | GIT_REPO_URL = "https://github.com/THU-MIG/yolov10"
23 | PAPER_URL = "https://arxiv.org/abs/2405.14458"
24 |
25 | RUN_PARAMETERS = dict(imgsz=640, iou=0.6, max_det=300, conf=0.001, verbose=False)
26 |
27 |
28 | def run_on_image(model, image) -> sv.Detections:
29 | result = model(image, **RUN_PARAMETERS)[0]
30 | detections = sv.Detections.from_ultralytics(result)
31 | return detections
32 |
33 |
34 | def run(
35 | model_ids: List[str],
36 | skip_if_result_exists=False,
37 | dataset: Optional[sv.DetectionDataset] = None,
38 | ) -> None:
39 | """
40 | Run the evaluation for the given models and dataset.
41 |
42 | Arguments:
43 | model_ids: List of model ids to evaluate. Evaluate all models if None.
44 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
45 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
46 | """ # noqa: E501 // docs
47 | if not model_ids:
48 | model_ids = MODEL_IDS
49 |
50 | for model_id in model_ids:
51 | print(f"\nEvaluating model: {model_id}")
52 |
53 | if skip_if_result_exists and result_json_already_exists(model_id):
54 | print(f"Skipping {model_id}. Result already exists!")
55 | continue
56 |
57 | if dataset is None:
58 | dataset = load_detections_dataset(DATASET_DIR)
59 |
60 | model = YOLOv10.from_pretrained(f"jameslahm/{model_id}")
61 |
62 | predictions = []
63 | targets = []
64 | print("Evaluating...")
65 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
66 | # Run model
67 | detections = run_on_image(model, image)
68 | predictions.append(detections)
69 | targets.append(target_detections)
70 |
71 | mAP_metric = MeanAveragePrecision()
72 | f1_score = F1Score()
73 | f1_score_result = f1_score.update(predictions, targets).compute()
74 | mAP_result = mAP_metric.update(predictions, targets).compute()
75 |
76 | write_result_json(
77 | model_id=model_id,
78 | model_name=model_id,
79 | model_git_url=GIT_REPO_URL,
80 | paper_url=PAPER_URL,
81 | model=model,
82 | mAP_result=mAP_result,
83 | f1_score_result=f1_score_result,
84 | license_name=LICENSE,
85 | run_parameters=RUN_PARAMETERS,
86 | )
87 |
88 |
89 | if __name__ == "__main__":
90 | parser = argparse.ArgumentParser()
91 | parser.add_argument(
92 | "model_ids",
93 | nargs="*",
94 | help="Model ids to evaluate. If not provided, evaluate all models.",
95 | )
96 | parser.add_argument(
97 | "--skip_if_result_exists",
98 | action="store_true",
99 | help="If specified, skip the evaluation if the result json already exists.",
100 | )
101 | args = parser.parse_args()
102 |
103 | run(args.model_ids, args.skip_if_result_exists)
104 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/yolov11/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/yolov11/requirements.txt:
--------------------------------------------------------------------------------
1 | ultralytics>=8.3.0,<=8.3.40
2 | supervision @ git+https://github.com/roboflow/supervision.git@develop
3 | tqdm
4 | dill
5 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/results_yolo11l.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "",
5 | "model": "yolo11l",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 25340992,
15 | "run_date": "2024-09-30T04:54:34.237832+00:00"
16 | },
17 | "map50_95": 0.5147562882873221,
18 | "map50": 0.6839904587355925,
19 | "map75": 0.5571299310290306,
20 | "small_objects": {
21 | "map50_95": 0.25158201044278067,
22 | "map50": 0.39475239296356945,
23 | "map75": 0.26968002362096327
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.48774699362419505,
27 | "map50": 0.6632413865946212,
28 | "map75": 0.5452545686890365
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6470517657071067,
32 | "map50": 0.7779600640444341,
33 | "map75": 0.6957210072646699
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.20440283673334628,
48 | "f1_75": 0.16800061165304447,
49 | "f1_small_objects": {
50 | "f1_50": 0.12838758860437663,
51 | "f1_75": 0.08051824127639894
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.22513181615256014,
55 | "f1_75": 0.1928786307876677
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.43061349820528094,
59 | "f1_75": 0.39734178631268013
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/results_yolo11m.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "",
5 | "model": "yolo11m",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 20091712,
15 | "run_date": "2024-09-30T04:53:30.195785+00:00"
16 | },
17 | "map50_95": 0.4985730583048321,
18 | "map50": 0.6699705830100839,
19 | "map75": 0.5376791695127155,
20 | "small_objects": {
21 | "map50_95": 0.22805224522679568,
22 | "map50": 0.3723304589552568,
23 | "map75": 0.23841838347436814
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.4683352679615954,
27 | "map50": 0.6442044962270301,
28 | "map75": 0.5241591558978002
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6293219248438574,
32 | "map50": 0.7694770600502057,
33 | "map75": 0.6737696162239775
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.18854131028848034,
48 | "f1_75": 0.15301036273016522,
49 | "f1_small_objects": {
50 | "f1_50": 0.12029057828299773,
51 | "f1_75": 0.07346256983574839
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.20422795965315566,
55 | "f1_75": 0.17242144004338114
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.3953382503953057,
59 | "f1_75": 0.3615294340041969
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/results_yolo11n.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "",
5 | "model": "yolo11n",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 2616248,
15 | "run_date": "2024-09-30T04:51:44.895856+00:00"
16 | },
17 | "map50_95": 0.38101471012875715,
18 | "map50": 0.5420689478525277,
19 | "map75": 0.40893541969043523,
20 | "small_objects": {
21 | "map50_95": 0.12209245593023066,
22 | "map50": 0.2121499182073053,
23 | "map75": 0.12249037339854629
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.32858715819686646,
27 | "map50": 0.49201421385370664,
28 | "map75": 0.362268092057365
29 | },
30 | "large_objects": {
31 | "map50_95": 0.5251545363339247,
32 | "map50": 0.6749480759703437,
33 | "map75": 0.5702689924061763
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.11650874695992934,
48 | "f1_75": 0.0858856385108987,
49 | "f1_small_objects": {
50 | "f1_50": 0.07342935358159985,
51 | "f1_75": 0.03511505803273295
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.11982411530363851,
55 | "f1_75": 0.08810452711528946
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.26345516192625706,
59 | "f1_75": 0.23101071713240298
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/results_yolo11s.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "",
5 | "model": "yolo11s",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 9443760,
15 | "run_date": "2024-09-30T04:52:35.052011+00:00"
16 | },
17 | "map50_95": 0.4493644542477363,
18 | "map50": 0.6212175850519643,
19 | "map75": 0.48056095776349583,
20 | "small_objects": {
21 | "map50_95": 0.19931556022185712,
22 | "map50": 0.3237633630968639,
23 | "map75": 0.20969857004263245
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.4080036543363817,
27 | "map50": 0.5842649531639507,
28 | "map75": 0.4468923289201651
29 | },
30 | "large_objects": {
31 | "map50_95": 0.587747111956689,
32 | "map50": 0.7355971142175783,
33 | "map75": 0.6310575939758882
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.148787590075445,
48 | "f1_75": 0.11597982565981851,
49 | "f1_small_objects": {
50 | "f1_50": 0.09206957134807178,
51 | "f1_75": 0.05075351678992609
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.15792785643269786,
55 | "f1_75": 0.1253488318944471
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.33876332227287,
59 | "f1_75": 0.30548670377495346
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/results_yolo11x.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "",
5 | "model": "yolo11x",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 56919424,
15 | "run_date": "2024-09-30T04:56:12.730134+00:00"
16 | },
17 | "map50_95": 0.5269240473065516,
18 | "map50": 0.6988729632401882,
19 | "map75": 0.5697211519482316,
20 | "small_objects": {
21 | "map50_95": 0.26812166305097557,
22 | "map50": 0.4174215417524291,
23 | "map75": 0.29117537238356844
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.49422186775024707,
27 | "map50": 0.6677738876730264,
28 | "map75": 0.5537819405638407
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6509716249782073,
32 | "map50": 0.7860645287527053,
33 | "map75": 0.695369307492311
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.2288031947145225,
48 | "f1_75": 0.19005454140778252,
49 | "f1_small_objects": {
50 | "f1_50": 0.14216929415261406,
51 | "f1_75": 0.09335402326177307
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.25589548434833154,
55 | "f1_75": 0.22136433605226533
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.4725176790746789,
59 | "f1_75": 0.43621725714227966
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov11/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import sys
3 | from pathlib import Path
4 | from typing import List, Optional
5 |
6 | import supervision as sv
7 | from supervision.metrics import F1Score, MeanAveragePrecision
8 | from tqdm import tqdm
9 | from ultralytics import YOLO
10 |
11 | sys.path.append(str(Path(__file__).resolve().parent.parent))
12 |
13 | from configs import DATASET_DIR
14 | from utils import (
15 | load_detections_dataset,
16 | result_json_already_exists,
17 | write_result_json,
18 | )
19 |
20 | MODEL_IDS = ["yolo11n", "yolo11s", "yolo11m", "yolo11l", "yolo11x"]
21 | LICENSE = "APGL-3.0"
22 | RUN_PARAMETERS = dict(
23 | imgsz=640,
24 | iou=0.6,
25 | max_det=300,
26 | conf=0.001,
27 | verbose=False,
28 | )
29 | GIT_REPO_URL = "https://github.com/ultralytics/ultralytics"
30 | PAPER_URL = ""
31 |
32 |
33 | def run_on_image(model, image) -> sv.Detections:
34 | result = model(image, **RUN_PARAMETERS)[0]
35 | detections = sv.Detections.from_ultralytics(result)
36 | return detections
37 |
38 |
39 | def run(
40 | model_ids: List[str],
41 | skip_if_result_exists=False,
42 | dataset: Optional[sv.DetectionDataset] = None,
43 | ) -> None:
44 | """
45 | Run the evaluation for the given models and dataset.
46 |
47 | Arguments:
48 | model_ids: List of model ids to evaluate. Evaluate all models if None.
49 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
50 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
51 | """ # noqa: E501 // docs
52 | if not model_ids:
53 | model_ids = MODEL_IDS
54 |
55 | for model_id in model_ids:
56 | print(f"\nEvaluating model: {model_id}")
57 |
58 | if skip_if_result_exists and result_json_already_exists(model_id):
59 | print(f"Skipping {model_id}. Result already exists!")
60 | continue
61 |
62 | if dataset is None:
63 | dataset = load_detections_dataset(DATASET_DIR)
64 |
65 | model = YOLO(model_id)
66 |
67 | predictions = []
68 | targets = []
69 | print("Evaluating...")
70 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
71 | # Run model
72 | detections = run_on_image(model, image)
73 | predictions.append(detections)
74 | targets.append(target_detections)
75 |
76 | mAP_metric = MeanAveragePrecision()
77 | f1_score = F1Score()
78 |
79 | f1_score_result = f1_score.update(predictions, targets).compute()
80 | mAP_result = mAP_metric.update(predictions, targets).compute()
81 |
82 | write_result_json(
83 | model_id=model_id,
84 | model_name=model_id,
85 | model_git_url=GIT_REPO_URL,
86 | paper_url=PAPER_URL,
87 | model=model,
88 | mAP_result=mAP_result,
89 | f1_score_result=f1_score_result,
90 | license_name=LICENSE,
91 | run_parameters=RUN_PARAMETERS,
92 | )
93 |
94 |
95 | if __name__ == "__main__":
96 | parser = argparse.ArgumentParser()
97 | parser.add_argument(
98 | "model_ids",
99 | nargs="*",
100 | help="Model ids to evaluate. If not provided, evaluate all models.",
101 | )
102 | parser.add_argument(
103 | "--skip_if_result_exists",
104 | action="store_true",
105 | help="If specified, skip the evaluation if the result json already exists.",
106 | )
107 | args = parser.parse_args()
108 |
109 | run(args.model_ids, args.skip_if_result_exists)
110 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/yolov12/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/yolov12/requirements.txt:
--------------------------------------------------------------------------------
1 | ultralytics @ git+https://github.com/sunsmarterjie/yolov12.git@main
2 | supervision @ git+https://github.com/roboflow/supervision.git@develop
3 | tqdm
4 | flash_attn
5 | timm
6 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/results_yolov12l.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/sunsmarterjie/yolov12",
4 | "paper_url": "https://arxiv.org/abs/2502.12524",
5 | "model": "yolov12l",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 26400752,
15 | "run_date": "2025-02-19T16:41:18.697136+00:00"
16 | },
17 | "map50_95": 0.5140386462641737,
18 | "map50": 0.6835472858318616,
19 | "map75": 0.5560183101907337,
20 | "small_objects": {
21 | "map50_95": 0.23956164656482049,
22 | "map50": 0.3822461519277125,
23 | "map75": 0.25619018530844434
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.48147184869355797,
27 | "map50": 0.6553303495204026,
28 | "map75": 0.5385348590979039
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6379708732125071,
32 | "map50": 0.7715091682416584,
33 | "map75": 0.6838877611982492
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.21469812716696077,
48 | "f1_75": 0.17665828989388385,
49 | "f1_small_objects": {
50 | "f1_50": 0.131228682059136,
51 | "f1_75": 0.08224892848550594
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.2334702354345676,
55 | "f1_75": 0.20025833367498136
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.473558418895958,
59 | "f1_75": 0.43722698468443943
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/results_yolov12m.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/sunsmarterjie/yolov12",
4 | "paper_url": "https://arxiv.org/abs/2502.12524",
5 | "model": "yolov12m",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 20166592,
15 | "run_date": "2025-02-19T16:39:32.315812+00:00"
16 | },
17 | "map50_95": 0.5024151745566658,
18 | "map50": 0.6729674787838364,
19 | "map75": 0.5411712447504051,
20 | "small_objects": {
21 | "map50_95": 0.23771385392176372,
22 | "map50": 0.3745875473767375,
23 | "map75": 0.2526241522154284
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.470957205786951,
27 | "map50": 0.647892103044635,
28 | "map75": 0.5234903734335027
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6352580425871278,
32 | "map50": 0.7732552389324706,
33 | "map75": 0.6846297649534195
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.20410545516278208,
48 | "f1_75": 0.16639124100879502,
49 | "f1_small_objects": {
50 | "f1_50": 0.1265855995078801,
51 | "f1_75": 0.0785707483184028
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.21718437298952575,
55 | "f1_75": 0.182720555674183
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.4466717255381648,
59 | "f1_75": 0.41007289545951314
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/results_yolov12n.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/sunsmarterjie/yolov12",
4 | "paper_url": "https://arxiv.org/abs/2502.12524",
5 | "model": "yolov12n",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 2590824,
15 | "run_date": "2025-02-19T16:37:09.075554+00:00"
16 | },
17 | "map50_95": 0.3877159586864732,
18 | "map50": 0.5469040018039328,
19 | "map75": 0.413670471361677,
20 | "small_objects": {
21 | "map50_95": 0.11829698944259229,
22 | "map50": 0.20705537607869406,
23 | "map75": 0.1267675833162641
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.33745698777837524,
27 | "map50": 0.5032719598066004,
28 | "map75": 0.36669296690341435
29 | },
30 | "large_objects": {
31 | "map50_95": 0.5334164629555207,
32 | "map50": 0.6827482690098516,
33 | "map75": 0.5731754055269189
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.12676048844705637,
48 | "f1_75": 0.09444949511021651,
49 | "f1_small_objects": {
50 | "f1_50": 0.0758052313432873,
51 | "f1_75": 0.036825119256434086
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.1288292768173158,
55 | "f1_75": 0.09600451084618905
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.2992891077526277,
59 | "f1_75": 0.26438966588649454
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/results_yolov12s.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/sunsmarterjie/yolov12",
4 | "paper_url": "https://arxiv.org/abs/2502.12524",
5 | "model": "yolov12s",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 9261840,
15 | "run_date": "2025-02-19T16:38:12.718959+00:00"
16 | },
17 | "map50_95": 0.45693791744216783,
18 | "map50": 0.625105039417675,
19 | "map75": 0.4901687610051952,
20 | "small_objects": {
21 | "map50_95": 0.18074420578912176,
22 | "map50": 0.2976391305720489,
23 | "map75": 0.18945271054269097
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.4162154779943921,
27 | "map50": 0.5941075118162098,
28 | "map75": 0.4570060051526254
29 | },
30 | "large_objects": {
31 | "map50_95": 0.5973586921812142,
32 | "map50": 0.7404383120592584,
33 | "map75": 0.6474110714091117
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.16900212076072182,
48 | "f1_75": 0.13306621893981532,
49 | "f1_small_objects": {
50 | "f1_50": 0.09964809290924767,
51 | "f1_75": 0.05521867370721874
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.17818454039201131,
55 | "f1_75": 0.14331248103748132
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.3993554965618543,
59 | "f1_75": 0.3632304913439791
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/results_yolov12x.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/sunsmarterjie/yolov12",
4 | "paper_url": "https://arxiv.org/abs/2502.12524",
5 | "model": "yolov12x",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 59135744,
15 | "run_date": "2025-02-19T16:44:06.185832+00:00"
16 | },
17 | "map50_95": 0.5271687961223182,
18 | "map50": 0.694594330866477,
19 | "map75": 0.5718752331278235,
20 | "small_objects": {
21 | "map50_95": 0.26662368901288247,
22 | "map50": 0.4083315780395303,
23 | "map75": 0.28726502359950207
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.49810265810612453,
27 | "map50": 0.671157716616775,
28 | "map75": 0.5554030839991746
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6500511182392474,
32 | "map50": 0.779836135345746,
33 | "map75": 0.6994127457039145
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.2389024021820415,
48 | "f1_75": 0.19947636375278777,
49 | "f1_small_objects": {
50 | "f1_50": 0.14861077823157104,
51 | "f1_75": 0.09774784580190986
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.26173244957709363,
55 | "f1_75": 0.22673401812162142
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.5041950424432747,
59 | "f1_75": 0.4687472087493045
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov12/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import sys
3 | from pathlib import Path
4 | from typing import List, Optional
5 |
6 | import supervision as sv
7 | from supervision.metrics import F1Score, MeanAveragePrecision
8 | from tqdm import tqdm
9 | from ultralytics import YOLO
10 |
11 | sys.path.append(str(Path(__file__).resolve().parent.parent))
12 |
13 | from configs import DATASET_DIR
14 | from utils import (
15 | download_file,
16 | load_detections_dataset,
17 | result_json_already_exists,
18 | write_result_json,
19 | )
20 |
21 | MODEL_URLS: dict[str, str] = {
22 | "yolov12n.pt": "https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12n.pt",
23 | "yolov12s.pt": "https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12s.pt",
24 | "yolov12m.pt": "https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12m.pt",
25 | "yolov12l.pt": "https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12l.pt",
26 | "yolov12x.pt": "https://github.com/sunsmarterjie/yolov12/releases/download/v1.0/yolov12x.pt",
27 | }
28 |
29 |
30 | LICENSE = "APGL-3.0"
31 | RUN_PARAMETERS = dict(
32 | imgsz=640,
33 | iou=0.6,
34 | max_det=300,
35 | conf=0.001,
36 | verbose=False,
37 | )
38 | GIT_REPO_URL = "https://github.com/sunsmarterjie/yolov12"
39 | PAPER_URL = "https://arxiv.org/abs/2502.12524"
40 |
41 |
42 | def run_on_image(model, image) -> sv.Detections:
43 | result = model(image, **RUN_PARAMETERS)[0]
44 | detections = sv.Detections.from_ultralytics(result)
45 | return detections
46 |
47 |
48 | def run(
49 | model_ids: List[str],
50 | skip_if_result_exists=False,
51 | dataset: Optional[sv.DetectionDataset] = None,
52 | ) -> None:
53 | """
54 | Run the evaluation for the given models and dataset.
55 |
56 | Arguments:
57 | model_ids: List of model ids to evaluate. Evaluate all models if None.
58 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
59 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
60 | """ # noqa: E501 // docs
61 | if not model_ids:
62 | model_ids = MODEL_URLS.keys()
63 |
64 | for model_id in model_ids:
65 | print(f"\nEvaluating model: {model_id}")
66 |
67 | print("Downloading model...")
68 | if not Path(model_id).exists():
69 | download_file(MODEL_URLS[model_id], model_id)
70 | print(f"Model {model_id} downloaded!")
71 | else:
72 | print(f"Model {model_id} already exists!")
73 |
74 | if skip_if_result_exists and result_json_already_exists(model_id):
75 | print(f"Skipping {model_id}. Result already exists!")
76 | continue
77 |
78 | if dataset is None:
79 | dataset = load_detections_dataset(DATASET_DIR)
80 |
81 | model = YOLO(model_id)
82 |
83 | predictions = []
84 | targets = []
85 | print("Evaluating...")
86 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
87 | # Run model
88 | detections = run_on_image(model, image)
89 | predictions.append(detections)
90 | targets.append(target_detections)
91 |
92 | mAP_metric = MeanAveragePrecision()
93 | f1_score = F1Score()
94 |
95 | f1_score_result = f1_score.update(predictions, targets).compute()
96 | mAP_result = mAP_metric.update(predictions, targets).compute()
97 |
98 | write_result_json(
99 | model_id=model_id,
100 | model_name=model_id,
101 | model=model,
102 | mAP_result=mAP_result,
103 | f1_score_result=f1_score_result,
104 | license_name=LICENSE,
105 | run_parameters=RUN_PARAMETERS,
106 | )
107 |
108 |
109 | if __name__ == "__main__":
110 | parser = argparse.ArgumentParser()
111 | parser.add_argument(
112 | "model_ids",
113 | nargs="*",
114 | help="Model ids to evaluate. If not provided, evaluate all models.",
115 | )
116 | parser.add_argument(
117 | "--skip_if_result_exists",
118 | action="store_true",
119 | help="If specified, skip the evaluation if the result json already exists.",
120 | )
121 | args = parser.parse_args()
122 |
123 | run(args.model_ids, args.skip_if_result_exists)
124 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/yolov8/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/yolov8/requirements.txt:
--------------------------------------------------------------------------------
1 | ultralytics>=8.1.47,<=8.3.40
2 | supervision @ git+https://github.com/roboflow/supervision.git@develop
3 | tqdm
4 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/results_yolov8l.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "",
5 | "model": "yolov8l",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 43668288,
15 | "run_date": "2024-09-30T06:35:15.316296+00:00"
16 | },
17 | "map50_95": 0.511340365673001,
18 | "map50": 0.6818834865949015,
19 | "map75": 0.5532324863098792,
20 | "small_objects": {
21 | "map50_95": 0.25420034505801864,
22 | "map50": 0.39422254063904527,
23 | "map75": 0.2741578959929114
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.47948036802038513,
27 | "map50": 0.6528224282542436,
28 | "map75": 0.540699897659841
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6474113378937942,
32 | "map50": 0.7814510210320753,
33 | "map75": 0.6937697480248785
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.19692150370964395,
48 | "f1_75": 0.16205969612370527,
49 | "f1_small_objects": {
50 | "f1_50": 0.12147831558000848,
51 | "f1_75": 0.07690569555394208
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.2276785910382567,
55 | "f1_75": 0.1948046571431011
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.42244264160769096,
59 | "f1_75": 0.3904063830680425
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/results_yolov8m.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "https://github.com/ultralytics/ultralytics/issues/204",
5 | "model": "yolov8m",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 25886080,
15 | "run_date": "2024-09-30T06:34:13.006465+00:00"
16 | },
17 | "map50_95": 0.4851253204925955,
18 | "map50": 0.6557256503673925,
19 | "map75": 0.5236159893917905,
20 | "small_objects": {
21 | "map50_95": 0.21859640196504554,
22 | "map50": 0.3504071137413657,
23 | "map75": 0.23282928376835133
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.4506484408698307,
27 | "map50": 0.6262982397766818,
28 | "map75": 0.5049348227613952
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6211310304595176,
32 | "map50": 0.7621071130332328,
33 | "map75": 0.666788671248503
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.16300311104752332,
48 | "f1_75": 0.1314624094039988,
49 | "f1_small_objects": {
50 | "f1_50": 0.10155915188690072,
51 | "f1_75": 0.06138212056778542
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.18639424894701012,
55 | "f1_75": 0.15528175138232014
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.37174894906352224,
59 | "f1_75": 0.3404154849364739
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/results_yolov8n.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "https://github.com/ultralytics/ultralytics/issues/204",
5 | "model": "yolov8n",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 3151904,
15 | "run_date": "2024-09-30T06:32:40.173555+00:00"
16 | },
17 | "map50_95": 0.3611303770616479,
18 | "map50": 0.5177666014570935,
19 | "map75": 0.388387126380927,
20 | "small_objects": {
21 | "map50_95": 0.11150565665551788,
22 | "map50": 0.19632264884527492,
23 | "map75": 0.10985971360328843
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.3105929336216655,
27 | "map50": 0.46338643095145393,
28 | "map75": 0.33699521495942614
29 | },
30 | "large_objects": {
31 | "map50_95": 0.4957375632083722,
32 | "map50": 0.6444844850243913,
33 | "map75": 0.5454443748020914
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.10698233161314832,
48 | "f1_75": 0.07878458939906306,
49 | "f1_small_objects": {
50 | "f1_50": 0.06907964501933606,
51 | "f1_75": 0.032859895059074606
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.11272009898607982,
55 | "f1_75": 0.08271332403179087
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.23796917359688716,
59 | "f1_75": 0.20962535492005602
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/results_yolov8s.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "https://github.com/ultralytics/ultralytics/issues/204",
5 | "model": "yolov8s",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 11156544,
15 | "run_date": "2024-09-30T06:33:22.535125+00:00"
16 | },
17 | "map50_95": 0.4349729425921134,
18 | "map50": 0.6035183104744979,
19 | "map75": 0.4662358665420669,
20 | "small_objects": {
21 | "map50_95": 0.17416252932581736,
22 | "map50": 0.28329632805077193,
23 | "map75": 0.18730061589658759
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.3927473756025548,
27 | "map50": 0.5619761425564425,
28 | "map75": 0.4321562895025597
29 | },
30 | "large_objects": {
31 | "map50_95": 0.5744762967442364,
32 | "map50": 0.7237009599139812,
33 | "map75": 0.619079570092548
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.13518388046628524,
48 | "f1_75": 0.10446977559521267,
49 | "f1_small_objects": {
50 | "f1_50": 0.08452111230697007,
51 | "f1_75": 0.0455729041484357
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.15182428390716582,
55 | "f1_75": 0.12109522673285078
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.3156688849946123,
59 | "f1_75": 0.28307972310831314
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/results_yolov8x.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/ultralytics/ultralytics",
4 | "paper_url": "https://github.com/ultralytics/ultralytics/issues/204",
5 | "model": "yolov8x",
6 | "license": "APGL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "iou": 0.6,
10 | "max_det": 300,
11 | "conf": 0.001,
12 | "verbose": false
13 | },
14 | "param_count": 68200608,
15 | "run_date": "2024-09-30T06:36:39.137424+00:00"
16 | },
17 | "map50_95": 0.5224782800437047,
18 | "map50": 0.6928732246889833,
19 | "map75": 0.5658364945361546,
20 | "small_objects": {
21 | "map50_95": 0.2559641188116497,
22 | "map50": 0.3965652092449827,
23 | "map75": 0.2740472310620755
24 | },
25 | "medium_objects": {
26 | "map50_95": 0.48798121050508747,
27 | "map50": 0.6622798133116985,
28 | "map75": 0.5447480150956083
29 | },
30 | "large_objects": {
31 | "map50_95": 0.6570871226982951,
32 | "map50": 0.7926572883372152,
33 | "map75": 0.7068556092098695
34 | },
35 | "iou_thresholds": [
36 | 0.5,
37 | 0.55,
38 | 0.6,
39 | 0.65,
40 | 0.7,
41 | 0.75,
42 | 0.8,
43 | 0.85,
44 | 0.8999999999999999,
45 | 0.95
46 | ],
47 | "f1_50": 0.2068501631280764,
48 | "f1_75": 0.1711587584739747,
49 | "f1_small_objects": {
50 | "f1_50": 0.12517994179230246,
51 | "f1_75": 0.08140991931569841
52 | },
53 | "f1_medium_objects": {
54 | "f1_50": 0.24625819828403683,
55 | "f1_75": 0.21140193230296273
56 | },
57 | "f1_large_objects": {
58 | "f1_50": 0.4475472986541321,
59 | "f1_75": 0.41368816678288806
60 | },
61 | "f1_iou_thresholds": [
62 | 0.5,
63 | 0.55,
64 | 0.6,
65 | 0.65,
66 | 0.7,
67 | 0.75,
68 | 0.8,
69 | 0.85,
70 | 0.8999999999999999,
71 | 0.95
72 | ]
73 | }
74 |
--------------------------------------------------------------------------------
/models/object_detection/yolov8/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import sys
3 | from pathlib import Path
4 | from typing import List, Optional
5 |
6 | import supervision as sv
7 | from supervision.metrics import F1Score, MeanAveragePrecision
8 | from tqdm import tqdm
9 | from ultralytics import YOLO
10 |
11 | sys.path.append(str(Path(__file__).resolve().parent.parent))
12 |
13 | from configs import DATASET_DIR
14 | from utils import (
15 | load_detections_dataset,
16 | result_json_already_exists,
17 | write_result_json,
18 | )
19 |
20 | MODEL_IDS = ["yolov8n", "yolov8s", "yolov8m", "yolov8l", "yolov8x"]
21 | LICENSE = "APGL-3.0"
22 | RUN_PARAMETERS = dict(
23 | imgsz=640,
24 | iou=0.6,
25 | max_det=300,
26 | conf=0.001,
27 | verbose=False,
28 | )
29 | GIT_REPO_URL = "https://github.com/ultralytics/ultralytics"
30 | PAPER_URL = ""
31 |
32 |
33 | def run_on_image(model, image) -> sv.Detections:
34 | result = model(image, **RUN_PARAMETERS)[0]
35 | detections = sv.Detections.from_ultralytics(result)
36 | return detections
37 |
38 |
39 | def run(
40 | model_ids: List[str],
41 | skip_if_result_exists=False,
42 | dataset: Optional[sv.DetectionDataset] = None,
43 | ) -> None:
44 | """
45 | Run the evaluation for the given models and dataset.
46 |
47 | Arguments:
48 | model_ids: List of model ids to evaluate. Evaluate all models if None.
49 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
50 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
51 | """ # noqa: E501 // docs
52 | if not model_ids:
53 | model_ids = MODEL_IDS
54 |
55 | for model_id in model_ids:
56 | print(f"\nEvaluating model: {model_id}")
57 |
58 | if skip_if_result_exists and result_json_already_exists(model_id):
59 | print(f"Skipping {model_id}. Result already exists!")
60 | continue
61 |
62 | if dataset is None:
63 | dataset = load_detections_dataset(DATASET_DIR)
64 |
65 | model = YOLO(model_id)
66 |
67 | predictions = []
68 | targets = []
69 | print("Evaluating...")
70 | for _, image, target_detections in tqdm(dataset, total=len(dataset)):
71 | # Run model
72 | detections = run_on_image(model, image)
73 | predictions.append(detections)
74 | targets.append(target_detections)
75 |
76 | mAP_metric = MeanAveragePrecision()
77 | f1_score = F1Score()
78 |
79 | f1_score_result = f1_score.update(predictions, targets).compute()
80 | mAP_result = mAP_metric.update(predictions, targets).compute()
81 |
82 | write_result_json(
83 | model_id=model_id,
84 | model_name=model_id,
85 | model_git_url=GIT_REPO_URL,
86 | paper_url=PAPER_URL,
87 | model=model,
88 | mAP_result=mAP_result,
89 | f1_score_result=f1_score_result,
90 | license_name=LICENSE,
91 | run_parameters=RUN_PARAMETERS,
92 | )
93 |
94 |
95 | if __name__ == "__main__":
96 | parser = argparse.ArgumentParser()
97 | parser.add_argument(
98 | "model_ids",
99 | nargs="*",
100 | help="Model ids to evaluate. If not provided, evaluate all models.",
101 | )
102 | parser.add_argument(
103 | "--skip_if_result_exists",
104 | action="store_true",
105 | help="If specified, skip the evaluation if the result json already exists.",
106 | )
107 | args = parser.parse_args()
108 |
109 | run(args.model_ids, args.skip_if_result_exists)
110 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/models/object_detection/yolov9/__init__.py
--------------------------------------------------------------------------------
/models/object_detection/yolov9/requirements.txt:
--------------------------------------------------------------------------------
1 | ultralytics>=8.2.86,<=8.3.40
2 | supervision @ git+https://github.com/roboflow/supervision.git@develop
3 |
4 | # From YOLOv9 repo
5 | gitpython
6 | ipython
7 | matplotlib>=3.2.2
8 | numpy>=1.18.5
9 | opencv-python>=4.1.1
10 | Pillow>=7.1.2
11 | psutil
12 | PyYAML>=5.3.1
13 | requests>=2.23.0
14 | scipy>=1.4.1
15 | thop>=0.1.1
16 | torch>=1.7.0
17 | torchvision>=0.8.1
18 | tqdm>=4.64.0
19 | tensorboard>=2.4.1
20 | pandas>=1.1.4
21 | seaborn>=0.11.0
22 | albumentations>=1.0.3
23 | pycocotools>=2.0
24 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/results_yolov9c.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/WongKinYiu/yolov9",
4 | "paper_url": "https://arxiv.org/abs/2402.13616",
5 | "model": "yolov9c",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 25590912,
12 | "run_date": "2024-09-30T06:44:05.580485+00:00"
13 | },
14 | "map50_95": 0.45357083970228657,
15 | "map50": 0.5944171124449461,
16 | "map75": 0.49515796619481167,
17 | "small_objects": {
18 | "map50_95": 0.1857469371502019,
19 | "map50": 0.2776940360432089,
20 | "map75": 0.20440376881609798
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4201132264249571,
24 | "map50": 0.5679919743110518,
25 | "map75": 0.4775991770013032
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5959593446394081,
29 | "map50": 0.7155744296586345,
30 | "map75": 0.6428719140261837
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.681658857023012,
45 | "f1_75": 0.5780711943562433,
46 | "f1_small_objects": {
47 | "f1_50": 0.4502321854981908,
48 | "f1_75": 0.323811810701791
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.6721919523877061,
52 | "f1_75": 0.5824011511590629
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.8058788418289405,
56 | "f1_75": 0.7386821073611137
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/results_yolov9e.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/WongKinYiu/yolov9",
4 | "paper_url": "https://arxiv.org/abs/2402.13616",
5 | "model": "yolov9e",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 58206592,
12 | "run_date": "2024-09-30T06:46:13.739831+00:00"
13 | },
14 | "map50_95": 0.48287388336143744,
15 | "map50": 0.6233720168352108,
16 | "map75": 0.5261423814037911,
17 | "small_objects": {
18 | "map50_95": 0.21191397464113576,
19 | "map50": 0.31618641396537245,
20 | "map75": 0.23282833454725174
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.4442516837763134,
24 | "map50": 0.5875706829492301,
25 | "map75": 0.4998557774916305
26 | },
27 | "large_objects": {
28 | "map50_95": 0.6245324679283782,
29 | "map50": 0.7440353808895063,
30 | "map75": 0.6656425638071635
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.7020017644311185,
45 | "f1_75": 0.6038844939278739,
46 | "f1_small_objects": {
47 | "f1_50": 0.4911775047169899,
48 | "f1_75": 0.3636445488338881
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.6951523914978337,
52 | "f1_75": 0.611937876518263
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.8162352015670431,
56 | "f1_75": 0.7548819414531337
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/results_yolov9m.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/WongKinYiu/yolov9",
4 | "paper_url": "https://arxiv.org/abs/2402.13616",
5 | "model": "yolov9m",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 20216160,
12 | "run_date": "2024-09-30T06:42:39.183592+00:00"
13 | },
14 | "map50_95": 0.4451839478774605,
15 | "map50": 0.5831185985538379,
16 | "map75": 0.4853667242998501,
17 | "small_objects": {
18 | "map50_95": 0.17538893236879358,
19 | "map50": 0.27564828444173095,
20 | "map75": 0.1922635646911416
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.40636906130888556,
24 | "map50": 0.5473189771158571,
25 | "map75": 0.46307537006547655
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5858913031997274,
29 | "map50": 0.7053053109513935,
30 | "map75": 0.6291372196493704
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.6720582894680438,
45 | "f1_75": 0.5664008053153977,
46 | "f1_small_objects": {
47 | "f1_50": 0.439578995042141,
48 | "f1_75": 0.3056864975785987
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.6649196158755413,
52 | "f1_75": 0.5762167030476275
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.7968064704598246,
56 | "f1_75": 0.7291444396300596
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/results_yolov9s.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/WongKinYiu/yolov9",
4 | "paper_url": "https://arxiv.org/abs/2402.13616",
5 | "model": "yolov9s",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 7318368,
12 | "run_date": "2024-09-30T06:41:11.090139+00:00"
13 | },
14 | "map50_95": 0.3998856779225525,
15 | "map50": 0.5303875101287499,
16 | "map75": 0.4343165002181449,
17 | "small_objects": {
18 | "map50_95": 0.12065859464546518,
19 | "map50": 0.18992841451893144,
20 | "map75": 0.13484037617624983
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.35134266256921565,
24 | "map50": 0.48489993319011715,
25 | "map75": 0.3968401235789068
26 | },
27 | "large_objects": {
28 | "map50_95": 0.5541534241028745,
29 | "map50": 0.67454222811767,
30 | "map75": 0.5989331963085347
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.6406350740906483,
45 | "f1_75": 0.5359112507399519,
46 | "f1_small_objects": {
47 | "f1_50": 0.37910324781370836,
48 | "f1_75": 0.25854621335266853
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.6263347159675825,
52 | "f1_75": 0.5345376426779983
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.7809525676517489,
56 | "f1_75": 0.7091340381571999
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/results_yolov9t.json:
--------------------------------------------------------------------------------
1 | {
2 | "metadata": {
3 | "github_url": "https://github.com/WongKinYiu/yolov9",
4 | "paper_url": "https://arxiv.org/abs/2402.13616",
5 | "model": "yolov9t",
6 | "license": "GPL-3.0",
7 | "run_parameters": {
8 | "imgsz": 640,
9 | "conf": 0.001
10 | },
11 | "param_count": 2128720,
12 | "run_date": "2024-09-30T06:39:49.189748+00:00"
13 | },
14 | "map50_95": 0.3148447008544304,
15 | "map50": 0.4241138501675671,
16 | "map75": 0.34263421646966175,
17 | "small_objects": {
18 | "map50_95": 0.07120163540871129,
19 | "map50": 0.11174232205401351,
20 | "map75": 0.07893993419249334
21 | },
22 | "medium_objects": {
23 | "map50_95": 0.25545579544933383,
24 | "map50": 0.3605578414659494,
25 | "map75": 0.2889781089198915
26 | },
27 | "large_objects": {
28 | "map50_95": 0.45514864545285993,
29 | "map50": 0.5681690113767972,
30 | "map75": 0.4914181158630739
31 | },
32 | "iou_thresholds": [
33 | 0.5,
34 | 0.55,
35 | 0.6,
36 | 0.65,
37 | 0.7,
38 | 0.75,
39 | 0.8,
40 | 0.85,
41 | 0.8999999999999999,
42 | 0.95
43 | ],
44 | "f1_50": 0.5719152305573845,
45 | "f1_75": 0.4673423681283036,
46 | "f1_small_objects": {
47 | "f1_50": 0.27022405958942564,
48 | "f1_75": 0.17610263768320608
49 | },
50 | "f1_medium_objects": {
51 | "f1_50": 0.5483425123308346,
52 | "f1_75": 0.4471337425531256
53 | },
54 | "f1_large_objects": {
55 | "f1_50": 0.7342688369297583,
56 | "f1_75": 0.6520192453221381
57 | },
58 | "f1_iou_thresholds": [
59 | 0.5,
60 | 0.55,
61 | 0.6,
62 | 0.65,
63 | 0.7,
64 | 0.75,
65 | 0.8,
66 | 0.85,
67 | 0.8999999999999999,
68 | 0.95
69 | ]
70 | }
71 |
--------------------------------------------------------------------------------
/models/object_detection/yolov9/run.py:
--------------------------------------------------------------------------------
1 | import argparse
2 | import shutil
3 | import sys
4 | from pathlib import Path
5 | from typing import Dict, List, Optional
6 |
7 | import cv2
8 | import numpy as np
9 | import supervision as sv
10 | import torch
11 | from supervision.metrics import F1Score, MeanAveragePrecision
12 | from tqdm import tqdm
13 | from ultralytics import YOLO
14 |
15 | sys.path.append(str(Path(__file__).resolve().parent.parent))
16 | from utils import (
17 | download_file,
18 | load_detections_dataset,
19 | result_json_already_exists,
20 | run_shell_command,
21 | write_result_json,
22 | )
23 |
24 | MODEL_DICT = {
25 | "yolov9t": {
26 | "model_url": "https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-t-converted.pt",
27 | "model_filename": "yolov9t-converted.pt",
28 | "model_run_dir": "yolov9t-out",
29 | },
30 | "yolov9s": {
31 | "model_url": "https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-s-converted.pt",
32 | "model_filename": "yolov9s-converted.pt",
33 | "model_run_dir": "yolov9s-out",
34 | },
35 | "yolov9m": {
36 | "model_url": "https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-m-converted.pt",
37 | "model_filename": "yolov9m-converted.pt",
38 | "model_run_dir": "yolov9m-out",
39 | },
40 | "yolov9c": {
41 | "model_url": "https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-c-converted.pt",
42 | "model_filename": "yolov9c-converted.pt",
43 | "model_run_dir": "yolov9c-out",
44 | },
45 | "yolov9e": {
46 | "model_url": "https://github.com/WongKinYiu/yolov9/releases/download/v0.1/yolov9-e-converted.pt",
47 | "model_filename": "yolov9e-converted.pt",
48 | "model_run_dir": "yolov9e-out",
49 | },
50 | } # noqa: E501 // docs
51 |
52 | LICENSE = "GPL-3.0"
53 | DATASET_DIR = "../../../data/coco-val-2017"
54 | REPO_URL = "https://github.com/WongKinYiu/yolov9.git"
55 | DEVICE = "0" if torch.cuda.is_available() else "cpu"
56 | RUN_PARAMETERS = dict(
57 | imgsz=640,
58 | conf=0.001,
59 | )
60 | GIT_REPO_URL = "https://github.com/WongKinYiu/yolov9"
61 | PAPER_URL = "https://arxiv.org/abs/2402.13616"
62 |
63 |
64 | def run(
65 | model_ids: List[str],
66 | skip_if_result_exists=False,
67 | dataset: Optional[sv.DetectionDataset] = None,
68 | ) -> None:
69 | """
70 | Run the evaluation for the given models and dataset.
71 |
72 | Arguments:
73 | model_ids: List of model ids to evaluate. Evaluate all models if None.
74 | skip_if_result_exists: If True, skip the evaluation if the result json already exists.
75 | dataset: If provided, use this dataset for evaluation. Otherwise, load the dataset from the default directory.
76 | """ # noqa: E501 // docs
77 | if not model_ids:
78 | model_ids = list(MODEL_DICT.keys())
79 |
80 | for model_id in model_ids:
81 | print(f"\nEvaluating model: {model_id}")
82 | model_values = MODEL_DICT[model_id]
83 |
84 | if skip_if_result_exists and result_json_already_exists(model_id):
85 | print(f"Skipping {model_id}. Result already exists!")
86 | continue
87 |
88 | if not Path("yolov9-repo").is_dir():
89 | run_shell_command(["git", "clone", REPO_URL, "yolov9-repo"])
90 | download_file(model_values["model_url"], model_values["model_filename"])
91 |
92 | # Make predictions
93 | shutil.rmtree(
94 | f"yolov9-repo/runs/detect/{model_values['model_run_dir']}",
95 | ignore_errors=True,
96 | )
97 | run_shell_command(
98 | [
99 | "python",
100 | "detect.py",
101 | "--source",
102 | "../../../../data/coco-val-2017/images/val2017",
103 | "--img",
104 | str(RUN_PARAMETERS["imgsz"]),
105 | "--device",
106 | DEVICE,
107 | "--weights",
108 | f"../{model_values['model_filename']}",
109 | "--name",
110 | model_values["model_run_dir"],
111 | "--save-txt",
112 | "--save-conf",
113 | ],
114 | working_directory="yolov9-repo",
115 | )
116 | predictions_dict = load_predictions_dict(
117 | Path(f"yolov9-repo/runs/detect/{model_values['model_run_dir']}")
118 | )
119 |
120 | if dataset is None:
121 | dataset = load_detections_dataset(DATASET_DIR)
122 |
123 | predictions = []
124 | targets = []
125 | for image_path, _, target_detections in tqdm(dataset, total=len(dataset)):
126 | # Load predictions
127 | detections = predictions_dict[Path(image_path).name]
128 |
129 | predictions.append(detections)
130 | targets.append(target_detections)
131 |
132 | mAP_metric = MeanAveragePrecision()
133 | f1_score = F1Score()
134 | f1_score_result = f1_score.update(predictions, targets).compute()
135 | mAP_result = mAP_metric.update(predictions, targets).compute()
136 | model = YOLO(model_id)
137 |
138 | write_result_json(
139 | model_id=model_id,
140 | model_name=model_id,
141 | model_git_url=GIT_REPO_URL,
142 | paper_url=PAPER_URL,
143 | model=model,
144 | mAP_result=mAP_result,
145 | f1_score_result=f1_score_result,
146 | license_name=LICENSE,
147 | run_parameters=RUN_PARAMETERS,
148 | )
149 |
150 |
151 | def load_predictions_dict(run_dir: Path) -> Dict[str, sv.Detections]:
152 | print(f"Loading predictions dataset from {run_dir}...")
153 | image_dir = run_dir
154 | labels_dir = run_dir / "labels"
155 | dataset = {}
156 | for image_path in image_dir.glob("*.jpg"):
157 | label_path = labels_dir / (image_path.stem + ".txt")
158 | detections = labels_to_detections(label_path, image_path)
159 | dataset[image_path.name] = detections
160 | return dataset
161 |
162 |
163 | def labels_to_detections(label_path: Path, image_path: Path) -> sv.Detections:
164 | img = cv2.imread(str(image_path))
165 | h, w = img.shape[0], img.shape[1]
166 |
167 | if not label_path.exists():
168 | print(f"Label file {label_path} not found.")
169 | return sv.Detections.empty()
170 |
171 | with open(label_path, "r") as f:
172 | lines = f.readlines()
173 | xyxy = []
174 | class_ids = []
175 | confidences = []
176 |
177 | for line in lines:
178 | class_id, x_center, y_center, width, height, confidence = line.split()
179 | x0 = float(x_center) - float(width) / 2
180 | y0 = float(y_center) - float(height) / 2
181 | x1 = float(x_center) + float(width) / 2
182 | y1 = float(y_center) + float(height) / 2
183 | x0 *= w
184 | y0 *= h
185 | x1 *= w
186 | y1 *= h
187 | xyxy.append([x0, y0, x1, y1])
188 | class_ids.append(class_id)
189 | confidences.append(confidence)
190 |
191 | detections = sv.Detections(
192 | xyxy=np.array(xyxy, dtype=np.float32),
193 | class_id=np.array(class_ids, dtype=int),
194 | confidence=np.array(confidences, dtype=float),
195 | )
196 |
197 | return detections
198 |
199 |
200 | if __name__ == "__main__":
201 | parser = argparse.ArgumentParser()
202 | parser.add_argument(
203 | "model_ids",
204 | nargs="*",
205 | help="Model ids to evaluate. If not provided, evaluate all models.",
206 | )
207 | parser.add_argument(
208 | "--skip_if_result_exists",
209 | action="store_true",
210 | help="If specified, skip the evaluation if the result json already exists.",
211 | )
212 | args = parser.parse_args()
213 |
214 | run(args.model_ids, args.skip_if_result_exists)
215 |
--------------------------------------------------------------------------------
/pyproject.toml:
--------------------------------------------------------------------------------
1 |
2 | [tool.bandit]
3 | target = ["models"]
4 | tests = ["B201", "B301", "B318", "B314", "B303", "B413", "B412", "B319"]
5 |
6 | [tool.autoflake]
7 | check = true
8 | imports = ["cv2", "supervision"]
9 |
10 | [tool.black]
11 | target-version = ["py38"]
12 | line-length = 88
13 | include = '\.pyi?$'
14 | exclude = '''
15 | /(
16 | \.git
17 | | \.hg
18 | | \.mypy_cache
19 | | \.tox
20 | | \.venv
21 | | _build
22 | | buck-out
23 | | build
24 | | dist
25 | | docs
26 | )/
27 | '''
28 |
29 | [tool.ruff]
30 | target-version = "py38"
31 |
32 | # Exclude a variety of commonly ignored directories.
33 | exclude = [
34 | ".bzr",
35 | ".direnv",
36 | ".eggs",
37 | ".git",
38 | ".git-rewrite",
39 | ".hg",
40 | ".mypy_cache",
41 | ".nox",
42 | ".pants.d",
43 | ".pytype",
44 | ".ruff_cache",
45 | ".svn",
46 | ".tox",
47 | ".venv",
48 | "__pypackages__",
49 | "_build",
50 | "buck-out",
51 | "build",
52 | "dist",
53 | "node_modules",
54 | "venv",
55 | "yarn-error.log",
56 | "yarn.lock",
57 | "docs",
58 | ]
59 |
60 | line-length = 88
61 | indent-width = 4
62 |
63 | [tool.ruff.lint]
64 | # Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
65 | select = ["E", "F", "I", "A", "Q", "W"]
66 | ignore = []
67 | # Allow autofix for all enabled rules (when `--fix`) is provided.
68 | fixable = [
69 | "A",
70 | "B",
71 | "C",
72 | "D",
73 | "E",
74 | "F",
75 | "G",
76 | "I",
77 | "N",
78 | "Q",
79 | "S",
80 | "T",
81 | "W",
82 | "ANN",
83 | "ARG",
84 | "BLE",
85 | "COM",
86 | "DJ",
87 | "DTZ",
88 | "EM",
89 | "ERA",
90 | "EXE",
91 | "FBT",
92 | "ICN",
93 | "INP",
94 | "ISC",
95 | "NPY",
96 | "PD",
97 | "PGH",
98 | "PIE",
99 | "PL",
100 | "PT",
101 | "PTH",
102 | "PYI",
103 | "RET",
104 | "RSE",
105 | "RUF",
106 | "SIM",
107 | "SLF",
108 | "TCH",
109 | "TID",
110 | "TRY",
111 | "UP",
112 | "YTT",
113 | ]
114 | unfixable = []
115 | # Allow unused variables when underscore-prefixed.
116 | dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
117 | pylint.max-args = 20
118 |
119 | [tool.ruff.lint.flake8-quotes]
120 | inline-quotes = "double"
121 | multiline-quotes = "double"
122 | docstring-quotes = "double"
123 |
124 | [tool.ruff.lint.pydocstyle]
125 | convention = "google"
126 |
127 | [tool.ruff.lint.per-file-ignores]
128 | "__init__.py" = ["E402", "F401"]
129 |
130 | [tool.ruff.lint.mccabe]
131 | # Flag errors (`C901`) whenever the complexity level exceeds 5.
132 | max-complexity = 20
133 |
134 | [tool.ruff.lint.isort]
135 | order-by-type = true
136 | no-sections = false
137 |
138 | [tool.ruff.format]
139 | # Like Black, use double quotes for strings.
140 | quote-style = "double"
141 |
142 | # Like Black, indent with spaces, rather than tabs.
143 | indent-style = "space"
144 |
145 | # Like Black, respect magic trailing commas.
146 | skip-magic-trailing-comma = false
147 |
148 | # Like Black, automatically detect the appropriate line ending.
149 | line-ending = "auto"
150 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | gradio==5.11.0
2 | roboflow==1.1.44
3 |
--------------------------------------------------------------------------------
/run_overnight.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -e
3 |
4 | # This script is made to be run over night, producing results.py for every model in the object_detection folder.
5 | # I hacked it together for initial launch only, but it might be useful as a starting point for later automated solutions.
6 |
7 | current_path=$(pwd)
8 |
9 | # Iteartion order. Start with quick-running ones to surface errors faster.
10 | folders=(
11 | "yolov8"
12 | "yolov9"
13 | "yolov10"
14 | "rt-detr"
15 | )
16 |
17 |
18 | for folder in ${folders[@]}; do
19 | cd $current_path/models/object_detection/$folder
20 | # If results.json exists, move it to results.json.old
21 | if [ -f results.json ]; then
22 | mv results.json results.json.old
23 | fi
24 |
25 | # If folder stards with yolov9, use special rules
26 | if [ ! -f results.json ]; then
27 | if [[ $folder == yolov9* ]]; then
28 | bash run_predictions.sh
29 | fi
30 | uv venv
31 | source .venv/bin/activate
32 | uv pip install -r requirements.txt
33 | python run.py
34 | deactivate
35 | else
36 | echo "results.json already exists in $folder"
37 | fi
38 | done
39 |
--------------------------------------------------------------------------------
/static/common.css:
--------------------------------------------------------------------------------
1 | a.no-decoration {
2 | text-decoration: none;
3 | color: inherit;
4 | background-color: transparent;
5 | }
6 |
--------------------------------------------------------------------------------
/static/dark-theme.css:
--------------------------------------------------------------------------------
1 | body {
2 | background-color: #000;
3 | color: #fff;
4 | font-family: 'Source Code Pro', Arial, sans-serif;
5 | padding: 20px;
6 | }
7 |
8 | .container {
9 | width: 80%;
10 | margin: 0 auto;
11 | background-color: #333;
12 | }
13 |
14 | .header-row {
15 | display: flex;
16 | justify-content: space-between;
17 | align-items: center;
18 | }
19 |
20 | table {
21 | width: 100%;
22 | border-collapse: collapse;
23 | margin-top: 2px;
24 | font-size: 14px;
25 | }
26 |
27 | th, td {
28 | padding: 10px;
29 | text-align: left;
30 | border-bottom: 1px solid #555;
31 | }
32 |
33 | td {
34 | vertical-align: middle; /* Ensure vertical centering */
35 | height: 100%; /* Full height cells */
36 | }
37 |
38 | th {
39 | background-color: #444;
40 | }
41 |
42 | a {
43 | color: #4493f8;
44 | background-color: #388bfd1a;
45 | padding: 2px 4px;
46 | margin: 0px 4px;
47 | border-radius: 5px;
48 | }
49 |
50 | a.badge-link {
51 | background-color: transparent;
52 | padding: 0;
53 | margin: 0;
54 | }
55 |
56 | .badge-link {
57 | display: inline-block; /* Prevent badge links from stretching */
58 | line-height: 0; /* Remove extra space around badges */
59 | }
60 |
61 | .subtitle-row {
62 | color: #ccc;
63 | display: flex;
64 | flex-direction: row;
65 | justify-content: space-between;
66 | align-items: center;
67 | }
68 |
69 | .sv-row {
70 | display: flex;
71 | flex-direction: row;
72 | justify-items: center;
73 | }
74 |
75 | tr:nth-child(even) {
76 | background-color: #222;
77 | }
78 |
79 | tr:nth-child(odd) {
80 | background-color: #111;
81 | }
82 |
83 | .theme-toggle-container {
84 | display: flex;
85 | align-items: center;
86 | }
87 |
88 | .theme-toggle {
89 | display: none;
90 | }
91 |
92 | .theme-toggle-label {
93 | display: flex;
94 | align-items: center;
95 | cursor: pointer;
96 | }
97 |
98 | .theme-toggle-label .fas {
99 | font-size: 1.5em;
100 | margin: 0 5px;
101 | }
102 |
103 | .theme-toggle-label .fa-sun {
104 | color: #000;
105 | }
106 |
107 | .theme-toggle-label .fa-moon {
108 | color: #fff;
109 | display: none;
110 | }
111 |
112 | .theme-toggle:checked + .theme-toggle-label .fa-sun {
113 | display: none;
114 | }
115 |
116 | .theme-toggle:checked + .theme-toggle-label .fa-moon {
117 | display: inline;
118 | }
119 |
120 | .tooltip {
121 | display: none;
122 | position: absolute;
123 | color: #333;
124 | background-color: #fff;
125 | padding: 5px;
126 | border-radius: 5px;
127 | font-size: 12px;
128 | z-index: 1000;
129 | }
130 |
131 | .tooltip-text {
132 | display: none;
133 | width: max-content;
134 | position: absolute;
135 | top: 0;
136 | left: 0;
137 | color: #222;
138 | background: white;
139 | font-weight: bold;
140 | padding: 5px;
141 | border-radius: 4px;
142 | font-size: 90%;
143 | }
144 |
145 | .tooltip-text ul {
146 | list-style-type: none;
147 | padding: 0;
148 | margin: 0;
149 | }
150 |
151 | .tooltip-text li {
152 | margin: 0;
153 | padding: 0;
154 | }
155 |
156 | .fas.fa-cog:hover + .tooltip-text {
157 | visibility: visible;
158 | opacity: 1;
159 | }
160 |
--------------------------------------------------------------------------------
/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/roboflow/model-leaderboard/6c3db9c04fd2fc4a17a798f35f4f483389dd407d/static/favicon.ico
--------------------------------------------------------------------------------
/static/github.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
18 |
19 | GitHub
20 | GitHub
21 |
22 |
23 |
--------------------------------------------------------------------------------
/static/light-theme.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family: 'Source Code Pro', Arial, sans-serif;
3 | padding: 20px;
4 | }
5 |
6 | .container {
7 | width: 80%;
8 | margin: 0 auto;
9 | padding: 20px;
10 | border-radius: 8px;
11 | }
12 |
13 | .header-row {
14 | display: flex;
15 | justify-content: space-between;
16 | align-items: center;
17 | }
18 |
19 | table {
20 | width: 100%;
21 | border-collapse: collapse;
22 | margin-top: 2px;
23 | font-size: 14px;
24 | }
25 |
26 | th, td {
27 | padding: 10px;
28 | text-align: left;
29 | border-bottom: 1px solid #ddd;
30 | }
31 |
32 | td {
33 | vertical-align: middle;
34 | height: 100%;
35 | }
36 |
37 | th {
38 | background-color: #f2f2f2;
39 | }
40 |
41 | a {
42 | color: #4493f8;
43 | background-color: #388bfd1a;
44 | padding: 2px 4px;
45 | margin: 0px 4px;
46 | border-radius: 5px;
47 | }
48 |
49 | a.badge-link {
50 | background-color: transparent;
51 | padding: 0;
52 | margin: 0;
53 | }
54 |
55 | .subtitle-row {
56 | display: flex;
57 | flex-direction: row;
58 | justify-content: space-between;
59 | align-items: center;
60 | }
61 |
62 | .sv-row {
63 | display: flex;
64 | flex-direction: row;
65 | justify-items: center;
66 | }
67 |
68 | .theme-toggle-container {
69 | display: flex;
70 | align-items: center;
71 | }
72 |
73 | .theme-toggle {
74 | display: none;
75 | }
76 |
77 | .theme-toggle-label {
78 | display: flex;
79 | align-items: center;
80 | cursor: pointer;
81 | }
82 |
83 | .theme-toggle-label .fas {
84 | font-size: 1.5em;
85 | margin: 0 5px;
86 | }
87 |
88 | .theme-toggle-label .fa-sun {
89 | color: #000;
90 | }
91 |
92 | .theme-toggle-label .fa-moon {
93 | color: #fff;
94 | display: none;
95 | }
96 |
97 | .theme-toggle:checked + .theme-toggle-label .fa-sun {
98 | display: inline;
99 | }
100 |
101 | .theme-toggle:checked + .theme-toggle-label .fa-moon {
102 | display: none;
103 | }
104 |
105 | .tooltip {
106 | display: none;
107 | position: absolute;
108 | background-color: #333;
109 | color: #fff;
110 | padding: 5px;
111 | border-radius: 5px;
112 | font-size: 12px;
113 | z-index: 1000;
114 | }
115 |
116 | .tooltip-text {
117 | display: none;
118 | width: max-content;
119 | position: absolute;
120 | top: 0;
121 | left: 0;
122 | background: #222;
123 | color: white;
124 | font-weight: bold;
125 | padding: 5px;
126 | border-radius: 4px;
127 | font-size: 90%;
128 | }
129 |
130 | .tooltip-text ul {
131 | list-style-type: none;
132 | padding: 0;
133 | margin: 0;
134 | }
135 |
136 | .tooltip-text li {
137 | margin: 0;
138 | padding: 0;
139 | }
140 |
141 | .fas.fa-cog:hover + .tooltip-text {
142 | visibility: visible;
143 | opacity: 1;
144 | }
145 |
146 | a.badge-link {
147 | background-color: transparent;
148 | padding: 0;
149 | margin: 0;
150 | }
151 |
152 | .badge-link {
153 | display: inline-block;
154 | line-height: 0;
155 | }
156 |
--------------------------------------------------------------------------------
/static/theme-toggle.js:
--------------------------------------------------------------------------------
1 | // theme-toggle.js
2 | document.addEventListener('DOMContentLoaded', () => {
3 | const themeToggle = document.getElementById('theme-toggle');
4 | const themeLink = document.getElementById('theme-link');
5 |
6 | const currentTheme = localStorage.getItem('theme') || 'light';
7 | if (currentTheme === 'dark') {
8 | themeLink.href = '/static/dark-theme.css';
9 | themeToggle.checked = true;
10 | document.querySelector('.fa-sun').style.display = 'none';
11 | document.querySelector('.fa-moon').style.display = 'inline';
12 | } else {
13 | themeLink.href = '/static/light-theme.css';
14 | themeToggle.checked = false;
15 | document.querySelector('.fa-sun').style.display = 'inline';
16 | document.querySelector('.fa-moon').style.display = 'none';
17 | }
18 |
19 | themeToggle.addEventListener('change', () => {
20 | if (themeToggle.checked) {
21 | themeLink.href = '/static/dark-theme.css';
22 | localStorage.setItem('theme', 'dark');
23 | document.querySelector('.fa-sun').style.display = 'none';
24 | document.querySelector('.fa-moon').style.display = 'inline';
25 | } else {
26 | themeLink.href = '/static/light-theme.css';
27 | localStorage.setItem('theme', 'light');
28 | document.querySelector('.fa-sun').style.display = 'inline';
29 | document.querySelector('.fa-moon').style.display = 'none';
30 | }
31 | });
32 | });
33 |
--------------------------------------------------------------------------------