Skip to content

augmenting object detection dataset along with bounding box annotations

Notifications You must be signed in to change notification settings

Mr-TalhaIlyas/Augmenting_Detection_Dataset

Repository files navigation

Hits

Augmentation for Detection Dataset

This repo utilizes imageaug library to augument the object detection dataset.

Usage

python \path_2_script\bb_aug.py -i=C:\Users\Desktop\new\in -o=C:\Users\Desktop\new\op -c train bus cycle car -iter=3

For help

python D:\path 2 where file is located\bb_aug.py -h

usage: bb_aug.py [-h] [-i IMG_PATH] [-o OP_IMG_PATH]
                 [-c CLASSES [CLASSES ...]] [--xml_path XML_PATH]
                 [--op_xml_path OP_XML_PATH] [-iter ITERATIONS]

optional arguments:
  -h, --help            show this help message and exit
  -i IMG_PATH, --img_path IMG_PATH
                        path to read images.
  -o OP_IMG_PATH, --op_img_path OP_IMG_PATH
                        path to write images.
  -c CLASSES [CLASSES ...], --classes CLASSES [CLASSES ...]
                        a list containing names of all classes in dataset
  --xml_path XML_PATH   path to read xml files if None then same as img_path.
  --op_xml_path OP_XML_PATH
                        path to write xml files if None then same as
                        op_img_path.
  -iter ITERATIONS, --iterations ITERATIONS
                        Number of times to augment each image e.g. if input
                        dir has 2 images and iterations=4 then op dir will
                        have 8 images, default is 1.

Output

============================================================
Images Found =  3
Annot. Found =  3
------------------------------------------------------------
Augmneted Files =  9
============================================================
Augumenting Dataset (iteration 1of3): 100%|████████████████████████████████████████████████████████████████████████████████| 3/3 [00:03<00:00,  1.00s/it]
Augumenting Dataset (iteration 2of3): 100%|████████████████████████████████████████████████████████████████████████████████| 3/3 [00:03<00:00,  1.23s/it]
Augumenting Dataset (iteration 3of3): 100%|████████████████████████████████████████████████████████████████████████████████| 3/3 [00:02<00:00,  1.40it/s]

Dependency (Libraries)

  1. imgaug
  2. matplot
  3. cv2
  4. xmltodict
  5. dicttoxml

Follwing are some examples of input images with their b_boxes drawn on them and their corresponding augumented outputs.

alt text

alt text

alt text

Releases

No releases published

Packages

No packages published