A lightweight computer vision project that performs instance segmentation of people using Ultralytics YOLOv8. The repository demonstrates an end-to-end deep learning workflow—from dataset preparation and annotation conversion to model training, evaluation, and inference on both images and video.
- Trained a YOLOv8n-Seg model for people instance segmentation.
- Converted annotations from COCO format to YOLO segmentation format.
- Performed dataset verification and train/validation/test splitting.
- Achieved high segmentation accuracy while remaining suitable for CPU inference.
- Demonstrated inference on both images and video.
- Organised into a clean, reproducible project structure.
| Metric | Score |
|---|---|
| Precision | 0.991 |
| Recall | 0.956 |
| mAP@50 | 0.977 |
| mAP@50-95 | 0.885 |
| Metric | Score |
|---|---|
| Precision | 0.988 |
| Recall | 0.952 |
| mAP@50 | 0.968 |
| mAP@50-95 | 0.848 |
The trained model demonstrated strong localisation and segmentation performance on the validation dataset while remaining lightweight enough for CPU-based inference.
people_instance_segmentation/
├── assets/
├── data/
├── dataset/
├── models/
├── outputs/
├── reports/
├── scripts/
├── videos/
├── data.yaml
├── requirements.txt
├── README.md
├── LICENSE
└── .gitignore
Clone the repository
git clone https://github.com/only1jamjam-ctrl/people_instance_segmentation-yolov8.gitMove into the project
cd people_instance_segmentationInstall the required packages
pip install -r requirements.txtyolo segment train \
model=yolov8n-seg.pt \
data=data.yaml \
epochs=50 \
imgsz=640 \
batch=8 \
project=runs \
name=people_segyolo segment predict \
model=models/best.pt \
source=data/images/test \
save=Trueyolo segment predict \
model=models/best.pt \
source=outputs/demovideo.mp4 \
save=Trueflowchart LR
A[Dataset] --> B[COCO to YOLO Conversion]
B --> C[Dataset Verification]
C --> D[Train / Validation / Test Split]
D --> E[YOLOv8 Training]
E --> F[Model Evaluation]
F --> G[Image Prediction]
G --> H[Video Prediction]
H --> I[GIF Generation]
- Trained a YOLOv8n-Seg model for 50 epochs.
- Achieved 0.968 Mask mAP@50 and 0.977 Box mAP@50.
- Built a complete COCO → YOLO segmentation preprocessing pipeline.
- Performed image and video inference using the trained model.
- Generated deployment-ready prediction outputs and demonstration GIF.
- Designed a clean, reproducible repository structure for future development.
Although the model performs well on standard scenes, some challenging scenarios remain:
- Crowded scenes with heavy occlusion may reduce detection accuracy.
- Human-like objects such as dolls or mannequins can occasionally produce false positives.
- Performance can be further improved using a larger and more diverse training dataset.
- Train using a larger dataset.
- Evaluate larger YOLOv8 segmentation backbones.
- Improve robustness on crowded scenes.
- Reduce false positives through hard-negative examples.
- Deploy the model for real-time webcam inference.
Released under the MIT License.




