Downloads · 30 days
0
primus29/crackseg
crackseg is a image segmentation model from primus29. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Fine-tuned CLIPSeg for pixel-wise surface crack detection. Given an image of any surface, the model returns a binary segmentation mask highlighting crack regions.
Downloads · 30 days
0
Access
Public
Updated Jun 5, 2026
Repo size
612 MB
Likes
0
Public
Click a slice to open those files.
.pth612 MB · 100%
From the Hugging Face model README
Fine-tuned CLIPSeg for pixel-wise surface crack detection. Given an image of any surface, the model returns a binary segmentation mask highlighting crack regions.
| Metric | Score |
|---|---|
| Dice Score | 0.612 |
| mIoU | 0.716 |
Try it on HuggingFace Spaces.
import torch
from huggingface_hub import hf_hub_download
from transformers import AutoProcessor, CLIPSegForImageSegmentation
from PIL import Image
processor = AutoProcessor.from_pretrained("CIDAS/clipseg-rd64-refined")
model = CLIPSegForImageSegmentation.from_pretrained("CIDAS/clipseg-rd64-refined")
path = hf_hub_download(repo_id="primus29/crackseg", filename="best_model.pth")
checkpoint = torch.load(path, map_location="cpu", weights_only=False)
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
image = Image.open("your_image.jpg")
inputs = processor(text="segment crack", images=image, return_tensors="pt", padding=True)
with torch.no_grad():
outputs = model(**inputs)
mask = torch.sigmoid(outputs.logits).squeeze()
mask = (mask > 0.5).float()