Thaki-FacilityVision-CrackCls-ResNet18
🇰🇷 한êµì–´ 카드: MODEL_CARD.ko.md
A ResNet-18 that says whether a small patch of concrete surface contains a crack. It is meant to run over patches cut from a larger photo, as a fast first filter before a segmentation model.
Status: research preview. The test score is close to perfect, but train, dev and test all come from one public dataset of very similar patches. Read the score as "fits this dataset", not as field accuracy.
0. How to use
from huggingface_hub import snapshot_download
import sys
path = snapshot_download("ThakiCloud/Thaki-FacilityVision-CrackCls-ResNet18")
sys.path.insert(0, path)
from crackcls import CrackCls
m = CrackCls(path)
p, is_crack = m.predict("patch.jpg") # one image
ps, ys = m.predict(["a.jpg", "b.jpg", "c.jpg"]) # a batch
Command line: python crackcls.py a.jpg b.jpg.
| Step | Value |
|---|---|
| Input | RGB patch. Training patches are 227 × 227 |
| Resize | short side → 224, bilinear (torchvision.transforms.Resize(224)) |
| Normalise | ImageNet mean [0.485, 0.456, 0.406], std [0.229, 0.224, 0.225] |
| Output | softmax over [no_crack, crack]; crack if p_crack ≥ 0.5 |
1. Results
Split: index blocks of 200 per class, grouped 60/20/20 (seed 42). Then every dev/test patch with a pixel-confirmed near-duplicate in an earlier split was removed (1,088 from dev, 2,476 from test). The model was picked on dev; test was scored once.
| Model (test, n = 5,524, 2,688 crack) | Macro F1 | Crack recall | Crack precision | False-alarm rate |
|---|---|---|---|---|
| Small CNN baseline | 0.9864 | 0.9781 | 0.9940 | 0.56% |
| ResNet-18 linear probe | 0.9955 | 0.9940 | 0.9966 | 0.32% |
| This model (full fine-tune) | 0.9993 | 0.9993 | 0.9993 | 0.07% |
Test confusion: 2 false alarms, 2 missed cracks. Paired bootstrap Δ macro F1 vs the linear probe (best baseline on dev): +0.0038, 95% CI [+0.0020, +0.0058]. Dev macro F1 0.9991.
Cost: CPU 4 threads, batch 1, p50 12.3 ms per patch. One B200, batch 64: about 24,800 patches/s at 1.8 GB peak memory.
2. Limitations
- Generalisation is unmeasured. Every split is from the same dataset (one campus's buildings, similar lighting and texture). There is no cross-dataset or field evaluation. Expect a large drop on other surfaces, cameras, stains, shadows or joints that resemble cracks.
- Near-duplicate purging reduces leakage but cannot remove the shared source. Neighbouring crops from the same wall may still sit in different splits.
- Patch classifier only: it does not locate or measure a crack. For pixel masks see Thaki-FacilityVision-CrackSeg-E2.
- Not an inspection-certified tool and not a structural-safety judgement.
3. Data and licences
- Training data: Concrete Crack Images for Classification, Ç. F. Özgenel, Mendeley Data, doi:10.17632/5y9wdsg2zt.2, CC BY 4.0. Not redistributed here: no images, samples or per-image predictions are included.
- Encoder initialisation: torchvision ResNet-18
IMAGENET1K_V1(torchvision, BSD-3-Clause). - These weights: CC BY 4.0, attributions in
LICENSE.
4. Files
| File | What |
|---|---|
model.safetensors |
weights, 11.2 M params, fp32, sha256 510b1a336d14d1de86ae4086c3bc8fd7d1c31a3c46211fa6036697d21b7eb422 |
config.json |
labels, preprocessing, threshold |
crackcls.py |
standalone inference |
eval_summary.json |
dev/test metrics of all three models, split audit |
requirements.txt |
tested versions |
Reload check: crackcls.py reproduces a plain torchvision ResNet-18 loaded with the same weights exactly (max |Δp| = 0 on synthetic patches).
- Downloads last month
- 65