georas2vec-model / README.md
PerfectWin's picture
Card v0.7: realistic naming results, new files
310857f verified
|
Raw History Blame Contribute Delete
6.07 kB
---
license: cc-by-sa-4.0
library_name: pytorch
pipeline_tag: image-segmentation
datasets:
- PerfectWin/georas2vec
tags:
- geology
- geological-map
- vectorization
- instance-segmentation
- gis
- qgis
---
# GeoRas2Vec model – scanned geological map → GIS polygons, faults and unit names
**Research preview (v0.7).** **Code, installation and documentation: [GeoRas2Vec on GitHub](https://github.com/PerfectWin7777/georas2vec).**
GeoRas2Vec turns a scanned or rasterised geological map into a GeoPackage that opens directly in QGIS or ArcGIS. The GeoPackage holds three things:
- a polygon layer of geological units, with code, name, age and lithology when they can be read;
- a line layer of faults;
- the legend table, with default QGIS styles.
Unit names come **only from text printed on the map and from its legend**.
This repository holds the model files. The command-line tool downloads them automatically.
![Real scanned maps](https://huggingface.co/PerfectWin/georas2vec-model/resolve/main/figures/results_real_scans.png)
## Files
| file | role |
|---|---|
| `best_fp16.pt` | segmentation network (U-Net++ / EfficientNet-B4, RGB + Lab): 10 pixel affinities + fault map |
| `naming_model.pkl` | scores (text read on the map, polygon) pairs |
| `legend_ranker.pkl` | ranks the candidate codes of each polygon (text evidence, leader lines, legend swatch) |
| `prop_model.pkl` | decides when a code read on the map can be propagated to polygons of the same colour |
| `code_reader.pt` | reader of geological unit codes (Є, Ʀ, superscripts, small capitals, offshore `*`) |
| `swatch_enc.pt` | learned legend-swatch / polygon comparator (colour + pattern) |
| `legend_ranker_sw.pkl` | naming ranker trained with real printed legends (used by v0.7) |
| `water_model.pkl` | recognises water / outside-the-map regions |
| `exemple/` | example output GeoPackage, legend CSV, QGIS render |
| `training/` | training curves and metrics of the network |
The `.pkl` files are scikit-learn pickles: only load files from this repository.
## Usage
```bash
git clone https://github.com/PerfectWin7777/georas2vec.git && cd georas2vec
pip install -r requirements.txt
python scripts/vectorize.py my_map.tif my_legend.csv my_map.gpkg
```
See the [GitHub README](https://github.com/PerfectWin7777/georas2vec#quick-start) for the legend CSV format.
## Results (never seen during training)
![Official test split](https://huggingface.co/PerfectWin/georas2vec-model/resolve/main/figures/results_test_scores.png)
| official test split | large units | small units | map area in the correct polygon |
|---|---|---|---|
| real scans (78 tiles, USGS GMNA 300 dpi) | **94.5 %** | **77.0 %** | **98.5 %** |
| synthetic maps, 4 continents (60 tiles) | 85.2 % | 73.6 % | 90.4 % |
Faults: line-level F1 at 2 px is **0.80** on the real-scan test split and **0.85** on a held-out region.
![Four continents](https://huggingface.co/PerfectWin/georas2vec-model/resolve/main/figures/results_continents.png)
### Names
End to end on a held-out 6144 × 6144 px region of the GMNA north sheet. Polygons and names are both predicted.
The ranker and the propagation model were trained without this region.
| | area named | names correct | area correctly named |
|---|---|---|---|
| names from text only | 65.9 % | 94.1 % | 62.0 % |
| **+ colour propagation** | **74.7 %** | **93.7 %** | **69.9 %** |
> **Idealised legend.** The table above uses legend colours measured on the scan itself (close to a perfect legend).
**Realistic setting (v0.7)**: printed legend read automatically (swatches + codes), polygons predicted, 4 held-out zones
of the southern sheet, models trained on the northern sheet only.
| | text + legend | + colour propagation | names correct |
|---|---|---|---|
| real legend, colour signatures only | 17.2 % | 23.6 % | 90.1 % |
| **real legend + learned swatch comparator (v0.7)** | **31.8 %** | **37.5 %** | **87.6 %** |
![Names](https://huggingface.co/PerfectWin/georas2vec-model/resolve/main/figures/naming_region.png)
## How it works
![Geometry](https://huggingface.co/PerfectWin/georas2vec-model/resolve/main/figures/method_geometry.png)
![Names](https://huggingface.co/PerfectWin/georas2vec-model/resolve/main/figures/method_naming.png)
## Limitations
* A unit whose code is never printed (or never readable) stays *Unité non identifiée*, with 3 suggestions.
* Sibling units with almost identical colours (e.g. `lK` / `K`) cause most propagation errors.
* Real-scan validation is so far on the USGS Geologic Map of North America. The other continents are evaluated
on realistic renderings of official vector maps.
* On sea and ice areas the map prints many texts that are not the unit's code: there GeoRas2Vec gives the right code as first suggestion instead of guessing.
* On large maps, unnamed areas can show straight cuts at the 2048 px block edges.
## Versions
| version | change |
|---|---|
| **v0.7** | automatic legend reading (swatch boxes + codes), geological code reader (56/60 real legend boxes vs 26/60 with generic OCR), learned swatch comparator, ranker trained with real printed legends |
| v0.6 | English attribute table by default (`--lang fr` for French), age shown once, fragments < 200 px merged into their neighbours (3× fewer polygons), no colour propagation onto white paper / ice |
| v0.5 | two-scale mutex watershed; fault lines split at junctions; topological contours (no gap, no overlap); water detection; OCR restricted to the legend alphabet; decoding of age prefixes, Ʀ, Є and superscripts; colour propagation over the whole map; block processing of large maps |
| v0.2 | first public release (`revision="v0.2"`) |
The repository was renamed from `PerfectWin/geocarto-model` to `PerfectWin/georas2vec-model` (old links redirect).
## Citation
Winter Tony, *GeoRas2Vec: from scanned geological maps to vector units, faults and names*, 2026 –
[GitHub](https://github.com/PerfectWin7777/georas2vec). Please also cite the data sources listed in the [dataset card](https://huggingface.co/datasets/PerfectWin/georas2vec).