├── README.md
├── Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps.ipynb
├── all_labels.csv
├── aug_images
├── aug1_ales-krivec-1Ofu8QGRFrg-unsplash.jpg
├── aug1_jim-bread-SBnxlHHrEwk-unsplash.jpg
├── aug1_jim-bread-XW7CGOlNG40-unsplash.jpg
├── aug1_joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg
├── aug1_natasha-ong-SQ3CZH_mKsM-unsplash.jpg
├── aug1_rafael-garcin-UdLKOwwmA-o-unsplash.jpg
├── aug1_ritchie-valens-qZPzLJyiN7E-unsplash.jpg
├── aug1_sonny-ravesteijn-N09f4fB92hI-unsplash.jpg
├── aug1_valentin-jorel-lftG-5nPTf8-unsplash.jpg
└── aug1_valentin-petkov-loL9nnBK-fE-unsplash.jpg
├── images
├── ales-krivec-1Ofu8QGRFrg-unsplash.jpg
├── ales-krivec-1Ofu8QGRFrg-unsplash.xml
├── jim-bread-SBnxlHHrEwk-unsplash.jpg
├── jim-bread-SBnxlHHrEwk-unsplash.xml
├── jim-bread-XW7CGOlNG40-unsplash.jpg
├── jim-bread-XW7CGOlNG40-unsplash.xml
├── joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg
├── joshua-j-cotten-7JaeaeWQ8cE-unsplash.xml
├── natasha-ong-SQ3CZH_mKsM-unsplash.jpg
├── natasha-ong-SQ3CZH_mKsM-unsplash.xml
├── rafael-garcin-UdLKOwwmA-o-unsplash.jpg
├── rafael-garcin-UdLKOwwmA-o-unsplash.xml
├── ritchie-valens-qZPzLJyiN7E-unsplash.jpg
├── ritchie-valens-qZPzLJyiN7E-unsplash.xml
├── sonny-ravesteijn-N09f4fB92hI-unsplash.jpg
├── sonny-ravesteijn-N09f4fB92hI-unsplash.xml
├── valentin-jorel-lftG-5nPTf8-unsplash.jpg
├── valentin-jorel-lftG-5nPTf8-unsplash.xml
├── valentin-petkov-loL9nnBK-fE-unsplash.jpg
└── valentin-petkov-loL9nnBK-fE-unsplash.xml
└── labels.csv
/README.md:
--------------------------------------------------------------------------------
1 | # Tutorial Image and Multiple Bounding Boxes Augmentation for Deep Learning in 4 Steps
2 |
3 | Say we have images for training our Deep Neural Network. We also have separate PASCAL VOC format XML files with coordinates of bounding boxes for objects we are going to train our model to detect.
4 | We want to use [TensorFlow Object Detection API](https://github.com/tensorflow/models/tree/master/research/object_detection).
5 | To do so we are planning to:
6 | 1. Convert all XML files into one CSV file that we can feed into TensorFlow Object Detection API
7 | 2. Resize all images together with the corresponding object bounding boxes
8 | 3. Augment images to upsample our dataset. Corresponding object bounding boxes should be augmented accordingly
9 | 4. Document augmented images' new sizes and bounding boxes' coordinates to a CSV file
10 |
11 | This tutorial will walk you through this process step by step.
12 |
13 | At the core of this tutorial we will use amazing [imgaug library](https://github.com/aleju/imgaug). Author has published [tutorials](https://nbviewer.jupyter.org/github/aleju/imgaug-doc/tree/master/notebooks/) on the use of the library and [Documentation](https://imgaug.readthedocs.io/en/latest/index.html).
14 |
15 | But here's a problem:
16 | I had to spend a whole day digging through the Documentation and coding up the script for my problem.
17 | I decided to share it, so you don't have to waste your time.
18 |
19 | Easiest way to install imgaug is through Anaconda. Follow this steps in Anaconda promt to create virtual environment, install imgaug and activate the environment:
20 | ```
21 | conda create -n myenv python=3.5.6
22 | conda config --add channels conda-forge
23 | conda install imgaug
24 | conda activate myenv
25 | ```
26 | You can refer to [imgaug library GitHub page](https://github.com/aleju/imgaug) for additional info on installation. To work through this tutorial you would need pandas installed as well. If you work through Anaconda it is installed by default.
27 |
28 | Download the repository and open Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps.ipynb to follow along.
29 |
--------------------------------------------------------------------------------
/all_labels.csv:
--------------------------------------------------------------------------------
1 | filename,width,height,class,xmin,ymin,xmax,ymax
2 | ales-krivec-1Ofu8QGRFrg-unsplash.jpg,600,536,red_panda,144,60,416,424
3 | jim-bread-SBnxlHHrEwk-unsplash.jpg,400,600,red_panda,0,126,304,398
4 | jim-bread-XW7CGOlNG40-unsplash.jpg,600,400,red_panda,260,0,559,296
5 | joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg,400,600,red_panda,180,174,318,424
6 | natasha-ong-SQ3CZH_mKsM-unsplash.jpg,600,400,red_panda,0,80,386,284
7 | rafael-garcin-UdLKOwwmA-o-unsplash.jpg,600,450,red_panda,232,185,568,423
8 | ritchie-valens-qZPzLJyiN7E-unsplash.jpg,600,372,red_panda,144,91,362,330
9 | sonny-ravesteijn-N09f4fB92hI-unsplash.jpg,600,400,red_panda,101,118,296,387
10 | sonny-ravesteijn-N09f4fB92hI-unsplash.jpg,600,400,red_panda,252,114,510,333
11 | valentin-jorel-lftG-5nPTf8-unsplash.jpg,600,400,red_panda,225,103,450,294
12 | valentin-petkov-loL9nnBK-fE-unsplash.jpg,338,600,red_panda,6,170,214,412
13 | valentin-petkov-loL9nnBK-fE-unsplash.jpg,338,600,red_panda,193,264,338,421
14 | aug1_ales-krivec-1Ofu8QGRFrg-unsplash.jpg,600,536,red_panda,183,60,455,424
15 | aug1_jim-bread-SBnxlHHrEwk-unsplash.jpg,400,600,red_panda,137,195,319,359
16 | aug1_jim-bread-XW7CGOlNG40-unsplash.jpg,600,400,red_panda,66,0,482,289
17 | aug1_joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg,400,600,red_panda,81,174,219,424
18 | aug1_natasha-ong-SQ3CZH_mKsM-unsplash.jpg,600,400,red_panda,213,80,599,284
19 | aug1_rafael-garcin-UdLKOwwmA-o-unsplash.jpg,600,450,red_panda,264,204,441,329
20 | aug1_ritchie-valens-qZPzLJyiN7E-unsplash.jpg,600,372,red_panda,217,75,435,314
21 | aug1_sonny-ravesteijn-N09f4fB92hI-unsplash.jpg,600,400,red_panda,90,120,330,400
22 | aug1_sonny-ravesteijn-N09f4fB92hI-unsplash.jpg,600,400,red_panda,237,78,531,339
23 | aug1_valentin-jorel-lftG-5nPTf8-unsplash.jpg,600,400,red_panda,26,66,305,357
24 | aug1_valentin-petkov-loL9nnBK-fE-unsplash.jpg,338,600,red_panda,109,240,262,418
25 | aug1_valentin-petkov-loL9nnBK-fE-unsplash.jpg,338,600,red_panda,247,309,338,425
26 |
--------------------------------------------------------------------------------
/aug_images/aug1_ales-krivec-1Ofu8QGRFrg-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_ales-krivec-1Ofu8QGRFrg-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_jim-bread-SBnxlHHrEwk-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_jim-bread-SBnxlHHrEwk-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_jim-bread-XW7CGOlNG40-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_jim-bread-XW7CGOlNG40-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_natasha-ong-SQ3CZH_mKsM-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_natasha-ong-SQ3CZH_mKsM-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_rafael-garcin-UdLKOwwmA-o-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_rafael-garcin-UdLKOwwmA-o-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_ritchie-valens-qZPzLJyiN7E-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_ritchie-valens-qZPzLJyiN7E-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_sonny-ravesteijn-N09f4fB92hI-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_sonny-ravesteijn-N09f4fB92hI-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_valentin-jorel-lftG-5nPTf8-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_valentin-jorel-lftG-5nPTf8-unsplash.jpg
--------------------------------------------------------------------------------
/aug_images/aug1_valentin-petkov-loL9nnBK-fE-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/aug_images/aug1_valentin-petkov-loL9nnBK-fE-unsplash.jpg
--------------------------------------------------------------------------------
/images/ales-krivec-1Ofu8QGRFrg-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/ales-krivec-1Ofu8QGRFrg-unsplash.jpg
--------------------------------------------------------------------------------
/images/ales-krivec-1Ofu8QGRFrg-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | ales-krivec-1Ofu8QGRFrg-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\ales-krivec-1Ofu8QGRFrg-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 1200
10 | 1072
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/jim-bread-SBnxlHHrEwk-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/jim-bread-SBnxlHHrEwk-unsplash.jpg
--------------------------------------------------------------------------------
/images/jim-bread-SBnxlHHrEwk-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | jim-bread-SBnxlHHrEwk-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\jim-bread-SBnxlHHrEwk-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 800
10 | 1200
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/jim-bread-XW7CGOlNG40-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/jim-bread-XW7CGOlNG40-unsplash.jpg
--------------------------------------------------------------------------------
/images/jim-bread-XW7CGOlNG40-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | jim-bread-XW7CGOlNG40-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\jim-bread-XW7CGOlNG40-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 600
10 | 400
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg
--------------------------------------------------------------------------------
/images/joshua-j-cotten-7JaeaeWQ8cE-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 800
10 | 1200
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/natasha-ong-SQ3CZH_mKsM-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/natasha-ong-SQ3CZH_mKsM-unsplash.jpg
--------------------------------------------------------------------------------
/images/natasha-ong-SQ3CZH_mKsM-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | natasha-ong-SQ3CZH_mKsM-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\natasha-ong-SQ3CZH_mKsM-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 1200
10 | 800
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/rafael-garcin-UdLKOwwmA-o-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/rafael-garcin-UdLKOwwmA-o-unsplash.jpg
--------------------------------------------------------------------------------
/images/rafael-garcin-UdLKOwwmA-o-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | rafael-garcin-UdLKOwwmA-o-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\rafael-garcin-UdLKOwwmA-o-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 600
10 | 450
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/ritchie-valens-qZPzLJyiN7E-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/ritchie-valens-qZPzLJyiN7E-unsplash.jpg
--------------------------------------------------------------------------------
/images/ritchie-valens-qZPzLJyiN7E-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | ritchie-valens-qZPzLJyiN7E-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\ritchie-valens-qZPzLJyiN7E-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 1200
10 | 743
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/sonny-ravesteijn-N09f4fB92hI-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/sonny-ravesteijn-N09f4fB92hI-unsplash.jpg
--------------------------------------------------------------------------------
/images/sonny-ravesteijn-N09f4fB92hI-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | sonny-ravesteijn-N09f4fB92hI-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\sonny-ravesteijn-N09f4fB92hI-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 600
10 | 400
11 | 3
12 |
13 | 0
14 |
26 |
38 |
39 |
--------------------------------------------------------------------------------
/images/valentin-jorel-lftG-5nPTf8-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/valentin-jorel-lftG-5nPTf8-unsplash.jpg
--------------------------------------------------------------------------------
/images/valentin-jorel-lftG-5nPTf8-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | valentin-jorel-lftG-5nPTf8-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\valentin-jorel-lftG-5nPTf8-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 1200
10 | 800
11 | 3
12 |
13 | 0
14 |
26 |
27 |
--------------------------------------------------------------------------------
/images/valentin-petkov-loL9nnBK-fE-unsplash.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/asetkn/Tutorial-Image-and-Multiple-Bounding-Boxes-Augmentation-for-Deep-Learning-in-4-Steps/dcac1abfd79be4208e910ccb9113b273aa9aa70e/images/valentin-petkov-loL9nnBK-fE-unsplash.jpg
--------------------------------------------------------------------------------
/images/valentin-petkov-loL9nnBK-fE-unsplash.xml:
--------------------------------------------------------------------------------
1 |
2 | images
3 | valentin-petkov-loL9nnBK-fE-unsplash.jpg
4 | C:\Users\Asset\Documents\articles\image_bbs_augmentation\images\valentin-petkov-loL9nnBK-fE-unsplash.jpg
5 |
6 | Unknown
7 |
8 |
9 | 675
10 | 1200
11 | 3
12 |
13 | 0
14 |
26 |
38 |
39 |
--------------------------------------------------------------------------------
/labels.csv:
--------------------------------------------------------------------------------
1 | filename,width,height,class,xmin,ymin,xmax,ymax
2 | ales-krivec-1Ofu8QGRFrg-unsplash.jpg,600,536,red_panda,144,60,416,424
3 | jim-bread-SBnxlHHrEwk-unsplash.jpg,400,600,red_panda,0,126,304,398
4 | jim-bread-XW7CGOlNG40-unsplash.jpg,600,400,red_panda,260,0,559,296
5 | joshua-j-cotten-7JaeaeWQ8cE-unsplash.jpg,400,600,red_panda,180,174,318,424
6 | natasha-ong-SQ3CZH_mKsM-unsplash.jpg,600,400,red_panda,0,80,386,284
7 | rafael-garcin-UdLKOwwmA-o-unsplash.jpg,600,450,red_panda,232,185,568,423
8 | ritchie-valens-qZPzLJyiN7E-unsplash.jpg,600,372,red_panda,144,91,362,330
9 | sonny-ravesteijn-N09f4fB92hI-unsplash.jpg,600,400,red_panda,101,118,296,387
10 | sonny-ravesteijn-N09f4fB92hI-unsplash.jpg,600,400,red_panda,252,114,510,333
11 | valentin-jorel-lftG-5nPTf8-unsplash.jpg,600,400,red_panda,225,103,450,294
12 | valentin-petkov-loL9nnBK-fE-unsplash.jpg,338,600,red_panda,6,170,214,412
13 | valentin-petkov-loL9nnBK-fE-unsplash.jpg,338,600,red_panda,193,264,338,421
14 |
--------------------------------------------------------------------------------