Skip to content

This is small script for converting binary masks to yolo segmentation format.

Notifications You must be signed in to change notification settings

diuzhevVlad/mask2yolo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MASK2YOLO

Description

This script can be used to convert binary masks images to yolo format segmentation files. It may work not so good when segments have "holes".
In demo.ipynb you can see detailed logic of this script.

Requirements

Developed and tested on python 3.10 + opencv

How to use

Parameters

The script has following params (defaults should work not so bad):
EXTENTION - the extention of binary masks (png/jpg/...)
CLASS_ID - number of class (for binary segmentation: 1/0)
MASK_THRES_MIN & MASK_THRES_MAX - limits to detect mask on binary image
AREA_THRES - minimal part of total image area that contour shoud cover not to be ignored
CURVE_RATIO - parameter to decrease the ammount of points

Run

Simply run:

python3 converter.py PATH_TO_MASKS PATH_TO_YOLO_MASKS

About

This is small script for converting binary masks to yolo segmentation format.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published