Views
No views yet
Class Images Instances Box(P R mAP50 mAP50-95) Mask(P R mAP50 mAP50-95)
all 571 1247 0.824 0.75 0.799 0.599 0.827 0.749 0.792 0.576
crack 92 152 0.657 0.48 0.545 0.322 0.665 0.483 0.518 0.214
dent 249 366 0.706 0.571 0.633 0.377 0.697 0.56 0.612 0.344
glass shatter 89 91 0.98 0.989 0.994 0.728 0.981 0.989 0.994 0.784
lamp broken 103 103 0.91 0.893 0.964 0.791 0.921 0.902 0.967 0.808
scratch 281 482 0.728 0.614 0.676 0.421 0.734 0.613 0.68 0.368
tire flat 50 53 0.962 0.951 0.982 0.951 0.962 0.949 0.982 0.9411from ultralytics import YOLO
2
3model = YOLO('yolo11x-seg.pt')
4
5model.train(
6 data='path/to/dataset.yaml',
7 epochs=300,
8 batch=16,
9 imgsz=1024,
10 dropout=0.1,
11 multi_scale=True,
12 val=True,
13 patience=25,
14 optimizer='AdamW',
15 cls=0.3, # Reduced to prioritize boundary precision over classification
16 dfl=1.7, # Increased for better damage boundary delineation
17 lr0=0.0001,
18 lrf=0.01,
19 warmup_epochs=10, # Extended warmup for complex damage patterns
20 mosaic=1.0,
21 mixup=0.1,
22 copy_paste=0.1,
23 hsv_h=0.015,
24 hsv_s=0.7,
25 hsv_v=0.4,
26 cos_lr=True,
27 amp=True,
28 overlap_mask=True # Better segmentation for irregular damage shapes
29)imgsz=1024: Higher resolution critical for detecting small damage features like fine cracks and scratchesoptimizer='AdamW': Provides better convergence for fine-grained segmentation tasks compared to SGDdropout=0.1: Light regularization prevents overfitting while preserving ability to detect subtle damage featuresmulti_scale=True: Enhances model robustness to different damage sizes and viewing distanceswarmup_epochs=10: Extended warmup period stabilizes early training on complex damage patternsoverlap_mask=True: Improves segmentation quality for irregular damage shapes with complex boundariescls=0.3dfl=1.7!wget https://huggingface.co/harpreetsahota/car-dd-segmentation-yolov11/resolve/main/best.pt -O yolov11-seg-cardd.ptfrom ultralytics import YOLO
import os
import gdown
# Load the model
model = YOLO('best.pt')
# Apply the model to the test dataset
# FiftyOne automatically handles batching and processing
test_dataset.apply_model(
model,
label_field="yolo_predictions", # Field name to store predictions
confidence_thresh=0.25, # Minimum confidence threshold
batch_size=8 # Adjust based on your GPU memory
)
# Define the class list to match your model's classes
classes = ["crack", "dent", "glass shatter", "lamp broken", "scratch", "tire flat"]
# Evaluate detections against ground truth
eval_results = test_dataset.evaluate_detections(
"yolo_predictions", # Field containing model predictions
gt_field="segmentations", # Field containing ground truth
eval_key="model_eval", # Key to store evaluation results
use_masks=True, # Use pixel masks for IoU calculation
compute_mAP=True, # Compute mean Average Precision
method="coco", # COCO evaluation protocol
classes=classes, # Class list
iou=0.50 # IoU threshold
)
# Print evaluation results
print(eval_results)
# Visualize evaluation results in the FiftyOne App
from fiftyone import ViewField as F
# Create a view showing false positives with high confidence
high_conf_fp_view = test_dataset.filter_labels(
"yolo_predictions",
(F("confidence") > 0.7) & (F("eval") == "fp")
)
# Sort by false positive count
sorted_view = high_conf_fp_view.sort_by(
F("yolo_predictions.detections").length(), reverse=True
)
# Launch the app with this view
session = fo.launch_app(sorted_view)