paeslemesa commited on
Commit
836c702
·
verified ·
1 Parent(s): bf69a71

Update ANNOTATION_PROTOCOL.md

Browse files
Files changed (1) hide show
  1. ANNOTATION_PROTOCOL.md +16 -82
ANNOTATION_PROTOCOL.md CHANGED
@@ -29,7 +29,7 @@
29
 
30
  ### 1.1 Objective
31
 
32
- This protocol defines the procedure for annotating salient elevation keypoints on 333×333 pixel Digital Elevation Model (DEM) tiles. The annotated keypoints serve as ground truth for training and evaluating **local feature matching algorithms** — computer vision methods that detect and describe distinctive points in images (or elevation surfaces) to establish correspondences across different views, scales, or domains.
33
 
34
  ### 1.2 What to Annotate
35
 
@@ -50,11 +50,11 @@ Do **not** annotate:
50
  - Points in areas with obvious data artifacts (striping, voids, interpolation errors).
51
  - Points in water bodies (lakes, rivers) unless the shoreline intersection is clearly salient.
52
  - Points on roads, sidewalks, or other flat man-made surfaces unless they form a clear corner or edge intersection.
53
- - Points where the annotator is not fully confident about the salience.
54
 
55
  ### 1.4 Scope of Application
56
 
57
- This protocol applies to:
58
 
59
  - **GER_BN** (Bonn, Germany) — primary annotated city
60
  - **BRA_SP** (São Paulo, Brazil) — secondary annotated city
@@ -68,7 +68,6 @@ This protocol applies to:
68
 
69
  - **QGIS** ≥ 3.28 (Long Term Release)
70
  - **Python** ≥ 3.9 with `geopandas`, `rasterio`, `shapely`
71
- - Optional: **CloudCompare** for 3D point cloud cross-reference (when source LiDAR is available)
72
 
73
  ### 2.2 Required Data
74
 
@@ -76,8 +75,8 @@ For each tile to annotate:
76
 
77
  | File | Purpose |
78
  |---|---|
79
- | `{CITY_CODE}_{row}_{col}.tif` | 333×333 pixel DEM tile (Float32, NoData=-9999) |
80
- | `{CITY_CODE}_{row}_{col}_hillshade.tif` | Hillshade visualization (optional but recommended) |
81
 
82
  ### 2.3 Annotator Qualifications
83
 
@@ -107,7 +106,7 @@ All annotated keypoints belong to a **single class**:
107
 
108
  1. **Load the tile** in QGIS.
109
  2. **Verify CRS**: Ensure the project CRS matches the tile CRS (e.g., `EPSG:25832` for Bonn, `EPSG:31983` for São Paulo).
110
- 3. **Load hillshade layer** as a visual reference (optional but strongly recommended).
111
  4. **Set zoom level**: Work at a scale where individual pixels are visible but the full tile context is retained.
112
  5. **Check for artifacts**: Scan the tile for data quality issues (voids, striping, noise). Skip tiles with >20% artifact coverage.
113
 
@@ -115,38 +114,38 @@ All annotated keypoints belong to a **single class**:
115
 
116
  For each tile, follow this sequence:
117
 
118
- #### Step 1: Global Scan (30 seconds)
119
  - Pan across the entire tile at moderate zoom.
120
  - Identify the dominant features: buildings, vegetation, roads, natural terrain.
121
  - Note any artifact regions to avoid.
122
 
123
- #### Step 2: Systematic Pass (2–5 minutes)
124
  - Scan the tile in a systematic pattern (left-to-right, top-to-bottom).
125
  - For each candidate point, ask: **"Would a feature detector (SIFT, Harris, SuperPoint) reliably find this point?"**
126
  - Place the keypoint at the **precise pixel** of maximum distinctiveness.
127
  - **Only annotate if you are fully confident** in the point's salience. When in doubt, skip.
128
 
129
- #### Step 3: Verification Pass (1–2 minutes)
130
  - Toggle hillshade on/off to verify distinctiveness.
