File size: 5,693 Bytes
aeef85f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | ---
license: cc-by-nc-4.0
library_name: onnx
pipeline_tag: image-segmentation
pretty_name: "PG-Pathformer"
datasets:
- pictograph/sidewalks-1k
tags:
- computer-vision
- onnx
- image-segmentation
- segformer
- pictograph
model-index:
- name: "PG-Pathformer"
results:
- task:
type: image-segmentation
dataset:
type: "pictograph/sidewalks-1k"
name: "Sidewalks-1k"
metrics:
- type: "mIoU"
value: 0.3985
name: "mIoU"
- type: "pixel_accuracy"
value: 0.8353
name: "Pixel accuracy"
- type: "dice"
value: 0.4929
name: "Dice"
---
[](https://pictograph.io/models/pictograph-research/pg-pathformer)
[](https://pictograph.io/models/pictograph-research/pg-pathformer)    [](https://creativecommons.org/licenses/by-nc/4.0/)
**[View on Pictograph](https://pictograph.io/models/pictograph-research/pg-pathformer)** 路 [Pictograph Research](https://pictograph.io/org/pictograph-research) 路 Semantic Segmentation 路 Segformer 路 FP32 路 [Creative Commons Attribution-NonCommercial 4.0](https://creativecommons.org/licenses/by-nc/4.0/)
## Overview
This is a semantic segmentation model built on **Segformer**, trained on the [Sidewalks-1k](https://huggingface.co/datasets/pictograph/sidewalks-1k) dataset. It expects **672x576** input and runs in FP32 precision. The ONNX weights are in this repo; run them with the Pictograph SDK (below) or [open the model on Pictograph](https://pictograph.io/models/pictograph-research/pg-pathformer) to test it in-browser, call the hosted API, or deploy it as an always-on endpoint.
## Performance
Headline: **39.9% mIoU**.
| Metric | Value |
| :--- | ---: |
| mIoU | 39.9% |
| Pixel accuracy | 83.5% |
| Dice | 49.3% |
## Classes
Class index matches the model's output order.
| # | Class |
| ---: | :--- |
| 0 | flat-road |
| 1 | flat-sidewalk |
| 2 | flat-crosswalk |
| 3 | flat-cyclinglane |
| 4 | flat-parkingdriveway |
| 5 | flat-curb |
| 6 | human-person |
| 7 | human-rider |
| 8 | vehicle-car |
| 9 | vehicle-truck |
| 10 | vehicle-bus |
| 11 | vehicle-tramtrain |
| 12 | vehicle-motorcycle |
| 13 | vehicle-bicycle |
| 14 | vehicle-caravan |
| 15 | vehicle-cartrailer |
| 16 | construction-building |
| 17 | construction-door |
| 18 | construction-wall |
| 19 | construction-fenceguardrail |
| 20 | construction-bridge |
| 21 | construction-stairs |
| 22 | object-pole |
| 23 | object-trafficsign |
| 24 | object-trafficlight |
| 25 | nature-vegetation |
| 26 | nature-terrain |
| 27 | sky |
| 28 | void-ground |
| 29 | void-dynamic |
| 30 | void-static |
| 31 | void-unclear |
## Training
| Setting | Value |
| :--- | :--- |
| Base dataset | [Sidewalks-1k](https://huggingface.co/datasets/pictograph/sidewalks-1k) |
| Dataset size | 1,000 images |
| Input size | 672x576 |
| Epochs | 35 |
| Batch size | 24 |
| Learning rate | 0.0001 |
| Precision | FP32 |
| Version | 1.0.0 |
## Use this model
The weights ship as ONNX (`pg-pathformer.onnx`) with a `config.json`. The Pictograph SDK applies the model's exact pre/post-processing for you:
### [Pictograph SDK](https://pictograph.io/docs)
```bash
pip install "pictograph[inference]"
```
```python
from huggingface_hub import hf_hub_download
from pictograph import load_model, SemanticSegmentationModel
onnx = hf_hub_download("pictograph/pg-pathformer", "pg-pathformer.onnx")
config = hf_hub_download("pictograph/pg-pathformer", "config.json")
model: SemanticSegmentationModel = load_model(onnx, config, task="semantic_segmentation")
result = model.predict("scene.jpg") # SemanticSegmentationResult: per-class regions
for p in result.predictions:
print(f"{p.name} region {len(p.polygon.paths[0])} pts")
```
**Example output** (illustrative; your exact values depend on the image):
```text
flat-road region 86 pts
flat-sidewalk region 34 pts
```
<details>
<summary><b>Raw ONNX Runtime</b> (no SDK)</summary>
```python
from huggingface_hub import hf_hub_download
import onnxruntime as ort
onnx = hf_hub_download("pictograph/pg-pathformer", "pg-pathformer.onnx")
sess = ort.InferenceSession(onnx, providers=["CPUExecutionProvider"])
inp = sess.get_inputs()[0]
print(inp.name, inp.shape) # NCHW float32; input size + normalization in config.json
# outputs = sess.run(None, {inp.name: preprocessed_batch})
# Decoding is architecture-specific; the Pictograph SDK (above) does it for you.
```
</details>
- Test it in-browser, call the hosted API, or deploy an endpoint: [open the model on Pictograph](https://pictograph.io/models/pictograph-research/pg-pathformer).
- SDK + local inference guide: [docs](https://pictograph.io/docs/local-inference).
## License
Released under [Creative Commons Attribution-NonCommercial 4.0](https://creativecommons.org/licenses/by-nc/4.0/), the license of its training data, [sidewalk-semantic (Segments.ai)](https://huggingface.co/datasets/segments/sidewalk-semantic). Non-commercial use only: when you use this model, please credit **Segments.ai (2021)**.
---
*Trained and published with [Pictograph](https://pictograph.io/models/pictograph-research/pg-pathformer) - annotate, train, and deploy from one API.*
|