Skip to content

Commit 1163b4d

Browse files
committed
add readme
1 parent f5a3af1 commit 1163b4d

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

examples/mnist/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# MNIST Example
2+
3+
This example demonstrate how to convert keras code into CANDLE compliant.
4+
Please refer [tutorial](https://ecp-candle.github.io/Candle/html/tutorials/writing_candle_code.html) for more detail.
5+
6+
Here is the list of files,
7+
8+
- mnist.py: CANDLE class
9+
- mnist_cnn.py and mnist_mlp.py: original mnist implementation from keras project
10+
- mnist_cnn_candle.py: mnist_cnn.py converted in CANDLE compliant mode
11+
- mnist_mlp_candle.py: mnist_mlp.py converted in CANDLE compliant mode
12+
- mnist_params.txt: model parameters are stored in a file for reproduciblity
13+
14+
15+
```
16+
$ python mnist_cnn_candle.py -e 3
17+
Using TensorFlow backend.
18+
19+
Importing candle utils for keras
20+
Params:
21+
{'activation': 'relu',
22+
'batch_size': 128,
23+
'data_type': <class 'numpy.float32'>,
24+
'epochs': 3,
25+
'experiment_id': 'EXP000',
26+
'gpus': [],
27+
'logfile': None,
28+
'optimizer': 'rmsprop',
29+
'output_dir': '/Users/hsyoo/projects/CANDLE/Benchmarks/examples/mnist/Output/EXP000/RUN000',
30+
'profiling': False,
31+
'rng_seed': 7102,
32+
'run_id': 'RUN000',
33+
'shuffle': False,
34+
'timeout': -1,
35+
'train_bool': True,
36+
'verbose': None}
37+
Downloading data from https://s3.amazonaws.com/img-datasets/mnist.npz
38+
11493376/11490434 [==============================] - 2s 0us/step
39+
x_train shape: (60000, 28, 28, 1)
40+
60000 train samples
41+
10000 test samples
42+
Instructions for updating:
43+
Please use `rate` instead of `keep_prob`. Rate should be set to `rate = 1 - keep_prob`.
44+
45+
Instructions for updating:
46+
Use tf.where in 2.0, which has the same broadcast rule as np.where
47+
Train on 60000 samples, validate on 10000 samples
48+
Epoch 1/3
49+
2020-05-13 11:53:17.373979: I tensorflow/core/platform/cpu_feature_guard.cc:145] This TensorFlow binary is optimized with Intel(R) MKL-DNN to use the following CPU instructions in performance critical operations: SSE4.1 SSE4.2 AVX AVX2 FMA
50+
To enable them in non-MKL-DNN operations, rebuild TensorFlow with the appropriate compiler flags.
51+
2020-05-13 11:53:17.374474: I tensorflow/core/common_runtime/process_util.cc:115] Creating new thread pool with default inter op setting: 16. Tune using inter_op_parallelism_threads for best performance.
52+
60000/60000 [==============================] - 56s 932us/step - loss: 0.2719 - acc: 0.9157 - val_loss: 0.0683 - val_acc: 0.9774
53+
Epoch 2/3
54+
60000/60000 [==============================] - 55s 909us/step - loss: 0.0904 - acc: 0.9733 - val_loss: 0.0411 - val_acc: 0.9872
55+
Epoch 3/3
56+
60000/60000 [==============================] - 55s 909us/step - loss: 0.0666 - acc: 0.9808 - val_loss: 0.0339 - val_acc: 0.9893
57+
Test loss: 0.03386178284487105
58+
Test accuracy: 0.9893
59+
```

0 commit comments

Comments
 (0)