git clone https://github.com/RizwanMunawar/yolov7-segmentation.git
cd yolov7-segmentation
### For Linux Users
python3 -m venv yolov7seg
source yolov7seg/bin/activate
### For Windows Users
python3 -m venv yolov7seg
cd yolov7seg
cd Scripts
activate
cd ..
cd ..
pip install --upgrade pip
pip install -r requirements.txt
Download weights from link and store in "yolov7-segmentation" directory.
Run the code with the mentioned command below.
#for segmentation with detection
python3 segment/predict.py --weights yolov7-seg.pt --source "videopath.mp4"
#for segmentation with detection + Tracking
python3 segment/predict.py --weights yolov7-seg.pt --source "videopath.mp4" --trk
#save the labels files of segmentation
python3 segment/predict.py --weights yolov7-seg.pt --source "videopath.mp4" --save-txt
runs/predict-seg/exp/original-video-name.mp4| Car Semantic Segmentation | Car Semantic Segmentation | Person Segmentation + Tracking |
![]() |
![]() |
![]() |
I have used roboflow for data labelling. The data labelling for Segmentation will be a Polygon box, while data labelling for object detection will be a bounding box
Go to the link and create a new workspace. Make sure to log in with your Roboflow account.



-You can upload your dataset now.

Once the files are uploaded, you can click on Finish Uploading.
Roboflow will ask you to assign Images to someone, click on Assign Images.
After that, you will see the tab shown below.

Click on any Image in Unannotated tab, and then you can start labelling.
Note: Press p and then draw polygon points for segmentation

yolov7-segmentation/data folder by following the mentioned structure.
train: "path to train folder"
val: "path to validation folder"
# number of classes
nc: 1
# class names
names: [ 'car']
python3 segment/train.py --data data/custom.yaml \
--batch 4 \
--weights "yolov7-seg.pt"
--cfg yolov7-seg.yaml \
--epochs 10 \
--name yolov7-seg \
--img 640 \
--hyp hyp.scratch-high.yaml
python3 segment/predict.py --weights "runs/yolov7-seg/exp/weights/best.pt" --source "videopath.mp4"
| Car Semantic Segmentation | Car Semantic Segmentation | Person Segmentation + Tracking |
![]() |
![]() |
![]() |
Some of my articles/research papers | computer vision awesome resources for learning | How do I appear to the world? 🚀
Ultralytics YOLO11: Object Detection and Instance Segmentation🤯
Parking Management using Ultralytics YOLO11
My 🖐️Computer Vision Hobby Projects that Yielded Earnings
Best Resources to Learn Computer Vision
Roadmap for Computer Vision Engineer
How did I spend 2022 in the Computer Vision Field
Domain Feature Mapping with YOLOv7 for Automated Edge-Based Pallet Racking Inspections
Exudate Regeneration for Automated Exudate Detection in Retinal Fundus Images
Feature Mapping for Rice Leaf Defect Detection Based on a Custom Convolutional Architecture
Yolov5, Yolo-x, Yolo-r, Yolov7 Performance Comparison: A Survey
Explainable AI in Drug Sensitivity Prediction on Cancer Cell Lines
More Information
For more details, you can reach out to me on Medium or can connect with me on LinkedIn
$ claude mcp add yolov7-segmentation \
-- python -m otcore.mcp_server <graph>