资源算法mobilenetv2-tf2

mobilenetv2-tf2

2020-02-28 | |  98 |   0 |   0

mobilenetv2-tf2

A TensorFlow 2.0 implementation of Inverted Residuals and Linear Bottlenecks Mobile Networks for Classification, Detection and Segmentation, aka MobileNetV2.

Motivation

MobileNetV2 is still one of the most efficient architectures for image classification. Considering that TensorFlow 2.0 has already hit version beta1, I think that a flexible and reusable implementation of MobileNetV2 in TF 2.0 might be useful for practitioners.

Implementation

I implemented a running mean and standard deviation calculation with Welford algorithm, which eliminates the problem of loading the whole dataset into the memory. Normalizer class, calculating the mean and standard deviation, is also used as a preprocessing_function argument to tf.keras.preprocessing.image.ImageDataGenerator.

Install

  1. conda create -n mobilenetv2 python=3.6.8

  2. conda activate mobilenetv2

  3. git clone https://github.com/monatis/mobilenetv2-tf2.git

  4. cd mobilenetv2-tf2

  5. python -m pip install -r requirements.gpu.txt # Change to requirements.cpu.txt if you're not using GPU.

Usage

train_dir and validation_dir directories should contain a subdirectory for each class in the dataset. Then run:

  • python train.py --train_dir /path/to/training/images --validation_dir /path/to/validation/images

  • See model/ directory for training output.

run python train.py --help to see all the options.

Roadmap

  •  Share model architecture and a training script.

  •  Implement export to saved model.

  •  Implement command line arguments to configure data augmentation.

  •  Share an inference script.

  •  Implement mean and STD normalization.

  •  Implement confusion matrix.

  •  Implement export to TFLite for model inference.

  •  Share an example Android app using the exported TFLite model.

License

MIT


上一篇: Tensorflow-MobileNetV1

下一篇:opencv_mobilenet

用户评价
全部评价

热门资源

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • shih-styletransfer

    shih-styletransfer Code from Style Transfer ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...