Skip to content
Snippets Groups Projects
Commit f170c07d authored by nz11's avatar nz11
Browse files

Update vgg16_imagenet.py

parent 328fa40c
No related branches found
No related tags found
No related merge requests found
......@@ -32,7 +32,7 @@ IMAGENET_DIR = '/home/nz11/ILSVRC2012/'
OUTPUT_DIR = 'data/vgg16_imagenet_tune/'
NUM_CLASSES = 200
IMAGES_PER_CLASS = 40
IMAGES_PER_CLASS = 50
# VAL_SIZE = 100
......@@ -212,18 +212,22 @@ y_true = np.array(y_true)
X_tune = np.array(X_tune)
y_tune = np.array(y_tune)
print ('tune size', len(X_tune))
print ('test size', len(X_test))
translate_to_approxhpvm(model, OUTPUT_DIR, X_tune, y_tune, 1000)
# dumpCalibrationData2(OUTPUT_DIR + 'test_input_10K.bin', X_test, OUTPUT_DIR + 'test_labels_10K.bin', y_true)
dumpCalibrationData2(OUTPUT_DIR + 'tune_input.bin', X_tune, OUTPUT_DIR + 'tune_labels.bin', y_tune)
dumpCalibrationData2(OUTPUT_DIR + 'test_input.bin', X_test, OUTPUT_DIR + 'test_labels.bin', y_true)
translate_to_approxhpvm(model, OUTPUT_DIR, X_tune, y_tune, 1000, dump_weights=False)
# # dumpCalibrationData2(OUTPUT_DIR + 'test_input_10K.bin', X_test, OUTPUT_DIR + 'test_labels_10K.bin', y_true)
# dumpCalibrationData2(OUTPUT_DIR + 'tune_input.bin', X_tune, OUTPUT_DIR + 'tune_labels.bin', y_tune)
# dumpCalibrationData2(OUTPUT_DIR + 'test_input.bin', X_test, OUTPUT_DIR + 'test_labels.bin', y_true)
pred = np.argmax(model.predict(X_test), axis=1)
print ('val accuracy', np.sum(pred == y_true.ravel()) / len(X_test))
pred = np.argmax(model.predict(X_tune), axis=1)
print ('val accuracy', np.sum(pred == y_tune.ravel()) / len(X_tune))
# pred = np.argmax(model.predict(X_tune), axis=1)
# print ('val accuracy', np.sum(pred == y_tune.ravel()) / len(X_tune))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment