天天看點

DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略

 DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略

目錄

MXNet 的簡介 1、優缺點 2、相關文章 3、相關連結 MXNet 的安裝 MXNet 的使用方法 1、個人使用總結 2、經典模型集合—MXNet Model Zoo 3、模型分類 MXNet 的應用案例

DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略

        A flexible and efficient library for deep learning.

  MXNet 是亞馬遜(Amazon)選擇的深度學習庫,并且也許是最優秀的庫之一。它擁有類似于 Theano 和 TensorFlow 的資料流圖,為多 GPU 配置提供了良好的配置,有着類似于 Lasagne 和 Blocks 更進階别的模型建構塊,并且可以在你可以想象的任何硬體上運作(包括手機)。對 Python 的支援隻是其冰山一角—MXNet 同樣提供了對 R、Julia、C++、Scala、Matlab,和 Javascript 的接口。

        MXNet 是一個旨在提高效率和靈活性的深度學習架構。像MXNet這樣的加速庫提供了強大的工具來幫助開發人員利用GPU和雲計算的全部功能。雖然這些工具通常适用于任何數學計算,但MXNet特别強調加速大規模深度神經網絡的開發和部署。特别是,我們提供以下功能:

  • 裝置放置:使用MXNet,可以輕松指定每個資料結構的生存位置。
  • 多GPU教育訓練:MXNet可以通過可用GPU的數量輕松擴充計算。
  • 自動區分:MXNet自動執行曾經陷入神經網絡研究的衍生計算。
  • 優化的預定義圖層:雖然您可以在MXNet中編寫自己的圖層,但預定義的圖層會針對速度進行優化,優于競争庫。

        MXNet 官方自我評價:MXNet結合了高性能,幹淨的代碼,進階API通路和低級控制,是深度學習架構中獨一無二的選擇。

優點:

  1. 速度的标杆
  2. 靈活的程式設計模型:非常靈活。支援指令式和符号式程式設計模型以最大化效率和性能。
  3. 從雲端到用戶端可移植:可運作于多CPU、多GPU、叢集、伺服器、工作站甚至移動智能手機。
  4. 多語言支援:支援七種主流程式設計語言,包括C++、Python、R、Scala、Julia、Matlab和JavaScript。事實上,它是唯一支援所有 R 函數的構架。
  5. 本地分布式訓練:支援在多CPU/GPU裝置上的分布式訓練,使其可充分利用雲計算的規模優勢。
  6. 性能優化:使用一個優化的C++後端引擎并行I/O和計算,無論使用哪種語言都能達到最佳性能。
  7. 雲端友好,可直接與S3,HDFS和Azure相容

缺點:

  1. 最小的社群
  2. 比 Theano 學習更困難一點

MXNet: A Flexible and Efficient Machine Learning Library for Heterogeneous Distributed Systems

DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略

        MXnet是一個多語言機器學習(ML)庫,用于簡化ML算法的開發,特别是對于深度神經網絡。它嵌入在宿主語言中,将聲明性符号表達式與指令式張量計算混合在一起。它提供自動微分來推導梯度。MXnet具有計算和記憶體效率高的特點,可以在各種異構系統上運作,從移動裝置到分布式GPU叢集。本文介紹了MXnet的API設計和系統實作,并解釋了如何統一處理符号表達式和張量操作的嵌入。我們的初步實驗表明,在使用多個GPU機器的大規模深度神經網絡應用中,有着很好的結果。

官網位址:

Apache MXNet | A flexible and efficient library for deep learning.

GitHub位址01:

https://github.com/dmlc/mxnet

GitHub位址02:

https://github.com/apache/incubator-mxnet/tree/master/example

MXNet - Python API:

http://mxnet.incubator.apache.org/api/python/index.html#python-api-reference

PyPi位址:

mxnet · PyPI

1、第一次安裝

pip install mxnet

DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略
Collecting mxnet
  Downloading https://files.pythonhosted.org/packages/d1/b6/38d9ab1b16c456224823e737f1bb95fe3ff056f3834fba01cd157d59b574/mxnet-1.4.0.post0-py2.py3-none-win_amd64.whl (21.9MB)
    100% |████████████████████████████████| 21.9MB 34kB/s
