/ Модель

Характеристики

Лицензия
MIT
Архитектура
segformer · dense
Библиотека
transformers
Опубликована
22 апр 2026

segformer-b0-road-scene-7class

Сегментация изображенийИзображение → mask3 профессии

SegFormer-B0 сегментирует дорожные фотографии на семь классов игровых элементов для извлечения игровых ресурсов.

157скачиваний за 30 дней1лайквеса обновлены26 апр 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Marco333 разработал SegFormer-B0, дообученную модель семантической сегментации дорожных сцен на основе Cityscapes. Она использует энкодер Mix Transformer и MLP-декодер, содержит 3,7 млн параметров и делит изображение на семь классов игровых элементов: дорогу, тротуар и прочие наземные поверхности, здания и другие вертикальные структуры, растительность, небо, транспорт и придорожные объекты. Входное RGB-изображение приводится к размеру 512×512; модель выдаёт карту классов для каждого пикселя.

Модель предназначена для конвейера извлечения игровых ресурсов из фотографий улиц: маска дороги помогает определить её границы, а маски неба, растительности и зданий — выделить фоновые элементы и заготовки для спрайтов. Объединение некоторых классов соответствует игровому использованию результатов, где, например, разные автомобили считаются одним типом препятствия. Репозиторий содержит веса в формате safetensors, библиотека для работы — Transformers; лицензия — MIT.

Обучение проводилось на городских сценах Cityscapes из 50 европейских городов. Класс придорожных объектов распознаётся хуже остальных, особенно тонкие объекты вроде столбов и знаков; автор предусматривает для них запасные спрайты. На сельских дорогах, автомагистралях без тротуаров и сценах с другими стилями разметки качество может снизиться. Модель не подходит для критически важных систем автономного вождения, поскольку её таксономия намеренно объединяет детали, значимые для безопасности.

Сценарии применения

  • выделение маски дороги для определения её границ
  • извлечение полосы неба из фотографии улицы
  • создание масок растительности для подготовки спрайтов деревьев
  • выделение силуэтов зданий для фоновой игровой геометрии
  • разделение дороги и тротуара для раздельной выборки текстур и цветов
  • обнаружение транспорта и придорожных объектов для игровых сцен

Ограничения

Модель обучена на европейских городских сценах Cityscapes, поэтому качество может снижаться на сельских дорогах, автомагистралях без тротуаров и сценах с иными стилями дорог. Тонкие придорожные объекты распознаются хуже; объединённая таксономия не подходит для систем автономного вождения.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

SegFormer-B0 — Road Scene Segmentation (7 Game-Asset Classes)

A SegFormer-B0 model fine-tuned on Cityscapes for 7-class semantic segmentation of road scenes. This model uses a purpose-built taxonomy where every class maps directly to a game element — road texture, sky backdrop, tree sprites, building silhouettes, etc.

ArchitectureSegFormer-B0 (Mix Transformer encoder + all-MLP decoder)
Parameters3.7 M
InputRGB image, any resolution (resized to 512×512)
Output7-class pixel mask (upsampled to input resolution at inference)
Best val mIoU≥ 84.0 %
FormatSafeTensors (14.2 MB)

7-Class Game Taxonomy

IDClassIoUGame Function
0road97.5 %Driving surface — grey asphalt texture sampling
1sidewalk80.3 %Ground-level non-road surfaces (sidewalk, terrain)
2building88.1 %Background vertical structures — building silhouettes
3vegetation89.1 %Tall greenery — tree sprite extraction
4sky92.2 %Sky band — direct crop for game background
5vehicle87.8 %Road obstacles
6roadside_object52.7 %Thin vertical roadside elements (poles, signs, people)

Key design decisions

  • Road ↔ sidewalk kept separate so road color sampling produces pure grey asphalt without contamination from sidewalk / terrain tones.
  • Terrain grouped with sidewalk, not vegetation — ground-level grass strips serve the same game function as sidewalk.
  • All building-like structures merged (building, wall, fence) — the game treats them identically as background geometry.
  • All vehicle types merged — the game treats every vehicle as a road obstacle.
  • Roadside objects (poles, traffic lights, signs, persons, riders) are grouped into a single thin-element class with fallback stock sprites when extraction quality is low.

Usage

from transformers import SegformerImageProcessor, SegformerForSemanticSegmentation
from PIL import Image
import torch
import torch.nn.functional as F

processor = SegformerImageProcessor.from_pretrained("Marco333/segformer-b0-road-scene-7class")
model = SegformerForSemanticSegmentation.from_pretrained("Marco333/segformer-b0-road-scene-7class")

image = Image.open("road_photo.jpg")
inputs = processor(images=image, return_tensors="pt")

with torch.no_grad():
    outputs = model(**inputs)

