resnet-tensorflow
resnet-tensorflow copied to clipboard
Modular Residual Networks implemented in TensorFlow. Easily change hyperparameters in a few lines.
Residual Networks in TensorFlow
Residual Network in TensorFlow
This entire code is implemented in pure TensorFlow and I have made it simple to run with different settings.
Simple Instructions
-
Running Training and Evaluation
python main.py- If you want to modify any parameters, you can use for example
python main.py --n_epoch==10- The default runs on CIFAR-10 dataset and this configuration is made for that.
n_epoch: number of epochs- Default
10
- Default
n_batch: batch size- Default
64
- Default
n_img_row: dimension of image (row)- Default
32
- Default
n_img_col: dimension of image (col)- Default
32
- Default
n_img_channels: number of channels- Default
3
- Default
n_classes: number of classes- Default
10
- Default
lr: learning rate (momentum optimizer)- Default
0.1
- Default
n_resid_units: number of residual units- Default
5
- Default
lr_schedule: number of epoch for the learning rate to decrease bylr_factor- Default
60 - This multiplies the LR every 60 epochs by
lr_factor.
- Default
lr_factor: the factor for reducing LR- Default
0.1.
- Default
- If you want to modify any parameters, you can use for example
-
Running TensorBoard
- Training logs
tensorboard --logdir=train_log
- Evaluation logs
tensorboard --logdir=eval_log
- You can use any path you want.
- If you encountered a
permission deniederror, you can easily solve it by changing the directory totmp/train_log. - I experienced this while running on Amazon AWS and it was solved with this fix.
- If you encountered a
- Training logs
Credits
- The original model was obtained from the official repository by TensorFlow.
- The paper on Residual Networks on arXiv.org.
Dependencies
- To simplify the code, I read the CIFAR dataset using TensorLayer.
- Simply run
sudo pip install tensorlayerand you are good to go.
- Simply run
- TensorFlow v0.12
- If you would like to run this code in a few minutes on Amazon AWS, just use the open-source AMI TFAMI.v3.
License
MIT