Coder Social home page Coder Social logo

krisnarengga / yolov7-segmentation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rizwanmunawar/yolov7-segmentation

0.0 1.0 0.0 5.06 MB

YOLOv7 Instance Segmentation using OpenCV and PyTorch

License: GNU General Public License v3.0

Shell 0.57% Python 99.43%

yolov7-segmentation's Introduction

yolov7-instance-segmentation

Coming Soon

  • Development of streamlit dashboard for Instance-Segmentation with Object Tracking

Code Medium Blog

Steps to run Code

  • Clone the repository
git clone https://github.com/RizwanMunawar/yolov7-segmentation.git
  • Goto the cloned folder.
cd yolov7-segmentation
  • Create a virtual envirnoment (Recommended, If you dont want to disturb python packages)
### For Linux Users
python3 -m venv yolov7seg
source yolov7seg/bin/activate

### For Window Users
python3 -m venv yolov7seg
cd yolov7seg
cd Scripts
activate
cd ..
cd ..
  • Upgrade pip with mentioned command below.
pip install --upgrade pip
  • Install requirements with mentioned command below.
pip install -r requirements.txt
  • Download weights from link and store in "yolov7-segmentation" directory.

  • Run the code with 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
  • Output file will be created in the working directory with name yolov7-segmentation/runs/predict-seg/exp/"original-video-name.mp4"

RESULTS

Car Semantic Segmentation Car Semantic Segmentation Person Segmentation + Tracking

Custom Data Labelling

  • 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 login with roboflow account.

1

  • Once you will click on create workspace, You will see the popup as shown below to upload the dataset.

2

  • Click on upload dataset and roboflow will ask for workspace name as shown below. Fill that form and then click on Create Private Project
  • Note: Make sure to select Instance Segmentation Option in below image. dataset

-You can upload your dataset now.

Screenshot 2022-09-17 155330

  • Once files will upload, 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.

6

  • Click on any Image in Unannotated tab, and then you can start labelling.

  • Note: Press p and then draw polygon points for segmentation

10

  • Once you will complete labelling, you can then export the data and follow mentioned steps below to start training.

Custom Training

  • Move your (segmentation custom labelled data) inside "yolov7-segmentation\data" folder by following mentioned structure.

ss

  • Go to the data folder, create a file with name custom.yaml and paste the mentioned code below inside that.
train: "path to train folder"
val: "path to validation folder"
# number of classes
nc: 1
# class names
names: [ 'car']
  • Go to the terminal, and run mentioned command below to start training.
python3 segment/train.py --data data/custom.yaml --batch 4 --weights '' --cfg yolov7-seg.yaml --epochs 10 --name yolov7-seg --img 640 --hyp hyp.scratch-high.yaml

Custom Model Detection Command

python3 segment/predict.py --weights "runs/yolov7-seg/exp/weights/best.pt" --source "videopath.mp4"

RESULTS

Car Semantic Segmentation Car Semantic Segmentation Person Segmentation + Tracking

References

My Medium Articles

yolov7-segmentation's People

Contributors

rizwanmunawar avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.