This is an Tensorflow implementation of DenseNet by G. Huang, Z. Liu, K. Weinberger, and L. van der Maaten with ImageNet pretrained models. The weights are converted from DenseNet-Keras Models.
The code are largely borrowed from TensorFlow-Slim Models.
The top-1/5 accuracy rates by using single center crop (crop size: 224x224, image size: 256xN)
Network | Top-1 | Top-5 | Checkpoints |
---|---|---|---|
DenseNet 121 (k=32) | 74.91 | 92.19 | model |
DenseNet 169 (k=32) | 76.09 | 93.14 | model |
DenseNet 161 (k=48) | 77.64 | 93.79 | model |
Follow the instruction TensorFlow-Slim Models.
$ DATA_DIR=/tmp/data/flowers
$ python download_and_convert_data.py \
--dataset_name=flowers \
--dataset_dir="${DATA_DIR}"
$ DATASET_DIR=/tmp/data/flowers
$ TRAIN_DIR=/tmp/train_logs
$ python train_image_classifier.py \
--train_dir=${TRAIN_DIR} \
--dataset_name=flowers \
--dataset_split_name=train \
--dataset_dir=${DATASET_DIR} \
--model_name=densenet121
$ DATASET_DIR=/tmp/data/flowers
$ TRAIN_DIR=/tmp/train_logs
$ CHECKPOINT_PATH=/tmp/my_checkpoints/tf-densenet121.ckpt
$ python train_image_classifier.py \
--train_dir=${TRAIN_DIR} \
--dataset_name=flowers \
--dataset_split_name=train \
--dataset_dir=${DATASET_DIR} \
--model_name=densenet121 \
--checkpoint_path=${CHECKPOINT_PATH} \
--checkpoint_exclude_scopes=global_step,densenet121/logits \
--trainable_scopes=densenet121/logits