Skip to content

Perform mosaic image augmentation on data for training a YOLO model

Notifications You must be signed in to change notification settings

arijitgupta42/YOLO-Mosaic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

YOLO Mosaic

Code for mosaic image augmentation implemented from YOLOv4 onwards

Add the required input paths to the main.py code and chaange the output paths if required. The code was developed using YOLO style annotation data and expects input annotations in the format <class name> <x> <y> <width> <height>, just like any YOLO architecture. The classes variable in the main.py can be changed to whatever classes are there in the dataset, the current list is according to the Pascal VOC dataset.

Example working of the code

Input images:

Image 1 Image 2 Image 3 Image 4

Output mosaic augmented image with YOLO compatible annotations:

Output Mosaic Image Output with BBoxes

Auxiliary function modules

The dataset.py function converts the given image and annotation directories into lists of images and their corresponding annotations. After which the main.py randomly samples 4 images from the dataset and passes it to the mosaic.py function which scales the four images and arranges them to fit in the desired output size and also changes the annotaion values accordingly.

Heavily inspired from this code which did not support YOLO style annotations

About

Perform mosaic image augmentation on data for training a YOLO model

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages