U-Net

U-Net performs semantic segmentation with an encoder, skip connections and an upsampling decoder.

Task
semantic segmentation
Installa
pip install libreyolo
Livello di supporto
Supportato, dalla v1.6.0. Modelli addestrabili di supporto: mantenuti funzionanti nella CI, ricevono nuove funzionalità quando possibile.
Licenze
Codice MIT, pesi Apache-2.0. Uso commerciale

Install

bash
pip install "libreyolo"

Predict

Python
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreUNets-sem.pt", device="cpu")result = model(SAMPLE_IMAGE) mask = result.semantic_maskprint(mask.data.shape)   # (H, W) class idsprint(mask.classes)      # sorted class ids present in the image

Weights download from Hugging Face on first use and are cached locally. LibreUNets-sem.pt is a conversion of the Cityscapes UNet-S5-D16 checkpoint from mmsegmentation: the same-padded S5-D16 graph with an FCN head, predicting the 19 Cityscapes classes. Prediction runs the whole frame on the 1024x2048 evaluation canvas.

Train

Use a semantic dataset with image/mask pairs. Training defaults to 160 epochs, batch 4 and amp=False, with a (512, 1024) crop and (1024, 2048) evaluation canvas. The loss includes an auxiliary head. Export is not supported.

Dataset setup describes the required training data.

Python
from libreyolo import LibreUNet # Random initialization: this trains from scratch.model = LibreUNet(size="s", device="cpu")# Replace with your semantic segmentation dataset YAML (image/mask pairs).model.train(data="path/to/your/semantic_dataset.yaml", pretrained=False, epochs=1, device="cpu", workers=0)

Validate

Python
from libreyolo import LibreYOLO # Or a U-Net checkpoint you trained with model.train().model = LibreYOLO("LibreUNets-sem.pt", device="cpu")# Replace with your semantic segmentation dataset YAML (image/mask pairs).metrics = model.val(data="path/to/your/semantic_dataset.yaml", workers=0)print(metrics)

Use the dataset format for this task. Validation explains the dataset requirements and returned metrics.

Checkpoints

FileLicenza dei pesi
Semantic segmentation
LibreUNets-sem.ptapache-2.0

Oggi tutti i file elencati sopra sono presenti nell<link>organizzazione LibreYOLO</link> e vengono scaricati al primo utilizzo.

Licensing

Controlla la licenza nel repository Hugging Face degli specifici pesi che scarichi. Ogni checkpoint nell<link>organizzazione LibreYOLO</link> ne include una e non è sempre la stessa per tutta la famiglia. Quel repository è la fonte autorevole; il riepilogo seguente descrive le condizioni applicabili al momento dellultima verifica di questa pagina.

Questa è una descrizione delle licenze coinvolte, non una consulenza legale. Se la risposta è importante a fini commerciali, leggi personalmente le licenze e chiedi una consulenza indipendente.

Lavoro originale
U-Net, U-Net authors
Licenza upstream
Apache-2.0
Codice LibreYOLO
MIT
Pesi
Apache-2.0, ripubblicati su huggingface.co/LibreYOLO
Interpretazione
Apache-2.0 is a permissive license, so this code and these weights can be used in commercial and closed-source products. It asks you to keep its license text and attribution notices with any copy you redistribute, and it grants a patent license. LibreYOLO's port follows mmsegmentation's Apache-2.0 UNet-S5-D16 implementation with an FCN head, and LibreUNets-sem.pt is a conversion of mmsegmentation's Cityscapes checkpoint, which upstream releases under Apache-2.0.

Verificato con LibreYOLO v1.6.0. Le tabelle di supporto, i checkpoint e i dati dei benchmark in questa pagina vengono generati dalla libreria rilasciata e dai pesi pubblicati, non scritti a mano.