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

Fix vgg16_imagenet.py

parent 18304ebe
No related branches found
No related tags found
No related merge requests found
......@@ -206,20 +206,14 @@ if __name__ == '__main__':
f = open("/home/nz11/ILSVRC2012/ILSVRC2012_devkit_t12/data/ILSVRC2012_validation_ground_truth.txt","r")
y_true = f.read().strip().split("\n")
y_true = list(map(int, y_true))
y_true = np.array([convert_original_idx_to_keras_idx(idx) for idx in y_true])[idx]
y_true = to_categorical(y_true, num_classes=1000)
y_true = np.array([convert_original_idx_to_keras_idx(idx) for idx in y_true])[idx]
y_true = y_true.astype(np.uint32)
f.close()
translate_to_approxhpvm(model_nchw, "data/vgg16_imagenet/", X_test[:val_size], y_true[:val_size], 1000)
dumpCalibrationData("data/vgg16_imagenet/test_input.bin", X_test, "data/vgg16_imagenet/test_labels.bin", y_true)
y_pred = model_nchw.predict(X_test[:val_size])
print ('val accuracy', np.sum(np.argmax(y_pred, axis=1) == np.argmax(y_true[:val_size], axis=1)) / val_size)
dumpCalibrationData("data/vgg16_imagenet/test_input.bin", X_test, "data/vgg16_imagenet/test_labels.bin", y_true)
\ No newline at end of file
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