131
  - Check that no keypoints are within **5 pixels** of the tile edge.
132
  - Verify that keypoints are not clustered — minimum spacing of **5 pixels** between any two keypoints.
133
  - Review each point: **"If I saw this tile again tomorrow, would I place the point at the same pixel?"**
134
 
135
  #### Step 4: Save
136
- - Save the QGIS project with the annotation layer.
137
  - Export the annotation layer as a **shapefile** or **GeoPackage**.
138
 
139
  ### 4.3 Post-Processing
140
 
141
- After annotation, run the MatchGeo conversion script to transform the shapefile into the standardized JSON annotation format:
142
 
143
- ```bash
144
- python scripts/convert_shapefile_to_json.py --input annotations/GER_BN_001_012.shp --tile data/GER_BN/tiles/GER_BN_001_012.tif --output data/GER_BN/annotations/GER_BN_001_012_annotation.json
145
  ```
146
 
147
  The script will:
148
  1. Read the shapefile points.
149
- 2. Convert geographic coordinates to pixel coordinates (0–332).
150
  3. Extract elevation values from the DEM tile.
151
  4. Generate the TDML-compliant JSON file.
152
 
@@ -191,7 +190,7 @@ In natural terrain (if annotated in future cities), salient points include:
191
  - **Ridge/valley junctions**: Confluences of multiple ridge or valley lines.
192
  - **Cliff corners**: Abrupt changes in slope direction.
193
 
194
- When in doubt, apply the **feature detector test**: *"Would SIFT or Harris detect this point with a high response?"*
195
 
196
  ### 5.6 Multi-Scale Considerations
197
 
@@ -217,22 +216,8 @@ Before submitting annotations, the annotator must complete this checklist:
217
  - [ ] The annotation shapefile has been exported and converted to JSON.
218
  - [ ] The JSON file validates against the MatchGeo Annotation Schema.
219
 
220
- ### 6.2 Automated Validation
221
-
222
- After conversion to JSON, run the validation script:
223
-
224
- ```bash
225
- python scripts/validate_annotations.py --input data/GER_BN/annotations/GER_BN_001_012_annotation.json --tile data/GER_BN/tiles/GER_BN_001_012.tif
226
- ```
227
 
228
- The script checks:
229
- - All keypoints are within the tile bounds.
230
- - No two keypoints are within 5 pixels.
231
- - All keypoints are ≥5 pixels from the edge.
232
- - Elevation values are valid (not NoData).
233
- - JSON structure conforms to the schema.
234
-
235
- ### 6.3 Confidence Policy
236
 
237
  All annotated keypoints are assumed to have **high confidence** (≥0.8). The annotator is instructed to:
238
 
@@ -383,56 +368,5 @@ Each annotation file conforms to the MatchGeo Keypoint Annotation Schema:
383
 
384
  ---
385
 
