train_cifarnet_on_cifar10.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. #
  3. # This script performs the following operations:
  4. # 1. Downloads the Cifar10 dataset
  5. # 2. Trains a CifarNet model on the Cifar10 training set.
  6. # 3. Evaluates the model on the Cifar10 testing set.
  7. #
  8. # Usage:
  9. # cd slim
  10. # ./scripts/train_cifar_net_on_mnist.sh
  11. # Where the checkpoint and logs will be saved to.
  12. TRAIN_DIR=/tmp/cifarnet-model
  13. # Where the dataset is saved to.
  14. DATASET_DIR=/tmp/cifar10
  15. # Download the dataset
  16. python download_and_convert_data.py \
  17. --dataset_name=cifar10 \
  18. --dataset_dir=${DATASET_DIR}
  19. # Run training.
  20. python train_image_classifier.py \
  21. --train_dir=${TRAIN_DIR} \
  22. --dataset_name=cifar10 \
  23. --dataset_split_name=train \
  24. --dataset_dir=${DATASET_DIR} \
  25. --model_name=cifarnet \
  26. --preprocessing_name=cifarnet \
  27. --max_number_of_steps=100000 \
  28. --batch_size=128 \
  29. --save_interval_secs=120 \
  30. --save_summaries_secs=120 \
  31. --log_every_n_steps=100 \
  32. --optimizer=sgd \
  33. --learning_rate=0.1 \
  34. --learning_rate_decay_factor=0.1 \
  35. --num_epochs_per_decay=200 \
  36. --weight_decay=0.004
  37. # Run evaluation.
  38. python eval_image_classifier.py \
  39. --checkpoint_path=${TRAIN_DIR} \
  40. --eval_dir=${TRAIN_DIR} \
  41. --dataset_name=cifar10 \
  42. --dataset_split_name=test \
  43. --dataset_dir=${DATASET_DIR} \
  44. --model_name=cifarnet