diff --git a/hpvm/projects/keras/src/alexnet_imagenet.py b/hpvm/projects/keras/src/alexnet_imagenet.py index 5fceb31b31e487f056dca587d3c754d1bc9a37b7..e3ab937e9bb355fde74a63664c8657c76d6343f5 100644 --- a/hpvm/projects/keras/src/alexnet_imagenet.py +++ b/hpvm/projects/keras/src/alexnet_imagenet.py @@ -21,28 +21,19 @@ from Config import MODEL_PARAMS_DIR -IMAGENET_DIR = '/home/nz11/ILSVRC2012/' -NUM_TUNE_CLASSES = 200 -IMAGES_PER_CLASS = 50 - - - class AlexNet(Benchmark): def data_preprocess(self): - - X_val = np.fromfile(MODEL_PARAMS_DIR + '/alexnet_imagenet/test_input.bin', dtype=np.float32) - y_val = np.fromfile(MODEL_PARAMS_DIR + '/alexnet_imagenet/test_labels.bin', dtype=np.uint32) - - X_val = X_val.reshape((-1, 3, 224, 224)) X_train, y_train = None, None - - X_test = X_val[0:5000] - y_test = y_val[0:5000] - X_tuner = X_val[5000:] - y_tuner = y_val[5000:] + X_test = np.fromfile(MODEL_PARAMS_DIR + '/alexnet_imagenet/test_input.bin', dtype=np.float32) + X_test = X_test.reshape((-1, 3, 224, 224)) + y_test = np.fromfile(MODEL_PARAMS_DIR + '/alexnet_imagenet/test_labels.bin', dtype=np.uint32) + X_tuner = np.fromfile(MODEL_PARAMS_DIR + '/alexnet_imagenet/tune_input.bin', dtype=np.float32) + X_tuner = X_tuner.reshape((-1, 3, 224, 224)) + y_tuner = np.fromfile(MODEL_PARAMS_DIR + '/alexnet_imagenet/tune_labels.bin', dtype=np.uint32) + return X_train, y_train, X_test, y_test, X_tuner, y_tuner diff --git a/hpvm/projects/keras/src/lenet.py b/hpvm/projects/keras/src/lenet.py index 83f4d3cf52976de07b55a3b6eefb08ec0a2d0ccf..4b58e65314602512b816bd37a57bcbf95dd54652 100644 --- a/hpvm/projects/keras/src/lenet.py +++ b/hpvm/projects/keras/src/lenet.py @@ -51,7 +51,6 @@ class LeNet_MNIST(Benchmark): def data_preprocess(self): - (X_train, y_train), (X_val, y_val) = mnist.load_data() test_labels = y_val diff --git a/hpvm/projects/keras/src/resnet50_imagenet.py b/hpvm/projects/keras/src/resnet50_imagenet.py index bca4799b75203a82c74ac6656e4e97d24cd6da9a..0c3006213d7880f6133e1f8030256d50d25ea35d 100644 --- a/hpvm/projects/keras/src/resnet50_imagenet.py +++ b/hpvm/projects/keras/src/resnet50_imagenet.py @@ -16,18 +16,11 @@ from keras.utils import to_categorical from keras.preprocessing.image import ImageDataGenerator from keras.callbacks import LearningRateScheduler -from keras.applications.resnet50 import preprocess_input from Benchmark import Benchmark from Config import MODEL_PARAMS_DIR -IMAGENET_DIR = '/home/nz11/ILSVRC2012/' -NUM_TUNE_CLASSES = 200 -IMAGES_PER_CLASS = 50 - - - class ResNet50(Benchmark): def buildModel(self): @@ -120,19 +113,16 @@ class ResNet50(Benchmark): def data_preprocess(self): - - X_val = np.fromfile(MODEL_PARAMS_DIR + '/resnet50_imagenet/test_input.bin', dtype=np.float32) - y_val = np.fromfile(MODEL_PARAMS_DIR + '/resnet50_imagenet/test_labels.bin', dtype=np.uint32) - - X_val = X_val.reshape((-1, 3, 224, 224)) X_train, y_train = None, None - - X_test = X_val[0:5000] - y_test = y_val[0:5000] - X_tuner = X_val[5000:] - y_tuner = y_val[5000:] + X_test = np.fromfile(MODEL_PARAMS_DIR + '/resnet50_imagenet/test_input.bin', dtype=np.float32) + X_test = X_test.reshape((-1, 3, 224, 224)) + y_test = np.fromfile(MODEL_PARAMS_DIR + '/resnet50_imagenet/test_labels.bin', dtype=np.uint32) + X_tuner = np.fromfile(MODEL_PARAMS_DIR + '/resnet50_imagenet/tune_input.bin', dtype=np.float32) + X_tuner = X_tuner.reshape((-1, 3, 224, 224)) + y_tuner = np.fromfile(MODEL_PARAMS_DIR + '/resnet50_imagenet/tune_labels.bin', dtype=np.uint32) + return X_train, y_train, X_test, y_test, X_tuner, y_tuner diff --git a/hpvm/projects/keras/src/vgg16_imagenet.py b/hpvm/projects/keras/src/vgg16_imagenet.py index 5e2bef9c34a4b198a15e32b5a961a498e944e68f..35ab92479e545ba44cf2175cb7b8abcec84c4fed 100644 --- a/hpvm/projects/keras/src/vgg16_imagenet.py +++ b/hpvm/projects/keras/src/vgg16_imagenet.py @@ -21,12 +21,6 @@ from Config import MODEL_PARAMS_DIR -IMAGENET_DIR = '/home/nz11/ILSVRC2012/' -NUM_TUNE_CLASSES = 200 -IMAGES_PER_CLASS = 50 - - - class VGG16(Benchmark): def buildModel(self): @@ -104,19 +98,16 @@ class VGG16(Benchmark): def data_preprocess(self): - - X_val = np.fromfile(MODEL_PARAMS_DIR + '/vgg16_imagenet/test_input.bin', dtype=np.float32) - y_val = np.fromfile(MODEL_PARAMS_DIR + '/vgg16_imagenet/test_labels.bin', dtype=np.uint32) - - X_val = X_val.reshape((-1, 3, 224, 224)) X_train, y_train = None, None - - X_test = X_val[0:5000] - y_test = y_val[0:5000] - X_tuner = X_val[5000:] - y_tuner = y_val[5000:] + X_test = np.fromfile(MODEL_PARAMS_DIR + '/vgg16_imagenet/test_input.bin', dtype=np.float32) + X_test = X_test.reshape((-1, 3, 224, 224)) + y_test = np.fromfile(MODEL_PARAMS_DIR + '/vgg16_imagenet/test_labels.bin', dtype=np.uint32) + X_tuner = np.fromfile(MODEL_PARAMS_DIR + '/vgg16_imagenet/tune_input.bin', dtype=np.float32) + X_tuner = X_tuner.reshape((-1, 3, 224, 224)) + y_tuner = np.fromfile(MODEL_PARAMS_DIR + '/vgg16_imagenet/tune_labels.bin', dtype=np.uint32) + return X_train, y_train, X_test, y_test, X_tuner, y_tuner