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8 |
+
## 1. Model Description
|
| 9 |
+
|
| 10 |
+
### Context
|
| 11 |
+
This project develops a YOLOv11 object detection model that detects damaged and undamaged shipping packages in images.
|
| 12 |
+
The model predicts bounding boxes around packages and classifies each detected package as either damaged or normal.
|
| 13 |
+
Detecting package damage automatically could help logistics systems identify problems earlier in the shipping process.
|
| 14 |
+
For example, warehouse monitoring systems could use a model like this to flag packages that may require manual inspection.
|
| 15 |
+
|
| 16 |
+
### Training Approach
|
| 17 |
+
The model was trained using YOLOv11 object detection within the Ultralytics framework.
|
| 18 |
+
The model was fine-tuned from pretrained COCO weights and then trained on a custom dataset of package images.
|
| 19 |
+
Using pretrained weights allows the model to reuse general visual features learned from large image datasets before adapting them to the specific task of package damage detection.
|
| 20 |
+
|
| 21 |
+
### Intended Use Cases
|
| 22 |
+
Potential Applications of this model include:
|
| 23 |
+
|
| 24 |
+
- warehouse package inspection
|
| 25 |
+
- automated logistics monitoring
|
| 26 |
+
- research experiments involving object detection
|
| 27 |
+
- prototype quality-control systems
|
| 28 |
+
|
| 29 |
+
This model is intended for research and experimentation and should not be used as a fully automated system without human oversight.
|
| 30 |
+
|
| 31 |
+
---
|
| 32 |
+
|
| 33 |
+
## 2. Training Data
|
| 34 |
+
|
| 35 |
+
### Data Sources
|
| 36 |
+
The dataset used for training was created by combining two pre-annotated package detection datasets from Roboflow Universe:
|
| 37 |
+
|
| 38 |
+
https://universe.roboflow.com/nani-tmzf6/package-detection-5ozpr
|
| 39 |
+
https://universe.roboflow.com/roboflow-ngkro/package-detection-e1ssd
|
| 40 |
+
|
| 41 |
+
These datasets contain images of shipping packages with bounding box annotations identifying package locations and damage conditions.
|
| 42 |
+
|
| 43 |
+
### Dataset Size
|
| 44 |
+
|
| 45 |
+
The combined dataset contains approximately **2,787 images**.
|
| 46 |
+
|
| 47 |
+
### Original Class Labels Across Datasets
|
| 48 |
+
Because the datasets came from different sources, they used slightly different label names. The original labels included:
|
| 49 |
+
|
| 50 |
+
- Box
|
| 51 |
+
- Package
|
| 52 |
+
- Box_broken
|
| 53 |
+
- Open_package
|
| 54 |
+
- damaged
|
| 55 |
+
|
| 56 |
+
These labels were inconsistent across datasets and required standardization before training.
|
| 57 |
+
|
| 58 |
+
### Annotation Process
|
| 59 |
+
The dataset preparation process involved several steps:
|
| 60 |
+
|
| 61 |
+
- combined two pre-annotated datasets
|
| 62 |
+
- standardized inconsistent class labels across datasets
|
| 63 |
+
- verified bounding box annotations
|
| 64 |
+
- reduced the number of classes
|
| 65 |
+
|
| 66 |
+
After cleaning and relabeling, the dataset was reduced to two classes representing the condition of each package.
|
| 67 |
+
|
| 68 |
+
### Final Classes Used for Training
|
| 69 |
+
|
| 70 |
+
| Class | Count |
|
| 71 |
+
|------|------|
|
| 72 |
+
| normal | 1575 |
|
| 73 |
+
| damaged | 1212 |
|
| 74 |
+
|
| 75 |
+
The dataset is relatively balanced between damaged and undamaged packages.
|
| 76 |
+
|
| 77 |
+
### Train / Validation / Test Split
|
| 78 |
+
|
| 79 |
+
| Split | Ratio | Approximate Images |
|
| 80 |
+
|------|------|-------------------|
|
| 81 |
+
| Train | 70% | ~1951 |
|
| 82 |
+
| Validation | 20% | ~557 |
|
| 83 |
+
| Test | 10% | ~279 |
|
| 84 |
+
|
| 85 |
+
### Data Augmentation
|
| 86 |
+
|
| 87 |
+
The following augmentations were applied during training:
|
| 88 |
+
|
| 89 |
+
| Augmentation | Purpose |
|
| 90 |
+
|--------------|--------|
|
| 91 |
+
| Horizontal flip | simulate packages placed in different orientations |
|
| 92 |
+
| Image rotation | simulate packages rotated on the floor or conveyor |
|
| 93 |
+
| Brightness adjustment | simulate different lighting conditions |
|
| 94 |
+
|
| 95 |
+
These augmentations help the model generalize better to real-world environments.
|
| 96 |
+
|
| 97 |
+
### Known Biases and Dataset Limitations
|
| 98 |
+
The dataset contains mostly cardboard shipping boxes photographed under relatively consistent lighting conditions. As a result, the model may perform less reliably when detecting different packaging materials or under significantly different lighting environments. Some types of package damage may also appear less frequently in the dataset.
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## 3. Training Procedure
|
| 103 |
+
|
| 104 |
+
- Framework: Ultralytics YOLOv11n
|
| 105 |
+
- Hardware: A100 GPU in Google Colab
|
| 106 |
+
- Epochs: 50
|
| 107 |
+
- Batch Size: 64
|
| 108 |
+
- Image Size: 640x640
|
| 109 |
+
- Patience: 50
|
| 110 |
+
- Training Time: ~7.44 minutes (446.58 seconds)
|
| 111 |
+
- Preprocessing: Augmentations applied at training time (see Data Augmentation section)
|
| 112 |
+
|
| 113 |
+
---
|
| 114 |
+
|
| 115 |
+
## 4. Evaluation Results
|
| 116 |
+
|
| 117 |
+
### Comprehensive Metrics
|
| 118 |
+
|
| 119 |
+
The YOLOv11 model was evaluated on a held-out validation dataset using standard object detection metrics.
|
| 120 |
+
These metrics measure how accurately the model detects packages and classifies them as damaged or normal.
|
| 121 |
+
|
| 122 |
+
| Metric | Value |
|
| 123 |
+
|------|------|
|
| 124 |
+
| Precision | 0.927 |
|
| 125 |
+
| Recall | 0.919 |
|
| 126 |
+
| mAP50 | 0.959 |
|
| 127 |
+
| mAP50-95 | 0.868 |
|
| 128 |
+
|
| 129 |
+
Overall, the model achieves strong detection performance, with a high mAP50 score indicating that the model is able to accurately detect package locations and classify damage in most cases.
|
| 130 |
+
|
| 131 |
+
### Per-Class Breakdown
|
| 132 |
+
|
| 133 |
+
| Class | Images | Instances | Precision | Recall | mAP50 | mAP50-95 |
|
| 134 |
+
|------|------|------|------|------|------|------|
|
| 135 |
+
| all | 499 | 538 | 0.927 | 0.919 | 0.959 | 0.868 |
|
| 136 |
+
| damaged | 329 | 329 | 0.966 | 0.963 | 0.988 | 0.904 |
|
| 137 |
+
| normal | 170 | 209 | 0.887 | 0.876 | 0.930 | 0.832 |
|
| 138 |
+
|
| 139 |
+
The model performs slightly better at detecting damaged packages than normal ones. This may be because damage features such as dents or torn cardboard create stronger visual cues for the model.
|
| 140 |
+
|
| 141 |
+
### Visual Examples of Classes
|
| 142 |
+
|