November 2017
Intermediate to advanced
304 pages
6h 58m
English
Before starting the training process, we need to pre-process the dataset into a simpler format, which we will use in the further automatic fine-tuning.
First, we make a Python package with named scripts in the project folder. Then, we create a Python file named convert_oxford_data.py and add the following code:
import os import tensorflow as tf from tqdm import tqdm from scipy.misc import imread, imsave FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string( 'dataset_dir', 'data/datasets', 'The location of Oxford IIIT Pet Dataset which contains annotations and images folders' ) tf.app.flags.DEFINE_string( 'target_dir', 'data/train_data', 'The location where all the images will be stored' ) def ensure_folder_exists(folder_path): ...
Read now
Unlock full access