diff --git a/Chapter3/Augment training data by flipping.ipynb b/Chapter3/Augment training data by flipping.ipynb new file mode 100644 index 0000000..b315174 --- /dev/null +++ b/Chapter3/Augment training data by flipping.ipynb @@ -0,0 +1,2978 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "BARS_FOLDER = \"../rotated_barcodes/bars/\"\n", + "OUTPUT_FOLDER = \"../rotated_barcodes/bars/\"" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "from os import listdir\n", + "from os.path import isfile, join\n", + "\n", + "paths = [BARS_FOLDER + f for f in listdir(BARS_FOLDER) if isfile(join(BARS_FOLDER, f))]" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "(449, 4)\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + " | path | \n", + "dec | \n", + "bin | \n", + "class | \n", + "
---|---|---|---|---|
0 | \n", + "../rotated_barcodes/bars/1002792_0.png | \n", + "1002792 | \n", + "0b11110100110100101000 | \n", + "[19, 18, 17, 16, 14, 11, 10, 8, 5, 3] | \n", + "
1 | \n", + "../rotated_barcodes/bars/1002872_1.png | \n", + "1002872 | \n", + "0b11110100110101111000 | \n", + "[19, 18, 17, 16, 14, 11, 10, 8, 6, 5, 4, 3] | \n", + "
2 | \n", + "../rotated_barcodes/bars/1004045_68.png | \n", + "1004045 | \n", + "0b11110101001000001101 | \n", + "[19, 18, 17, 16, 14, 12, 9, 3, 2, 0] | \n", + "
3 | \n", + "../rotated_barcodes/bars/1004047_120.png | \n", + "1004047 | \n", + "0b11110101001000001111 | \n", + "[19, 18, 17, 16, 14, 12, 9, 3, 2, 1, 0] | \n", + "
4 | \n", + "../rotated_barcodes/bars/1007115_22.png | \n", + "1007115 | \n", + "0b11110101111000001011 | \n", + "[19, 18, 17, 16, 14, 12, 11, 10, 9, 3, 1, 0] | \n", + "