• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

MG2033/MobileNet: A Clearer and Simpler MobileNet Implementation in TensorFlow

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

MG2033/MobileNet

开源软件地址(OpenSource Url):

https://github.com/MG2033/MobileNet

开源编程语言(OpenSource Language):

Python 100.0%

开源软件介绍(OpenSource Introduction):

MobileNet

An implementation of Google MobileNet introduced in TensorFlow. According to the authors, MobileNet is a computationally efficient CNN architecture designed specifically for mobile devices with very limited computing power. It can be used for different applications including: Object-Detection, Finegrain Classification, Face Attributes and Large Scale Geo-Localization.

Link to the original paper: MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications

This implementation was made to be clearer than TensorFlow original implementation. It was also made to be an example of a common DL software architecture. The weights/biases/parameters from the pretrained ImageNet model that was implemented by TensorFlow are dumped to a dictionary in pickle format file (pretrained_weights/mobilenet_v1.pkl) to allow a less restrictive way of loading them.

Depthwise Separable Convolution



ReLU6

The paper uses ReLU6 as an activation function. ReLU6 was first introduced in Convolutional Deep Belief Networks on CIFAR-10 as a ReLU with clipping its output at 6.0.

Usage

Main Dependencies

Python 3 and above
tensorflow 1.3.0
numpy 1.13.1
tqdm 4.15.0
easydict 1.7
matplotlib 2.0.2
pillow 5.0.0

Train and Test

  1. Prepare your data, and modify the data_loader.py/DataLoader/load_data() method.
  2. Modify the config/test.json to meet your needs.

Note: If you want to test that the model is pretrained and working properly, I've added some test images from different classes in directory 'data/test_images'. All of them are classified correctly.

Run

python3 main.py --config config/test.json

The file 'test.json' is just an example of a file. If you run it as is, it will test the model against the images in directory 'data/test_images'. You can create your own configuration file for training/testing.

Benchmarking

The paper has achieved 569 Mult-Adds. In my implementation, I have achieved approximately 1140 MFLOPS. The paper counts multiplication+addition as one unit. My result verifies the paper as roughly dividing 1140 by 2 is equal to 569 unit.

To calculate the FLOPs in TensorFlow, make sure to set the batch size equal to 1, and execute the following line when the model is loaded into memory.

tf.profiler.profile(
        tf.get_default_graph(),
        options=tf.profiler.ProfileOptionBuilder.float_operation(), cmd='scope')

I've already implemented this function. It's called calculate_flops() in utils.py. Use it directly if you want.

Updates

  • Inference and training are working properly.

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
sebarmeli/JS-Redirection-Mobile-Site: JS to handle the redirection to the mobile ...发布时间:2022-08-30
下一篇:
ContactAssistApp/mobile发布时间:2022-08-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap