diff --git a/hpvm/projects/keras/README.md b/hpvm/projects/keras/README.md index 7852e1fca775d0a184e02fe2f01746f750b2ac08..e092715a076bd8a00c5252d7dc901c5189a70746 100644 --- a/hpvm/projects/keras/README.md +++ b/hpvm/projects/keras/README.md @@ -42,6 +42,8 @@ python setup.py install Benchmarks under `./src/` +**NOTE:** Activate conda environment (above) before running benchmarks + List of benchmarks and the expected accuracies: | Benchmark | Accuracy | @@ -57,12 +59,11 @@ List of benchmarks and the expected accuracies: | VGG16-CIFAR100 | 66.50 | | VGG16-ImageNet | 69.46 | -Activate conda environment (above) before running benchmarks ### Synopsis ``` -python src/${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend|keras_dump] +python src/${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend] ``` @@ -72,30 +73,45 @@ python src/${BENCH_NAME}.py [hpvm_reload|keras_reload] [frontend|keras_dump] `keras_reload`: Reloads weights in Keras `.h5` file format -`frontend`: Invokes the HPVM frontend and dumps weights in directory specified in constructor - -`keras_dump`: Dumps keras .h5 format model weights in directory specified in constructor +`frontend`: Invokes the HPVM frontend and dumps weights (in HPVM `.bin` format) in directory specified ### Building New Benchmarks All benchmarks inherit from the commom parent `Benchmark` class. -Each benchmark overrides virtual functions for building the model, training, inference, +Each benchmark overrides virtual functions for building the model, training, and data preprocessing. `def buildModel(self)`: -returns a keras model +Constructs and returns a keras model `def data_preprocess(self)`: -returns X_train, y_train, X_test, y_test, X_tuner, and y_tuner data — in that order; this data will be directly used later for training and inference +returns X_train, y_train, X_test, y_test, X_tuner, and y_tuner data (in that order): +These are described here: + +* `X_train:` Training data (fp32) in NCHW format +* `y_train:` Training labels (int32) + +* `X_test:` Testing/Evaluation data in NCHW format +* `y_test:` Testing/Evaluation labels + +* `X_tuner:` Data to be used for autotuning +* `y_tuner:` Labels corresponding to tuning data + `def trainModel(self, model, X_train, y_train, X_test, y_test)`: -returns a trained keras model +Trains the Keras model constructed in `buildModel` and is expected to return the +trained keras model - training parameters should be tuned here. +## Limitations +* We mosty support convolutional neural networks - RNNs/LSTMS are not supported +* We currently only support models in NCHW format (NHWC is not supported) +* Softmax operator should be the last operation in the CNN pipeline +* Softmax operation must be a separate operator (not specified as activation to another type of Keras operator)