# Upsample logits to original image size
mask = F.interpolate(
    outputs.logits,
    size=image.size[::-1],  # (H, W)
    mode="bilinear",
    align_corners=False,
).argmax(dim=1)[0]

# mask values: 0=road, 1=sidewalk, 2=building, 3=vegetation, 4=sky, 5=vehicle, 6=roadside_object

Training Details

Dataset

Chris1/cityscapes_segmentation — urban street scenes from 50 European cities.

SplitImages
Train2,975
Val500

The original Cityscapes masks use label IDs 0–33 stored as 3-channel RGB images. A custom preprocessing pipeline extracts channel 0 and applies a 256-element lookup table to remap all 34 Cityscapes classes into the 7-class game taxonomy in a single vectorized operation (unmapped classes → 255 = ignore).

Hyperparameters

ParameterValue
Base weightsnvidia/segformer-b0-finetuned-ade-512-512 (encoder only)
OptimizerAdamW
Learning rate6 × 10⁻⁵
LR schedulePolynomial decay
Warmup10 % of total steps
Weight decay0.01
Effective batch size8 (4 × device · 2 grad accum)
Training resolution512 × 512
PrecisionFP16 mixed precision
Epochs50
AugmentationColorJitter (brightness=0.25, contrast=0.25, saturation=0.25, hue=0.1) — train only
Best-model selectionHighest mean IoU on validation set (load_best_model_at_end=True)
HardwareNVIDIA T4 (16 GB VRAM)

Training Curve

EpochmIoURoadSidewalkBuildingVegetationSkyVehicleRoadside Obj
159.5 %93.2 %54.6 %74.3 %73.7 %56.9 %63.9 %0.0 %
373.8 %95.4 %69.4 %82.7 %82.5 %84.3 %79.4 %23.1 %
580.4 %96.7 %76.5 %86.2 %87.0 %88.9 %84.3 %43.2 %
982.9 %97.4 %79.2 %87.5 %88.3 %91.0 %86.7 %50.4 %
1684.0 %97.5 %80.3 %88.1 %89.1 %92.2 %87.8 %52.7 %

The model converges quickly thanks to transfer learning — the pretrained encoder already understands road scene features; only the 7-class decoder head is learned from scratch.

Implementation Notes

Several non-obvious flags are required for correct training:

  • ignore_mismatched_sizes=True — the pretrained decoder head has a different number of output classes.
  • remove_unused_columns=False — prevents the Trainer from dropping image data columns.
  • label_names=["labels"] — tells the Trainer which key holds the segmentation targets.
  • do_reduce_labels=False — Cityscapes labels don't need ADE20K-style background subtraction.
  • Logit upsampling in compute_metrics — SegFormer outputs at ¼ resolution; logits must be upsampled before comparison with ground-truth masks.

Intended Use

This model is designed for a game asset extraction pipeline where a user uploads a road photograph and the runtime transforms it into game elements:

  1. Road shape — fit road boundaries from the road mask; derive perspective and horizon.
  2. Color palette — sample dominant colors from each masked region of the original image.
  3. Sky — crop the sky band directly using the sky mask.
  4. Tree sprites — blob detection on the vegetation mask; crop with alpha transparency.
  5. Building silhouettes — extract from the building mask for background geometry.
  6. Fallback system — when extraction quality is poor for any element, use palette-matched stock assets.

Limitations

  • Trained exclusively on European urban street scenes (Cityscapes). Performance may degrade on rural roads, highways without sidewalks, non-European road styles, or indoor scenes.
  • roadside_object class (52.7 % IoU) is the weakest — thin elements like poles and signs are inherently difficult at 512×512 resolution. The intended runtime uses fallback sprites for this class.
  • Not suitable for safety-critical autonomous driving — the merged taxonomy intentionally discards distinctions (truck vs. car, wall vs. fence) that matter for driving but not for game art.

Citation

Please cite this model if you use it:

@misc{corbetta_segformer_road_scene_7class_2026,
  author       = {Marco Corbetta},
  title        = {segformer-b0-road-scene-7class: SegFormer-B0 fine-tuned on Cityscapes for 7-class game-asset segmentation},
  year         = {2026},
  publisher    = {Hugging Face},
  howpublished = {\url{https://huggingface.co/Marco333/segformer-b0-road-scene-7class}}
}

SegFormer:

@inproceedings{xie2021segformer,
  title={SegFormer: Simple and Efficient Design for Semantic Segmentation with Transformers},
  author={Xie, Enze and Wang, Wenhai and Yu, Zhiding and Anandkumar, Anima and Alvarez, Jose M and Luo, Ping},
  booktitle={NeurIPS},
  year={2021}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · transformers · image-segmentation

Можно запустить

Подбираем GPU…

Класс архитектуры
SegformerForSemanticSegmentation
Ревизия весов
91bff6b

0 моделей