minato-ryan commited on
Commit
8975f8f
·
verified ·
1 Parent(s): f7536af

dataset card

Browse files
Files changed (1) hide show
  1. README.md +132 -0
README.md CHANGED
@@ -13,3 +13,135 @@ configs:
13
  - split: validation
14
  path: v1.0/validation-*.parquet
15
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  - split: validation
14
  path: v1.0/validation-*.parquet
15
  ---
16
+
17
+ # finedet-dota — DOTA v1.0 / v1.5 / v2.0 in the unified detection format
18
+
19
+ 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.
20
+
21
+ Converted by the finedet project into a unified, AutoTrain-compatible layout:
22
+ `image` / `width` / `height` / `objects{bbox, category}` with COCO-format
23
+ `[x, y, w, h]` boxes in absolute pixels. Boxes are clipped to the image and
24
+ empty boxes dropped; category ids are densified per the category tables
25
+ below.
26
+
27
+ This repository hosts one config per source release: `v1.0` (default: `v1.0`). Load one with `load_dataset("finedet/dota", "<config>")`.
28
+
29
+ ## Box format
30
+
31
+ `objects.bbox` follows the COCO convention: `[x, y, w, h]` in absolute pixels,
32
+ origin at the image's top-left corner.
33
+
34
+ <img src="assets/bbox_format.png" width="480"/>
35
+
36
+ ## Schema notes
37
+
38
+ Each object carries three box representations. Which is original and which is derived:
39
+
40
+ - `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.
41
+ - `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).
42
+ - `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.
43
+ - `objects.difficult` — the original DOTA difficult flag (kept, not filtered).
44
+
45
+ The sample galleries below draw the derived axis-aligned `bbox` hulls.
46
+
47
+ ## License
48
+
49
+ 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.
50
+
51
+ ## Config `v1.0`
52
+
53
+ ### Example images
54
+
55
+ Boxes are colored by category: near-transparent fill, opaque outline.
56
+
57
+ <table>
58
+ <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>
59
+ <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>
60
+ </table>
61
+
62
+ ### Conversion notes
63
+
64
+ 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).
65
+
66
+ ### Splits
67
+
68
+ - train: 1411 images
69
+ - validation: 458 images
70
+
71
+ ### Categories
72
+
73
+ | id | name |
74
+ |---|---|
75
+ | 0 | plane |
76
+ | 1 | ship |
77
+ | 2 | storage-tank |
78
+ | 3 | baseball-diamond |
79
+ | 4 | tennis-court |
80
+ | 5 | basketball-court |
81
+ | 6 | ground-track-field |
82
+ | 7 | harbor |
83
+ | 8 | bridge |
84
+ | 9 | large-vehicle |
85
+ | 10 | small-vehicle |
86
+ | 11 | helicopter |
87
+ | 12 | roundabout |
88
+ | 13 | soccer-ball-field |
89
+ | 14 | swimming-pool |
90
+
91
+ ## Training with transformers
92
+
93
+ The boxes are already in the absolute-pixel COCO `[x, y, w, h]` format that
94
+ `AutoImageProcessor` expects, so fine-tuning a detector needs no bbox
95
+ conversion:
96
+
97
+ ```python
98
+ import torch
99
+ from datasets import load_dataset
100
+ from transformers import (AutoImageProcessor, AutoModelForObjectDetection,
101
+ Trainer, TrainingArguments)
102
+
103
+ ds = load_dataset("finedet/dota", "v1.0")
104
+ obj_feat = ds["train"].features["objects"]
105
+ if hasattr(obj_feat, "feature"):
106
+ obj_feat = obj_feat.feature
107
+ cat_feat = obj_feat["category"]
108
+ names = (cat_feat.feature if hasattr(cat_feat, "feature") else cat_feat).names
109
+
110
+ checkpoint = "facebook/detr-resnet-50"
111
+ processor = AutoImageProcessor.from_pretrained(checkpoint)
112
+ model = AutoModelForObjectDetection.from_pretrained(
113
+ checkpoint,
114
+ id2label=dict(enumerate(names)),
115
+ label2id={n: i for i, n in enumerate(names)},
116
+ ignore_mismatched_sizes=True,
117
+ )
118
+
119
+
120
+ def transform(batch):
121
+ images = [img.convert("RGB") for img in batch["image"]]
122
+ annotations = [
123
+ {"image_id": i,
124
+ "annotations": [
125
+ {"bbox": box, "category_id": cat, "area": box[2] * box[3], "iscrowd": 0}
126
+ for box, cat in zip(objs["bbox"], objs["category"])
127
+ ]}
128
+ for i, objs in enumerate(batch["objects"])
129
+ ]
130
+ return processor(images=images, annotations=annotations, return_tensors="pt")
131
+
132
+
133
+ def collate(batch):
134
+ return {"pixel_values": torch.stack([x["pixel_values"] for x in batch]),
135
+ "labels": [x["labels"] for x in batch]}
136
+
137
+
138
+ trainer = Trainer(
139
+ model=model,
140
+ args=TrainingArguments(output_dir="out", per_device_train_batch_size=4,
141
+ num_train_epochs=10, learning_rate=1e-5,
142
+ remove_unused_columns=False),
143
+ train_dataset=ds["train"].with_transform(transform),
144
+ data_collator=collate,
145
+ )
146
+ trainer.train()
147
+ ```