386
- ## Appendix A: Visual Example
387
-
388
- ### GER_BN_001_012 — Urban Building Corners
389
-
390
- This example from Bonn, Germany, demonstrates the annotation of building corners on a 1.0 m resolution airborne LiDAR DEM.
391
-
392
- | Panel | Description |
393
- |---|---|
394
- | **A. DEM (Grayscale Elevation)** | Raw elevation values. Brighter = higher. Building roofs appear as bright rectangles; shadows and lower areas appear darker. |
395
- | **B. Hillshade (Relief Visualization)** | Simulated illumination from the northwest. Building edges and corners are clearly visible as sharp light-dark transitions. |
396
- | **C. DEM Zoom (Data Region)** | Close-up of the right half of the tile. Seven keypoints (kp_0–kp_6) are annotated on building corners. |
397
- | **D. Hillshade Zoom (Data Region)** | Hillshade close-up confirms that all keypoints are on sharp, salient corners. |
398
-
399
- ![GER_BN_001_012 Annotated](GER_BN_001_012_annotated.png)
400
-
401
- **Keypoint Analysis**:
402
-
403
- | ID | pixelX | pixelY | Description |
404
- |---|---|---|---|
405
- | kp_0 | 376 | 282 | Corner of rectangular building roof — sharp intersection of two edges |
406
- | kp_1 | 368 | 292 | Adjacent corner of same building complex — distinct from kp_0 by ≥5 px |
407
- | kp_2 | 362 | 287 | Corner of smaller structure — clear edge intersection |
408
- | kp_3 | 384 | 259 | Corner of large rectangular building — prominent, high-contrast corner |
409
- | kp_4 | 384 | 29 | Corner near top edge of tile — still ≥5 px from boundary |
410
- | kp_5 | 371 | 41 | Corner of building near tile top — distinct from kp_4 |
411
- | kp_6 | 398 | 63 | Corner at right edge of tile — placed at the last valid pixel before boundary |
412
-
413
- **Observations**:
414
- - All 7 keypoints are on **building corners** — intersections of roof edges.
415
- - Minimum spacing between any two keypoints: ~8 pixels (kp_0–kp_1), satisfying the ≥5 px rule.
416
- - All keypoints are ≥5 pixels from the tile boundary, except kp_6 which is at the right edge. In production, this point should be verified to be ≥5 px from the actual data boundary (the image shows a black/gray padding region on the left).
417
- - The hillshade confirms that each point is at a sharp, salient corner with high local contrast.
418
-
419
- ---
420
-
421
- ## Appendix B: Glossary
422
-
423
- | Term | Definition |
424
- |---|---|
425
- | **DEM** | Digital Elevation Model — a raster representation of terrain surface elevation. |
426
- | **DSM** | Digital Surface Model — a DEM that includes surface features (buildings, vegetation). MatchGeo uses DSMs. |
427
- | **Feature descriptor** | A mathematical representation of a local image (or elevation) patch, used for matching. Examples: SIFT, SURF, ORB, SuperPoint. |
428
- | **Feature matching** | The process of finding correspondences between feature descriptors in two or more images (or DEM patches). |
429
- | **GSD** | Ground Sample Distance — the physical distance on the ground represented by one pixel. |
430
- | **Hillshade** | A grayscale visualization of a DEM simulating illumination from a light source, emphasizing terrain relief. |
431
- | **Keypoint** | A salient, locally distinctive point in an image or elevation surface. Also called "interest point" or "feature point." |
432
- | **NoData** | A special value (-9999.0 in MatchGeo) indicating missing or invalid data. |
433
- | **Salient** | Visually or geometrically distinctive; standing out from the immediate surroundings. |
434
- | **W3C PROV-O** | The W3C Provenance Ontology — a standard for representing provenance information. |
435
-
436
- ---
437
 
438
  *Protocol version 1.1 — MatchGeo DEM Annotation. For questions, contact sabrina.correa@ufv.br*
 
29
 
30
  ### 1.1 Objective
31
 
32
+ This protocol defines the procedure for annotating salient elevation keypoints on 256x256 pixel Digital Elevation Model (DEM) tiles. The annotated keypoints serve as ground truth for training and evaluating **local feature matching algorithms** — computer vision methods that detect and describe distinctive points in images (or elevation surfaces) to establish correspondences across different views, scales, or domains.
33
 
34
  ### 1.2 What to Annotate
35
 
 
50
  - Points in areas with obvious data artifacts (striping, voids, interpolation errors).
51
  - Points in water bodies (lakes, rivers) unless the shoreline intersection is clearly salient.
52
  - Points on roads, sidewalks, or other flat man-made surfaces unless they form a clear corner or edge intersection.
53
+ - **Points where the annotator is not fully confident about the salience.**
54
 
55
  ### 1.4 Scope of Application
56
 
57
+ This protocol applies, but not limited to:
58
 
59
  - **GER_BN** (Bonn, Germany) — primary annotated city
60
  - **BRA_SP** (São Paulo, Brazil) — secondary annotated city
 
