Now we are ready to train the model. Let's create a Python file named train.py in the scripts folder. First, we need to define some parameters for the training routines:
import tensorflow as tf import os from datetime import datetime from tqdm import tqdm import nets, models, datasets # Dataset dataset_dir = "data/train_data" batch_size = 64 image_size = 224 # Learning rate initial_learning_rate = 0.001 decay_steps = 250 decay_rate = 0.9 # Validation output_steps = 10 # Number of steps to print output eval_steps = 20 # Number of steps to perform evaluations # Training max_steps = 3000 # Number of steps to perform training save_steps = 200 # Number of steps to perform saving checkpoints num_tests = 5 # Number ...