From 069679e97600146a3ef0bacc9beff677ffb2d999 Mon Sep 17 00:00:00 2001 From: Ryan Zotti Date: Sat, 28 Oct 2017 15:21:18 -0500 Subject: [PATCH] Apply transform consistently between training and scoring --- data_augmentation.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/data_augmentation.py b/data_augmentation.py index 6ac93f1e..8d0092e3 100644 --- a/data_augmentation.py +++ b/data_augmentation.py @@ -66,7 +66,15 @@ def normalize_contrast(images): # Collapses multiple data transformations; primarily used in model training scritps def process_data(data): images, labels = data[0], data[1] - images = normalize_contrast(images) images, labels = flip_enrichment(images, labels) + images = apply_transformations(images) + return images, labels + + +# I've separated this from `process_data` so that I can use it in both training +# and scoring. Relying on process_data alone wasn't sufficient for scoring +# because during scoring the true labels aren't known at runtime +def apply_transformations(images): + images = normalize_contrast(images) images = images / 255 - return images, labels \ No newline at end of file + return images \ No newline at end of file