68
 
69
  - **QGIS** ≥ 3.28 (Long Term Release)
70
  - **Python** ≥ 3.9 with `geopandas`, `rasterio`, `shapely`
 
71
 
72
  ### 2.2 Required Data
73
 
 
75
 
76
  | File | Purpose |
77
  |---|---|
78
+ | `{CITY_CODE}_{row}_{col}.tif` | 256x256 pixel DEM tile (Float32, NoData=-9999) |
79
+
80
 
81
  ### 2.3 Annotator Qualifications
82
 
 
106
 
107
  1. **Load the tile** in QGIS.
108
  2. **Verify CRS**: Ensure the project CRS matches the tile CRS (e.g., `EPSG:25832` for Bonn, `EPSG:31983` for São Paulo).
109
+ 3. **Chenge visualization to hillshade** as a visual reference (optional but strongly recommended).
110
  4. **Set zoom level**: Work at a scale where individual pixels are visible but the full tile context is retained.
111
  5. **Check for artifacts**: Scan the tile for data quality issues (voids, striping, noise). Skip tiles with >20% artifact coverage.
112
 
 
114
 
115
  For each tile, follow this sequence:
116
 
117
+ #### Step 1: Global Scan
118
  - Pan across the entire tile at moderate zoom.
119
  - Identify the dominant features: buildings, vegetation, roads, natural terrain.
120
  - Note any artifact regions to avoid.
121
 
122
+ #### Step 2: Systematic Pass
123
  - Scan the tile in a systematic pattern (left-to-right, top-to-bottom).
124
  - For each candidate point, ask: **"Would a feature detector (SIFT, Harris, SuperPoint) reliably find this point?"**
125
  - Place the keypoint at the **precise pixel** of maximum distinctiveness.
126
  - **Only annotate if you are fully confident** in the point's salience. When in doubt, skip.
127
 
128
+ #### Step 3: Verification Pass
129
  - Toggle hillshade on/off to verify distinctiveness.
130
  - Check that no keypoints are within **5 pixels** of the tile edge.
131
  - Verify that keypoints are not clustered — minimum spacing of **5 pixels** between any two keypoints.
132
  - Review each point: **"If I saw this tile again tomorrow, would I place the point at the same pixel?"**
133
 
134
  #### Step 4: Save
135
+ - Save the QGIS project with the annotation shapefile layer.
136
  - Export the annotation layer as a **shapefile** or **GeoPackage**.
137
 
138
  ### 4.3 Post-Processing
139
 
140
+ After annotation, run the MatchGeo conversion script to transform the shapefile into the standardized JSON annotation format. The conversion file is in:
141
 
142
+ ```
143
+ scripts/convert_shp2anno.py
144
  ```
145
 
146
  The script will:
147
  1. Read the shapefile points.
148
+ 2. Convert geographic coordinates to pixel coordinates (0–255).
149
  3. Extract elevation values from the DEM tile.
150
  4. Generate the TDML-compliant JSON file.
151
 
 
190
  - **Ridge/valley junctions**: Confluences of multiple ridge or valley lines.
191
  - **Cliff corners**: Abrupt changes in slope direction.
192
 
193
+ When in doubt, apply the **feature detector test**: *"Would I select this point tomorrow?"*
194
 
195
  ### 5.6 Multi-Scale Considerations
196
 
 
216
  - [ ] The annotation shapefile has been exported and converted to JSON.
217
  - [ ] The JSON file validates against the MatchGeo Annotation Schema.
218
 
 
 
 
 
 
 
 
219
 
220
+ ### 6.2 Confidence Policy
 
 
 
 
 
 
 
221
 
222
  All annotated keypoints are assumed to have **high confidence** (≥0.8). The annotator is instructed to:
223
 
 
368
 
369
  ---
370
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
371
 
372
  *Protocol version 1.1 — MatchGeo DEM Annotation. For questions, contact sabrina.correa@ufv.br*