Requirement already satisfied: requests<2.19.0,>=2.18.4 in f:\program files\python\python36\lib\site-packages (from mxnet) (2.18.4)
Collecting graphviz<0.9.0,>=0.8.1 (from mxnet)
  Downloading https://files.pythonhosted.org/packages/53/39/4ab213673844e0c004bed8a0781a0721a3f6bb23eb8854ee75c236428892/graphviz-0.8.4-py2.py3-none-any.whl
Collecting numpy<1.15.0,>=1.8.2 (from mxnet)
  Downloading https://files.pythonhosted.org/packages/dc/99/f824a73251589d9fcef2384f9dd21bd1601597fda92ced5882940586ec37/numpy-1.14.6-cp36-none-win_amd64.whl (13.4MB)
    100% |████████████████████████████████| 13.4MB 30kB/s
Requirement already satisfied: certifi>=2017.4.17 in f:\program files\python\python36\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet) (2018.1.18)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in f:\program files\python\python36\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet) (3.0.4)
Requirement already satisfied: urllib3<1.23,>=1.21.1 in f:\program files\python\python36\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet) (1.22)
Requirement already satisfied: idna<2.7,>=2.5 in f:\program files\python\python36\lib\site-packages (from requests<2.19.0,>=2.18.4->mxnet) (2.6)
tensorflow-gpu 1.4.0 requires enum34>=1.1.6, which is not installed.
tensorflow 1.10.0 has requirement numpy<=1.14.5,>=1.13.3, but you'll have numpy 1.14.6 which is incompatible.
moviepy 0.2.3.2 has requirement decorator==4.0.11, but you'll have decorator 4.3.0 which is incompatible.
moviepy 0.2.3.2 has requirement tqdm==4.11.2, but you'll have tqdm 4.25.0 which is incompatible.
Installing collected packages: graphviz, numpy, mxnet
  Found existing installation: numpy 1.15.0rc1+mkl
    Uninstalling numpy-1.15.0rc1+mkl:
Could not install packages due to an EnvironmentError: [WinError 5] 拒絕通路。: 'f:\\program files\\python\\python36\\lib\\site-packages\\numpy\\core\\_multiarray_tests.cp36-win_amd64.pyd'
Consider using the `--user` option or check the permissions.      
DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略

遇到問題:

成功解決Could not install packages due to an EnvironmentError: [WinError 5] 拒絕通路。: 'f:\\program files\\p

2、第二次安裝

DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略
tensorflow-gpu 1.4.0 requires enum34>=1.1.6, which is not installed.
tensorflow 1.10.0 has requirement numpy<=1.14.5,>=1.13.3, but you'll have numpy 1.14.6 which is incompatible.
moviepy 0.2.3.2 has requirement decorator==4.0.11, but you'll have decorator 4.3.0 which is incompatible.
moviepy 0.2.3.2 has requirement tqdm==4.11.2, but you'll have tqdm 4.25.0 which is incompatible.      
DL架構之MXNet :深度學習架構之MXNet 的簡介、安裝、使用方法、應用案例之詳細攻略

後期更新……

DL架構之MXNet :深度學習架構之MXNet 常見使用方法(個人使用)總結之詳細攻略

相關連結:

