| --- |
| license: other |
| task_categories: |
| - object-detection |
| tags: |
| - finedet |
| configs: |
| - config_name: v1.0 |
| default: true |
| data_files: |
| - split: train |
| path: v1.0/train-*.parquet |
| - split: validation |
| path: v1.0/validation-*.parquet |
| - config_name: v1.5 |
| data_files: |
| - split: train |
| path: v1.5/train-*.parquet |
| - split: validation |
| path: v1.5/validation-*.parquet |
| --- |
| |
| # FineDOTA — DOTA v1.0 / v1.5 in the unified detection format |
|
|
| Source: the Ultralytics-hosted DOTA release archives (github.com/ultralytics/assets, DOTAv1 / DOTAv1.5 / DOTAv2), which bundle the original DOTA-format annotations (labels/*_original) used for this conversion. Images are the original resolution, re-encoded by upstream from PNG to JPEG. |
| |
| Converted by the finedet project into a unified, AutoTrain-compatible layout: |
| `image` / `width` / `height` / `objects{bbox, category}` with COCO-format |
| `[x, y, w, h]` boxes in absolute pixels. Boxes are clipped to the image and |
| empty boxes dropped; category ids are densified per the category tables |
| below. |
| |
| This repository hosts one config per source release: `v1.0`, `v1.5` (default: `v1.0`). Load one with `load_dataset("finedet/dota", "<config>")`. |
| |
| ## Box format |
| |
| `objects.bbox` follows the COCO convention: `[x, y, w, h]` in absolute pixels, |
| origin at the image's top-left corner. |
| |
| <img src="assets/bbox_format.png" width="480"/> |
| |
| ## Schema notes |
| |
| Each object carries three box representations. Which is original and which is derived: |
| |
| - `objects.polygon` — the **original** annotation: the raw DOTA 8-point oriented box `[x1, y1, x2, y2, x3, y3, x4, y4]` in absolute pixels, vertex order exactly as in the source label file (DOTA annotates the four vertices in clockwise order, starting from a category-specific starting vertex), **not clipped** to the image bounds. |
| - `objects.bbox` — **derived**: the axis-aligned hull of the polygon (`[min x, min y, max x - min x, max y - min y]` over the 4 points), then clipped to the image; an object whose clipped hull has zero width or height is dropped entirely (polygon and obb included). |
| - `objects.obb` — **derived**: `[cx, cy, w, h, theta]`, the minimum-area rectangle over the 4 polygon points (`cv2.minAreaRect`), normalized to the long-edge convention: `w >= h`, `theta` = angle of the `w` edge against the +x axis, in radians within `[-pi/2, pi/2)` (for squares the two equivalent angles are not disambiguated). Not clipped. |
| - `objects.difficult` — the original DOTA difficult flag (kept, not filtered). |
| |
| The sample galleries below draw the derived axis-aligned `bbox` hulls. |
| |
| ## License |
| |
| Original dataset: DOTA (all releases share the same terms). Official terms: 'All images and their associated annotations in DOTA can be used for academic purposes only, but any commercial use is prohibited.' The same terms apply to the redistributed archives used as the source here. Imagery originates from Google Earth, CycloMedia B.V., and the GF-2 / JL-1 satellites (panchromatic), and remains subject to the respective providers' terms — the Google Earth terms of use in particular. Academic use only. |
| |
| ## Config `v1.0` |
| |
| ### Example images |
| |
| Boxes are colored by category: near-transparent fill, opaque outline. |
| |
| <table> |
| <tr><td><img src="assets/v1.0/sample_0.jpg" width="360"/></td><td><img src="assets/v1.0/sample_1.jpg" width="360"/></td></tr> |
| <tr><td><img src="assets/v1.0/sample_2.jpg" width="360"/></td><td><img src="assets/v1.0/sample_3.jpg" width="360"/></td></tr> |
| </table> |
| |
| ### Conversion notes |
| |
| Converted from the Ultralytics DOTA v1.0 archive using the bundled original-format annotations. 15 categories; train 1,411 / validation 458 images. difficult boxes are kept and flagged via objects.difficult. No tiling — original image sizes are preserved (up to ~20,000 px per side); image files are upstream JPEG re-encodes of the official PNGs. The test / test-dev / test-challenge splits are excluded (annotations not public). |
| |
| ### Splits |
| |
| - train: 1411 images |
| - validation: 458 images |
| |
| ### Categories |
| |
| | id | name | |
| |---|---| |
| | 0 | plane | |
| | 1 | ship | |
| | 2 | storage-tank | |
| | 3 | baseball-diamond | |
| | 4 | tennis-court | |
| | 5 | basketball-court | |
| | 6 | ground-track-field | |
| | 7 | harbor | |
| | 8 | bridge | |
| | 9 | large-vehicle | |
| | 10 | small-vehicle | |
| | 11 | helicopter | |
| | 12 | roundabout | |
| | 13 | soccer-ball-field | |
| | 14 | swimming-pool | |
| |
| ## Config `v1.5` |
| |
| ### Example images |
| |
| Boxes are colored by category: near-transparent fill, opaque outline. |
| |
| <table> |
| <tr><td><img src="assets/v1.5/sample_0.jpg" width="360"/></td><td><img src="assets/v1.5/sample_1.jpg" width="360"/></td></tr> |
| <tr><td><img src="assets/v1.5/sample_2.jpg" width="360"/></td><td><img src="assets/v1.5/sample_3.jpg" width="360"/></td></tr> |
| </table> |
| |
| ### Conversion notes |
| |
| Converted from the Ultralytics DOTA v1.5 archive using the bundled original-format annotations. 16 categories (adds container-crane); the same images as v1.0, relabeled — including very small instances. difficult boxes are kept and flagged via objects.difficult. No tiling — original image sizes are preserved (up to ~20,000 px per side); image files are upstream JPEG re-encodes of the official PNGs. The test / test-dev / test-challenge splits are excluded (annotations not public). |
| |
| ### Splits |
| |
| - train: 1411 images |
| - validation: 458 images |
| |
| ### Categories |
| |
| | id | name | |
| |---|---| |
| | 0 | plane | |
| | 1 | ship | |
| | 2 | storage-tank | |
| | 3 | baseball-diamond | |
| | 4 | tennis-court | |
| | 5 | basketball-court | |
| | 6 | ground-track-field | |
| | 7 | harbor | |
| | 8 | bridge | |
| | 9 | large-vehicle | |
| | 10 | small-vehicle | |
| | 11 | helicopter | |
| | 12 | roundabout | |
| | 13 | soccer-ball-field | |
| | 14 | swimming-pool | |
| | 15 | container-crane | |
| |
| ## Training with transformers |
| |
| The boxes are already in the absolute-pixel COCO `[x, y, w, h]` format that |
| `AutoImageProcessor` expects, so fine-tuning a detector needs no bbox |
| conversion: |
| |
| ```python |
| import torch |
| from datasets import load_dataset |
| from transformers import (AutoImageProcessor, AutoModelForObjectDetection, |
| Trainer, TrainingArguments) |
| |
| ds = load_dataset("finedet/dota", "v1.0") |
| obj_feat = ds["train"].features["objects"] |
| if hasattr(obj_feat, "feature"): |
| obj_feat = obj_feat.feature |
| cat_feat = obj_feat["category"] |
| names = (cat_feat.feature if hasattr(cat_feat, "feature") else cat_feat).names |
| |
| checkpoint = "facebook/detr-resnet-50" |
| processor = AutoImageProcessor.from_pretrained(checkpoint) |
| model = AutoModelForObjectDetection.from_pretrained( |
| checkpoint, |
| id2label=dict(enumerate(names)), |
| label2id={n: i for i, n in enumerate(names)}, |
| ignore_mismatched_sizes=True, |
| ) |
| |
| |
| def transform(batch): |
| images = [img.convert("RGB") for img in batch["image"]] |
| annotations = [ |
| {"image_id": i, |
| "annotations": [ |
| {"bbox": box, "category_id": cat, "area": box[2] * box[3], "iscrowd": 0} |
| for box, cat in zip(objs["bbox"], objs["category"]) |
| ]} |
| for i, objs in enumerate(batch["objects"]) |
| ] |
| return processor(images=images, annotations=annotations, return_tensors="pt") |
| |
|
|
| def collate(batch): |
| return {"pixel_values": torch.stack([x["pixel_values"] for x in batch]), |
| "labels": [x["labels"] for x in batch]} |
| |
|
|
| trainer = Trainer( |
| model=model, |
| args=TrainingArguments(output_dir="out", per_device_train_batch_size=4, |
| num_train_epochs=10, learning_rate=1e-5, |
| remove_unused_columns=False), |
| train_dataset=ds["train"].with_transform(transform), |
| data_collator=collate, |
| ) |
| trainer.train() |
| ``` |
| |