U-Net

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

작업
semantic segmentation
설치
pip install libreyolo
지원 티어
지원, v1.6.0부터 지원. 보조 학습 가능 모델입니다. CI 통과 상태를 유지하며 기능은 여건에 따라 추가됩니다.
라이선스
코드 MIT, 가중치 Apache-2.0. 상업적 사용

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

파일가중치 라이선스
Semantic segmentation
LibreUNets-sem.ptapache-2.0

위의 모든 파일은 현재 LibreYOLO 조직에 있으며 처음 사용할 때 내려받습니다.

Licensing

내려받는 특정 가중치의 Hugging Face 저장소에서 라이선스를 확인하십시오. LibreYOLO 조직의 모든 체크포인트에는 라이선스가 있으며 한 계열 안에서도 항상 같지는 않습니다. 해당 저장소가 신뢰할 수 있는 기준입니다. 아래 요약은 이 페이지를 마지막으로 검증했을 때 적용된 내용을 설명합니다.

관련 라이선스에 관한 설명이며 법률 자문이 아닙니다. 상업적으로 중요한 사안이라면 라이선스를 직접 읽고 별도의 법률 자문을 받으십시오.

원작
U-Net, U-Net authors
업스트림 라이선스
Apache-2.0
LibreYOLO 코드
MIT
가중치
Apache-2.0, huggingface.co/LibreYOLO에 다시 게시됨
해석
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.

LibreYOLO v1.6.0에서 검증되었습니다. 이 페이지의 지원 표, 체크포인트, 벤치마크 수치는 출시된 라이브러리와 공개된 가중치에서 생성되며 수동으로 작성되지 않습니다.