Alias Network # Parameters Top-1 Accuracy Top-5 Accuracy Origin
alexnet AlexNet 61,100,840 0.5492 0.7803 Converted from pytorch vision
densenet121 DenseNet-121 8,062,504 0.7497 0.9225
densenet161 DenseNet-161 28,900,936 0.7770 0.9380
densenet169 DenseNet-169 14,307,880 0.7617 0.9317
densenet201 DenseNet-201 20,242,984 0.7732 0.9362
inceptionv3 Inception V3 299x299 23,869,000 0.7755 0.9364
mobilenet0.25 MobileNet 0.25 475,544 0.5185 0.7608 Trained with script
mobilenet0.5 MobileNet 0.5 1,342,536 0.6307 0.8475
mobilenet0.75 MobileNet 0.75 2,601,976 0.6738 0.8782
mobilenet1.0 MobileNet 1.0 4,253,864 0.7105 0.9006
mobilenetv2_1.0 MobileNetV2 1.0 3,539,136 0.7192 0.9056
mobilenetv2_0.75 MobileNetV2 0.75 2,653,864 0.6961 0.8895
mobilenetv2_0.5 MobileNetV2 0.5 1,983,104 0.6449 0.8547
mobilenetv2_0.25 MobileNetV2 0.25 1,526,856 0.5074 0.7456
resnet18_v1 ResNet-18 V1 11,699,112 0.7093 0.8992
resnet34_v1 ResNet-34 V1 21,814,696 0.7437 0.9187
resnet50_v1 ResNet-50 V1 25,629,032 0.7647 0.9313
resnet101_v1 ResNet-101 V1 44,695,144 0.7834 0.9401
resnet152_v1 ResNet-152 V1 60,404,072 0.7900 0.9438
resnet18_v2 ResNet-18 V2 11,695,796 0.7100
resnet34_v2 ResNet-34 V2 21,811,380 0.7440 0.9208
resnet50_v2 ResNet-50 V2 25,595,060 0.7711 0.9343
resnet101_v2 ResNet-101 V2 44,639,412 0.7853 0.9417
resnet152_v2 ResNet-152 V2 60,329,140 0.7921 0.9431
squeezenet1.0 SqueezeNet 1.0 1,248,424 0.5611 0.7909
squeezenet1.1 SqueezeNet 1.1 1,235,496 0.5496 0.7817
vgg11 VGG-11 132,863,336 0.6662 0.8734
vgg13 VGG-13 133,047,848 0.6774 0.8811
vgg16 VGG-16 138,357,544 0.7323 0.9132
vgg19 VGG-19 143,667,240 0.7411 0.9135
vgg11_bn VGG-11 with batch normalization 132,874,344 0.6859 0.8872
vgg13_bn VGG-13 with batch normalization 133,059,624 0.6884 0.8882
vgg16_bn VGG-16 with batch normalization 138,374,440 0.7310 0.9176
vgg19_bn VGG-19 with batch normalization 143,689,256 0.7433 0.9185

get_model

Returns a pre-defined model by name

ResNet

resnet18_v1

ResNet-18 V1 model from “Deep Residual Learning for Image Recognition” paper.

resnet34_v1

ResNet-34 V1 model from

resnet50_v1

ResNet-50 V1 model from

resnet101_v1

ResNet-101 V1 model from

resnet152_v1

ResNet-152 V1 model from

resnet18_v2

ResNet-18 V2 model from “Identity Mappings in Deep Residual Networks”

resnet34_v2

ResNet-34 V2 model from

resnet50_v2

ResNet-50 V2 model from

resnet101_v2

ResNet-101 V2 model from

resnet152_v2

ResNet-152 V2 model from

ResNetV1

ResNet V1 model from

ResNetV2

ResNet V2 model from

BasicBlockV1

BasicBlock V1 from

BasicBlockV2

BasicBlock V2 from

BottleneckV1

Bottleneck V1 from

BottleneckV2

Bottleneck V2 from

get_resnet

VGG

vgg11

VGG-11 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition”

vgg13

VGG-13 model from the

vgg16

VGG-16 model from the

vgg19

VGG-19 model from the

vgg11_bn

VGG-11 model with batch normalization from the

vgg13_bn

VGG-13 model with batch normalization from the

vgg16_bn

VGG-16 model with batch normalization from the

vgg19_bn

VGG-19 model with batch normalization from the

VGG

VGG model from the

get_vgg

Alexnet

alexnet

AlexNet model from the “One weird trick...”

AlexNet

DenseNet

densenet121

Densenet-BC 121-layer model from the “Densely Connected Convolutional Networks”

densenet161

Densenet-BC 161-layer model from the

densenet169

Densenet-BC 169-layer model from the

densenet201

Densenet-BC 201-layer model from the

DenseNet

Densenet-BC model from the

SqueezeNet

squeezenet1_0

SqueezeNet 1.0 model from the “SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size”

squeezenet1_1

SqueezeNet 1.1 model from the official SqueezeNet repo .

SqueezeNet

SqueezeNet model from the

Inception

Inception3

MobileNet

mobilenet1_0

MobileNet model from the “MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications” paper, with width multiplier 1.0.

mobilenet0_75

paper, with width multiplier 0.75.

mobilenet0_5

paper, with width multiplier 0.5.

mobilenet0_25

paper, with width multiplier 0.25.

mobilenet_v2_1_0

MobileNetV2 model from the “Inverted Residuals and Linear Bottlenecks: Mobile Networks for Classification, Detection and Segmentation”

mobilenet_v2_0_75

mobilenet_v2_0_5

mobilenet_v2_0_25

MobileNet

MobileNetV2

後期繼續更新……