pkulzc Update slim and fix minor issue in object detection (#5354)
* Merged commit includes the following changes:
213899768  by Sergio Guadarrama:

    Fixes #3819.

--
213493831  by Sergio Guadarrama:

    Internal change

212057654  by Sergio Guadarrama:

    Internal change

210747685  by Sergio Guadarrama:

    For FPN, when use_depthwise is set to true, use slightly modified mobilenet v1 config.

--
210128931  by Sergio Guadarrama:

    Allow user-defined current_step in NASNet.

--
209092664  by Sergio Guadarrama:

    Add quantized fine-tuning / training / eval and export to slim image classifier binaries.

--
207651347  by Sergio Guadarrama:

    Update mobilenet v1 docs to include revised tflite models.

--
207165245  by Sergio Guadarrama:

    Internal change

207095064  by Sergio Guadarrama:

    Internal change

PiperOrigin-RevId: 213899768

* Update model_lib.py to fix eval_spec name issue.
Latest commit f505cec Sep 26, 2018

README.md

TensorFlow-Slim NASNet-A Implementation/Checkpoints

This directory contains the code for the NASNet-A model from the paper Learning Transferable Architectures for Scalable Image Recognition by Zoph et al. In nasnet.py there are three different configurations of NASNet-A that are implementented. One of the models is the NASNet-A built for CIFAR-10 and the other two are variants of NASNet-A trained on ImageNet, which are listed below.

Pre-Trained Models

Two NASNet-A checkpoints are available that have been trained on the ILSVRC-2012-CLS image classification dataset. Accuracies were computed by evaluating using a single image crop.

Model Checkpoint Million MACs Million Parameters Top-1 Accuracy Top-5 Accuracy
NASNet-A_Mobile_224 564 5.3 74.0 91.6
NASNet-A_Large_331 23800 88.9 82.7 96.2

Here is an example of how to download the NASNet-A_Mobile_224 checkpoint. The way to download the NASNet-A_Large_331 is the same.

CHECKPOINT_DIR=/tmp/checkpoints
mkdir ${CHECKPOINT_DIR}
cd ${CHECKPOINT_DIR}
wget https://storage.googleapis.com/download.tensorflow.org/models/nasnet-a_mobile_04_10_2017.tar.gz
tar -xvf nasnet-a_mobile_04_10_2017.tar.gz
rm nasnet-a_mobile_04_10_2017.tar.gz

More information on integrating NASNet Models into your project can be found at the TF-Slim Image Classification Library.

To get started running models on-device go to TensorFlow Mobile.

Sample Commands for using NASNet-A Mobile and Large Checkpoints for Inference


Run eval with the NASNet-A mobile ImageNet model

DATASET_DIR=/tmp/imagenet
EVAL_DIR=/tmp/tfmodel/eval
CHECKPOINT_DIR=/tmp/checkpoints/model.ckpt
python tensorflow_models/research/slim/eval_image_classifier \
--checkpoint_path=${CHECKPOINT_DIR} \
--eval_dir=${EVAL_DIR} \
--dataset_dir=${DATASET_DIR} \
--dataset_name=imagenet \
--dataset_split_name=validation \
--model_name=nasnet_mobile \
--eval_image_size=224

Run eval with the NASNet-A large ImageNet model

DATASET_DIR=/tmp/imagenet
EVAL_DIR=/tmp/tfmodel/eval
CHECKPOINT_DIR=/tmp/checkpoints/model.ckpt
python tensorflow_models/research/slim/eval_image_classifier \
--checkpoint_path=${CHECKPOINT_DIR} \
--eval_dir=${EVAL_DIR} \
--dataset_dir=${DATASET_DIR} \
--dataset_name=imagenet \
--dataset_split_name=validation \
--model_name=nasnet_large \
--eval_image_size=331