Container damage inspection (team QH-109)
Demo: Omar111199/team-qh-109-container-inspect-app
What it does
Built for the GWC container inspection challenge in Doha, at the Qai x Hugging Face hackathon. Manual inspection takes 7-8 minutes per container. This system looks at photos and video of a shipping container, marks dent, hole and rust with boxes, gives a verdict (fit, repair or out_of_service), and asks for a person when it is unsure.
How it works
- Detector: RF-DETR large, fine-tuned at 896 px, finds candidate damage. Photos also use flip and 672/1120 px test-time augmentation, merged with Weighted Boxes Fusion.
- OWLv2 filter:
google/owlv2-base-patch16-ensemble, used unchanged, finds the container and drops boxes off it. - LoRA verifier: a Qwen3-VL-8B LoRA, fine-tuned with TRL on real damage and on the detector's mistakes, gives each box a second opinion and confirms holes. A photo box stays if detector confidence x P(yes) is at least 0.33.
A hole means out_of_service only if the verifier confirms it. A hole box at or above 0.20 that isn't confirmed sets needs_human_check with the reason "possible hole", and is never silently dropped. The container side and number come from a hosted Qwen3-VL-30B.
Files
| Path | What it is |
|---|---|
model.safetensors, config.json, preprocessor_config.json |
Detector (Omar111199/container-detector-rfdetr-large-neg at 0d90f80914a51c06a5d30e29a80d657122961442) |
verifier/ |
LoRA adapter and its prompt (Omar111199/container-vlm-lora-v2-8b at dfecf641d9fbf0af53d665eb1b4fc17bddffd55b) |
config.py, tuned_settings.json |
The demo's settings. They name the source repos above at those pinned commits, and those repos are private |
from huggingface_hub import snapshot_download
from peft import PeftModel
from transformers import AutoImageProcessor, AutoModelForImageTextToText, AutoModelForObjectDetection
repo = "Omar111199/team-qh-109-container-inspect"
processor = AutoImageProcessor.from_pretrained(repo)
detector = AutoModelForObjectDetection.from_pretrained(repo)
base = AutoModelForImageTextToText.from_pretrained("Qwen/Qwen3-VL-8B-Instruct")
folder = snapshot_download(repo, allow_patterns="verifier/*")
verifier = PeftModel.from_pretrained(base, f"{folder}/verifier")
Results
Dent + hole only, IoU 0.3. The test split has no rust labels, so rust is not scored. Clean photos were never used for training or tuning.
Detector only (cut-off 0.45, no merging)
| Measure | Value | Images |
|---|---|---|
| F1, same 30 images as the baseline | 47.7% (a general vision model, Qwen3-VL-30B: 20.5%) | 30 |
| F1, unseen images | 37.1% (not a clear gain over our first detector's 34.3%) | 73 |
| F1, whole test | 53.7% | 436 |
| Real finds / false alarms, whole test | 358 of 798 / 176 | 436 |
| False alarms per clean photo | 0.107 | 150 |
| Clean photos: fit / repair / out of service | 146 / 0 / 4 | 150 |
| Hole photos marked out of service | 56 of 73 | 436 |
| Hole photos with neither a hole finding nor a flag | 13 of 73 | 436 |
| Latency | 46 ms per image on a10g-small, about 100x faster than the 4.68 s of the hosted vision model | 100 |
The real finds, false alarms, clean verdicts and hole rows come from a replay with box merging, which gives F1 53.8% on the whole test.
Full pipeline (detector + OWLv2 + verifier + test-time augmentation, live run)
| Measure | Value | Images |
|---|---|---|
| F1, same 30 images | 45.5% (20 real finds, 11 false alarms) | 30 |
| F1, unseen images | 39.7% (46 real finds, 30 false alarms) | 73 |
| F1, whole test | 54.9% (precision 67.5%, recall 46.2%) | 436 |
| F1 per type, whole test | dent 53.4%, hole 63.1% | 436 |
| Real finds / false alarms, whole test | 369 of 798 / 178 | 436 |
| False alarms per clean photo | 0.007 | 150 |
| Clean photos: fit / repair / out of service | 149 / 1 / 0 | 150 |
| Flag rate | 20.6% test, 6.0% clean | 436, 150 |
| Hole photos marked out of service | 55 of 73 | 436 |
| Hole photos with another hole finding or a flag | 10 of 73 | 436 |
| Hole photos with neither a hole finding nor a flag | 8 of 73 | 436 |
| Photos marked out of service, all | 80, of which 55 have a labelled hole | 436 |
| Time per photo, full (A10G) | 1.82 s median, 2.93 s max | 5 |
| Time per photo, local models only (A10G) | 1.16 s median | 436 |
| Time per photo, full-size phone pictures (A100) | 3.54 s median | 14 |
| Time per second of real video (A100) | 4.4 s (2.75 to 7.89 by clip) | 4 clips |
| GPU memory peak | 17.6 GB |
How to read these:
- The F1 difference between the two tables is small and untested, so don't read it as a gain.
- The clear difference is on clean containers.
- Clean results are probably optimistic. Those photos share source sets with the training negatives, and a model, not always a person, judged them clean.
Training data
- nishanthaivision/container-defect-detection on Roboflow (CC BY 4.0): 3,795 training images. Leaky test images removed: 1,291 training images with a near-copy in the test split were excluded.
- Clean negatives, 258 photos, also CC BY 4.0 on Roboflow: Container Number, Container Shipping Number, Container.
- Verifier: crops from the training photos, the detector's false alarms, look-alikes such as lock hardware and dark spots, and boxes on clean photos. "Not damage" crops were screened by Qwen3-VL-30B, which can be wrong.
Our own footage filmed in Doha was used for testing only, never for training.
Limitations
- Rust is partial and unscored. The detector finds rust, but the test split has no rust labels, so there is no test score for it.
- Logos can be read as damage. In our Doha clip IMG_4889, a black MSC logo stripe was marked as a dent. An earlier version gave that clip a false "out of service" from the same lettering.
- Video double-counts. The same rust is counted more than once on handheld footage, so don't trust the damage count per clip. Video is also slower than real time.
- A valid check digit doesn't mean a correct read. M and W give the same check digit: a container painted WSCU9075368 was read as MSCU9075368, and it passed.
- Other terminals are unmeasured. Our Doha footage is unlabelled and from one site, so real-world accuracy isn't known.
- It misses damage. It finds under half of labelled damage on test, and 8 of 73 hole photos get neither a finding nor a flag.
- Wrong damage type on real footage. On one Doha photo, a real dent was boxed correctly but called rust.
- Small unseen set: 73 images, only 2 with holes.
- No crack, deframe or scratch. These are in the class list but were never trained or measured.
- Severity is a size rule, not an inspector's judgement.
Intended use
Decision support: the inspector stays in the loop. It points inspectors to possible damage and asks for a person when unsure. It does not certify a container, and shouldn't make an out-of-service decision alone. Costs and verdicts in the demo are for review, not final.
Compute
About $50 of Hugging Face credits in total, across training, evaluation and tuning. Training this detector took $5.47 of that. The demo needs an a10g-small GPU, or larger.