Skip to content

Commit 0d2bb01

Browse files
committed
Update dependencies and enhance documentation for improved functionality
- Added `opencv-python-headless` as a dependency for the viewer in `requirements.txt` and `pyproject.toml`. - Revised the README to streamline the description and improve clarity. - Updated installation instructions to include symbolic link guidance for path placeholders. - Enhanced documentation on NMS behavior, clarifying class-aware vs class-agnostic settings. - Improved test coverage for NMS configurations and added relevant tests for class-agnostic behavior.
1 parent acdadd3 commit 0d2bb01

22 files changed

Lines changed: 463 additions & 282 deletions

File tree

‎.github/workflows/README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Runs on every push/PR to `main` / `master`:
1111

1212
Builds `dist/*` and uploads to PyPI or TestPyPI.
1313

14+
Full maintainer checklist (version bump, `make build`, TestPyPI, tagging): [docs/contributing.md — Releasing / Publishing to PyPI](../../docs/contributing.md#releasing--publishing-to-pypi).
15+
1416
| Trigger | Destination |
1517
|---------|-------------|
1618
| Push tag `v*.*.*` (e.g. `v0.1.0`) | **PyPI** (`environment: pypi`) |
@@ -50,11 +52,11 @@ Create tokens at **Account settings → API tokens** on each index (scope: entir
5052
### Production release from GitHub
5153

5254
```bash
53-
git tag -a v0.1.0 -m "Release 0.1.0"
54-
git push origin v0.1.0
55+
git tag -a v0.4.2 -m "Release 0.4.2"
56+
git push origin v0.4.2
5557
```
5658

57-
The tag push starts `publish.yml` and uploads to PyPI.
59+
The tag push starts `publish.yml` and uploads to PyPI. Use the current version from `pyproject.toml` (see [docs/contributing.md](../../docs/contributing.md#releasing--publishing-to-pypi)).
5860

5961
## `pages.yml`
6062

‎.github/workflows/test.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
pip install --upgrade pip
2020
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
2121
pip install -r requirements.txt
22-
pip install -e ".[dev,export]"
22+
pip install -e ".[dev,export,viewer]"
2323
- name: Check vendored configs match configs/
2424
run: make check-configs
2525
- name: Run tests

‎README.md‎

Lines changed: 47 additions & 264 deletions
Large diffs are not rendered by default.

‎deploy/README.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Deploy
2+
3+
Docker and production packaging examples for OrientedDet.
4+
5+
| Resource | Description |
6+
|----------|-------------|
7+
| [example/](example/) | Sanic Tile Geo Process Docker image (DOTA smoke) — see [example/README.md](example/README.md) |
8+
| [scripts/](scripts/) | Helper scripts for the deploy example |
9+
| [docs/examples/deploy.md](../docs/examples/deploy.md) | Full walkthrough |
10+
| [Blog: Docker deploy](https://deeplearning.earth/posts/2026-10-05_deploy_oriented_det_in_docker/) | End-to-end write-up |
11+
12+
For ONNX export without PyTorch on the inference host, see [export/README.md](../export/README.md).

‎docs/README.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,27 @@ https://dl4eo.github.io/oriented-det/
5050
- **site/** — Generated HTML (created by `mkdocs build`)
5151

5252
API pages are generated from Python docstrings via `mkdocstrings`. See [documentation.md](documentation.md) for more on writing and building the docs.
53+
54+
## Further reading
55+
56+
Hands-on write-ups (code, metrics, inference knobs, and project rationale) live on **[DeepLearning.Earth](https://deeplearning.earth)**:
57+
58+
| Topic | Post |
59+
|-------|------|
60+
| Oriented detection in aerial and satellite images | [https://deeplearning.earth/oriented-detection-in-satellite-images/](https://deeplearning.earth/oriented-detection-in-satellite-images/) |
61+
| Why OrientedDet / Apache 2.0 stack | [https://deeplearning.earth/posts/2026-06-22_oriented-det_v0_1_0_sovereign_oriented_object_detection_for_eo/](https://deeplearning.earth/posts/2026-06-22_oriented-det_v0_1_0_sovereign_oriented_object_detection_for_eo/) |
62+
| Visual detections (15 DOTA classes) | [https://deeplearning.earth/posts/2026-06-23_oriented_rcnn_detections_for_the_15_dota_classes/](https://deeplearning.earth/posts/2026-06-23_oriented_rcnn_detections_for_the_15_dota_classes/) |
63+
| `odet image-demo` on Apple Silicon | [https://deeplearning.earth/posts/2026-06-25_oriented_object_detection_on_macos_in_pure_python/](https://deeplearning.earth/posts/2026-06-25_oriented_object_detection_on_macos_in_pure_python/) |
64+
| Sliding-window inference (`demo/large.jpg`) | [https://deeplearning.earth/posts/2026-06-29_announcing_the_final_oriented_det_pretrained_model/](https://deeplearning.earth/posts/2026-06-29_announcing_the_final_oriented_det_pretrained_model/) |
65+
| Sentinel-2 ships (`--zoom`, class filter) | [https://deeplearning.earth/posts/2026-06-25_zero-shot_ship_detection_on_a_copernicus_sentinel-2_tile_with_oriented_rcnn/](https://deeplearning.earth/posts/2026-06-25_zero-shot_ship_detection_on_a_copernicus_sentinel-2_tile_with_oriented_rcnn/) |
66+
| Sampled rIoU, ProbIoU, Faster R-CNN Task 1 | [https://deeplearning.earth/posts/2026-07-10_rotated_faster_rcnn_probiou_dota/](https://deeplearning.earth/posts/2026-07-10_rotated_faster_rcnn_probiou_dota/) |
67+
| Zoo / MMRotate parity | [https://deeplearning.earth/posts/2026-07-11_oriented-det_v0_1_1_prob_iou_mmrotate_parity_and_the_updated_zoo/](https://deeplearning.earth/posts/2026-07-11_oriented-det_v0_1_1_prob_iou_mmrotate_parity_and_the_updated_zoo/) |
68+
| Rotated FCOS, decoded rIoU, four-family zoo | [https://deeplearning.earth/posts/2026-08-28_oriented-det_v0_2_0_rotated_fcos_decoded_riou_and_the_updated_zoo/](https://deeplearning.earth/posts/2026-08-28_oriented-det_v0_2_0_rotated_fcos_decoded_riou_and_the_updated_zoo/) |
69+
| FCOS vs Oriented R-CNN (MPS latency, thresholds) | [https://deeplearning.earth/posts/2026-09-02_rotated_fcos_vs_oriented_rcnn_on_macos/](https://deeplearning.earth/posts/2026-09-02_rotated_fcos_vs_oriented_rcnn_on_macos/) |
70+
| Side-by-side browser demo (three 1× checkpoints) | [https://deeplearning.earth/posts/2026-09-06_oriented_det_optical_satellite_demo/](https://deeplearning.earth/posts/2026-09-06_oriented_det_optical_satellite_demo/) |
71+
| Apache 2.0 vs DOTA / HRSC dataset terms | [https://deeplearning.earth/posts/2026-09-10_oriented_det_apache_license_versus_dota/](https://deeplearning.earth/posts/2026-09-10_oriented_det_apache_license_versus_dota/) |
72+
| Docker deploy (Tile Geo Process) | [https://deeplearning.earth/posts/2026-10-05_deploy_oriented_det_in_docker/](https://deeplearning.earth/posts/2026-10-05_deploy_oriented_det_in_docker/) |
73+
| ONNX export (no PyTorch on infer) | [https://deeplearning.earth/posts/2026-10-08_onnx_export_without_pytorch/](https://deeplearning.earth/posts/2026-10-08_onnx_export_without_pytorch/) |
74+
| Rotated RTMDet, 77.60% Task 1 | [https://deeplearning.earth/posts/2026-10-10_oriented-det_v0_4_0_rotated_rtmdet/](https://deeplearning.earth/posts/2026-10-10_oriented-det_v0_4_0_rotated_rtmdet/) |
75+
| Which oriented detector to train | [https://deeplearning.earth/posts/2026-10-29_which_oriented_detector_to_train/](https://deeplearning.earth/posts/2026-10-29_which_oriented_detector_to_train/) |
76+
| YOLO-OBB, 77.80% Task 1 (v0.4.2) | [https://deeplearning.earth/posts/2026-11-23_oriented-det_v0_4_2_yolo_obb/](https://deeplearning.earth/posts/2026-11-23_oriented-det_v0_4_2_yolo_obb/) |

‎docs/contributing.md‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,110 @@ Aligned with the [Roadmap](roadmap.md):
111111
- **Ops:** Fused CUDA rotated IoU/NMS kernels
112112
- Bug fixes and tool scripts
113113

114+
## Releasing / Publishing to PyPI
115+
116+
Maintainers only. Workflow detail and Trusted Publishing setup: [`.github/workflows/README.md`](../.github/workflows/README.md).
117+
118+
Version **0.4.2** — tag releases as **`v0.4.2`** (git) matching `version` in `pyproject.toml`.
119+
120+
Configs: edit **`configs/`** at the repo root, then **`make sync-configs`** so **`oriented_det/configs/`** stays in sync (see **`oriented_det/configs/vendored_manifest.txt`**). CI runs **`make check-configs`**.
121+
122+
Install publishing tools (included in `.[dev]`):
123+
124+
```bash
125+
uv pip install -e ".[dev]" # or: make publish-deps
126+
```
127+
128+
### Step-by-step release
129+
130+
#### 1. One-time PyPI setup
131+
132+
1. Create accounts on [test.pypi.org](https://test.pypi.org) and [pypi.org](https://pypi.org) (can use the same email).
133+
2. **Register the project name** `oriented-det` on PyPI (first upload creates it; TestPyPI is separate).
134+
3. **Trusted Publishing (recommended)** — on each index, add a publisher for `DL4EO/oriented-det`, workflow `publish.yml`, environments `testpypi` / `pypi`. See [.github/workflows/README.md](../.github/workflows/README.md).
135+
4. **Or API tokens** — create `pypi-…` tokens and export locally (or add GitHub secrets `TESTPYPI_API_TOKEN`, `PYPI_API_TOKEN`):
136+
137+
```bash
138+
export TWINE_USERNAME=__token__
139+
export TWINE_PASSWORD=pypi-AgEI… # TestPyPI or PyPI token
140+
```
141+
142+
#### 2. Pre-release checklist
143+
144+
```bash
145+
make check-configs
146+
pytest tests/ -q
147+
```
148+
149+
Bump version in `pyproject.toml` and `docs/changelog.md` if needed (currently **0.4.2**).
150+
151+
#### 3. Build locally
152+
153+
```bash
154+
make sync-configs # after changing configs/ or the manifest
155+
make build # check-configs + sdist + wheel into dist/
156+
make twine-check
157+
```
158+
159+
Smoke-test the wheel:
160+
161+
```bash
162+
python -m venv /tmp/odet-smoke && source /tmp/odet-smoke/bin/activate
163+
pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
164+
pip install dist/*.whl
165+
odet --help
166+
python -c "from oriented_det.geometry import RBox; print(RBox(0,0,1,1,0).area)"
167+
```
168+
169+
#### 4. Upload to TestPyPI
170+
171+
```bash
172+
make publish-testpypi
173+
```
174+
175+
Install from TestPyPI (PyPI index still needed for dependencies like `torch`):
176+
177+
```bash
178+
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple oriented-det==0.4.2
179+
odet --help
180+
```
181+
182+
Or trigger **Actions → Publish → Run workflow** (target: `testpypi`) after configuring Trusted Publishing or secrets.
183+
184+
#### 5. Tag and upload to production PyPI
185+
186+
When TestPyPI looks good:
187+
188+
```bash
189+
git tag -a v0.4.2 -m "Release 0.4.2"
190+
git push origin v0.4.2 # triggers publish.yml → PyPI (if CI is configured)
191+
```
192+
193+
Local upload (fallback):
194+
195+
```bash
196+
make publish-pypi
197+
```
198+
199+
Create a [GitHub Release](https://github.com/DL4EO/oriented-det/releases) from tag `v0.4.2` with notes from `docs/changelog.md`.
200+
201+
#### 6. After publish
202+
203+
- Verify `pip install oriented-det` in a clean environment.
204+
- Users still install **PyTorch** separately for their CUDA/CPU platform.
205+
206+
### Makefile targets
207+
208+
| Target | Action |
209+
|--------|--------|
210+
| `make publish-deps` | Install `build` and `twine` |
211+
| `make build` | `check-configs` + `python -m build` |
212+
| `make twine-check` | Validate `dist/*` metadata |
213+
| `make publish-testpypi` | Build, check, upload to TestPyPI |
214+
| `make publish-pypi` | Build, check, upload to PyPI |
215+
216+
**Trusted Publishing** avoids long-lived tokens; keep `make publish-*` for manual releases. Details: [.github/workflows/README.md](../.github/workflows/README.md).
217+
114218
## Questions?
115219

116220
Feel free to open an issue for questions or discussions!

‎docs/getting-started/installation.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,23 @@ overlap = iou.rbox_iou(box1, box2)
111111
print(f"IoU: {overlap}")
112112
```
113113

114+
## Path placeholders in docs and configs
115+
116+
Examples throughout this repo use placeholder paths such as **`/path/to/data`** and **`/path/to/oriented-det`**. You can point commands and JSON configs at your real locations (e.g. `dataset.data_root` in a training config), or keep those placeholders and map them with symbolic links:
117+
118+
```bash
119+
# Create the parent directory (may need sudo for paths under /path/to)
120+
sudo mkdir -p /path/to
121+
122+
# Point the placeholder at your DOTA dataset
123+
ln -s /home/username/dota /path/to/data
124+
125+
# Point the placeholder at your clone of this repo
126+
ln -s /home/username/oriented-det /path/to/oriented-det
127+
```
128+
129+
After that, copy-pasted commands and unmodified configs that reference `/path/to/data` or `/path/to/oriented-det` resolve to your machine. Use relative symlink targets when you want the link to stay valid if the parent directory moves.
130+
114131
## Troubleshooting
115132

116133
### Import Errors

‎docs/user-guide/geometry.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ The corners are ordered sequentially around the polygon perimeter. The loader co
166166
4. **Leverage transforms** - Centralized conversion logic
167167
5. **Check orientation** - Use `ensure_orientation()` when needed
168168

169+
## Important notes
170+
171+
- **Angles**: Radians; use a single convention (e.g. le90 for DOTA). Helper: `normalize_le90` from `oriented_det.geometry`. For angle-delta normalization in custom code, see `oriented_det.models.oriented_rpn.normalize_angle_delta`.
172+
- **NMS**: `torchvision.ops.nms_rotated` does not exist; the project uses a Python-based oriented NMS with AABB pre-filtering. GPU kernels are used when available. Details: [Operations](operations.md), [oriented_det/ops/README.md](../../oriented_det/ops/README.md).
173+
- **ROI/memory**: Training samples 512 proposals per image; use `roi_chunk_size` and `roi_use_checkpoint` for memory tuning on large GPUs. See [Models](models.md) and [Training](training.md).
174+
169175
## See Also
170176

171177
- [API Reference](../api/geometry.md) - Complete API documentation

‎export/PARITY.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The delivered graph is **ONNX pre-NMS** (`rotated_fcos_pre_nms` for FCOS). Prepr
1010
| Backbone + FCOS head + DistanceAnglePointCoder decode | Same weights/logic as `RotatedFCOS` eval via `rotated_fcos_decode_pre_nms` (includes GroupNorm). |
1111
| Per-level pre-NMS cap | Always `topk(min(nms_pre, H×W))` then score / size / finite filters. Invalid top-k rows are zeroed (`score=0`, `w=h=0`) and left in the padded tensor. |
1212
| Pre-NMS output padding | `pad_pre_nms_detections`. Default `P = nms_pre ×` FPN levels. |
13-
| Final NMS / score floors | `export.postprocess.finalize_detections_numpy` calling `export.nms` (numpy clip, or Shapely if `nms_backend=shapely`). Production `score_threshold` applied **before** NMS. FCOS eval NMS is class-aware; production configs may set `nms_class_agnostic`. Small float drift vs Shapely is possible on the `python` backend. |
13+
| Final NMS / score floors | `export.postprocess.finalize_detections_numpy` calling `export.nms` (numpy clip, or Shapely if `nms_backend=shapely`). Production `score_threshold` applied **before** NMS. Class-aware vs class-agnostic follows resolved `nms_class_agnostic` (`production` override, else `model`; export unset default is class-agnostic). Small float drift vs Shapely is possible on the `python` backend. |
1414
| Sliding-window tiling | `detect_image` tiles `fixed` / `crop` images larger than `window_size` (else `target_size`). Same edge-flush grid and `target_size / window_size` box scale as `run_inference_sliding_window`. Overlap default 200 px. Per-window NMS, then a second NMS across windows. Interior overlap margin stays 0. `pad` / `keep_ratio` are a single resize. |
1515
| GeoJSON | Out of scope — PyTorch deploy path. |
1616

@@ -22,7 +22,7 @@ The delivered graph is **ONNX pre-NMS** (`rotated_fcos_pre_nms` for FCOS). Prepr
2222
| Backbone + SepBN head + DistanceAnglePointCoder decode | Same weights/logic as `RotatedRTMDet` eval via `_rtmdet_level_topk_decode`. No centerness. |
2323
| Per-level pre-NMS cap | Always `topk(min(nms_pre, H×W))` then score / size / finite filters. Invalid top-k rows are zeroed (`score=0`, `w=h=0`) and left in the padded tensor. |
2424
| Pre-NMS output padding | `pad_pre_nms_detections`. Default `P = nms_pre ×` FPN levels (P3–P5). |
25-
| Final NMS / score floors | `export.postprocess.finalize_detections_numpy`. RTMDet eval NMS is class-aware unless `nms_class_agnostic` is set. |
25+
| Final NMS / score floors | `export.postprocess.finalize_detections_numpy`. Class-aware vs class-agnostic follows resolved `nms_class_agnostic` (same as FCOS / two-stage). |
2626

2727
## `faster_rcnn_pre_nms` / `oriented_rcnn_pre_nms`
2828

‎export/README.md‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Python (this package; **no oriented-det**). The same files are copied into `onnx
4848
| Module | Role |
4949
|--------|------|
5050
| [preprocess.py](preprocess.py) | RGB image → NCHW float32 `(x/255 - mean) / std` |
51-
| [nms.py](nms.py) | Rotated IoU + greedy NMS |
51+
| [nms.py](nms.py) | Rotated IoU + greedy NMS (class-aware or class-agnostic) |
5252
| [postprocess.py](postprocess.py) | Score floor + NMS via `nms` |
5353
| [runtime.py](runtime.py) | `detect_image(...)` glue (ORT) |
5454
| [ort_runtime.py](ort_runtime.py) | ONNX Runtime session / device |
@@ -86,6 +86,17 @@ from runtime import detect_image
8686
dets = detect_image("tile.jpg", "model.onnx")
8787
```
8888

89+
## Final NMS (class-aware vs class-agnostic)
90+
91+
Rotated NMS runs in Python after the ONNX graph (`export/nms.py`). Both modes are supported; the sidecar flag `nms_class_agnostic` (under `postprocess` / `production`) chooses which:
92+
93+
| Flag | Behavior |
94+
|------|----------|
95+
| `true` (export default when unset) | **Class-agnostic**: one NMS over all classes (overlapping car/truck etc.) |
96+
| `false` | **Class-aware**: suppress only within the same label |
97+
98+
At export: `production.nms_class_agnostic` when set, else `model.nms_class_agnostic`, else **class-agnostic**. Re-export after changing the config so the sidecar picks it up. `odet export preds` also overlays the experiment config onto the loaded meta.
99+
89100
## Inference score overrides
90101

91102
The graph is pre-NMS only. It bakes `pre_nms_score_threshold` (0.05 on the current RTMDet export) and has no threshold input. Scores below that floor are already gone; a caller cannot recover them.

0 commit comments

Comments
 (0)