DL框架之MXNet :深度学习框架之MXNet 的简介、安装、使用方法、应用案例之详细攻略

简介: MXNet 是亚马逊(Amazon)选择的深度学习库,并且也许是最优秀的库之一。它拥有类似于 Theano 和 TensorFlow 的数据流图,为多 GPU 配置提供了良好的配置,有着类似于 Lasagne 和 Blocks 更高级别的模型构建块,并且可以在你可以想象的任何硬件上运行(包括手机)。对 Python 的支持只是其冰山一角—MXNet 同样提供了对 R、Julia、C++、Scala、Matlab,和 Javascript 的接口。

 DL框架之MXNet :深度学习框架之MXNet 的简介、安装、使用方法、应用案例之详细攻略

目录

MXNet 的简介

1、优缺点

2、相关文章

3、相关链接

MXNet 的安装

MXNet 的使用方法

1、个人使用总结

2、经典模型集合—MXNet Model Zoo

3、模型分类

MXNet 的应用案例


MXNet 的简介

image.gif

       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、优缺点

    优点

      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 学习更困难一点

        2、相关文章

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

        image.gif

               MXnet是一个多语言机器学习(ML)库,用于简化ML算法的开发,特别是对于深度神经网络。它嵌入在宿主语言中,将声明性符号表达式与命令式张量计算混合在一起。它提供自动微分来推导梯度。MXnet具有计算和内存效率高的特点,可以在各种异构系统上运行,从移动设备到分布式GPU集群。本文介绍了MXnet的API设计和系统实现,并解释了如何统一处理符号表达式和张量操作的嵌入。我们的初步实验表明,在使用多个GPU机器的大规模深度神经网络应用中,有着很好的结果。

        3、相关链接

        官网地址: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

         

        MXNet 的安装

        1、第一次安装

        pip install mxnet

        image.gif

        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.

        image.gif

        遇到问题:成功解决Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'f:\\program files\\p

        2、第二次安装

        image.gif

        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.

        image.gif

        MXNet 的使用方法

        后期更新……

        1、个人使用总结

        DL框架之MXNet :深度学习框架之MXNet 常见使用方法(个人使用)总结之详细攻略

        相关链接:Apache MXNet | A flexible and efficient library for deep learning.

        2、经典模型集合—MXNet Model Zoo

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

        3、模型分类

        ResNet

        resnet18_v1 ResNet-18 V1 model from “Deep Residual Learning for Image Recognition” paper.
        resnet34_v1 ResNet-34 V1 model from “Deep Residual Learning for Image Recognition” paper.
        resnet50_v1 ResNet-50 V1 model from “Deep Residual Learning for Image Recognition” paper.
        resnet101_v1 ResNet-101 V1 model from “Deep Residual Learning for Image Recognition” paper.
        resnet152_v1 ResNet-152 V1 model from “Deep Residual Learning for Image Recognition” paper.
        resnet18_v2 ResNet-18 V2 model from “Identity Mappings in Deep Residual Networks” paper.
        resnet34_v2 ResNet-34 V2 model from “Identity Mappings in Deep Residual Networks” paper.
        resnet50_v2 ResNet-50 V2 model from “Identity Mappings in Deep Residual Networks” paper.
        resnet101_v2 ResNet-101 V2 model from “Identity Mappings in Deep Residual Networks” paper.
        resnet152_v2 ResNet-152 V2 model from “Identity Mappings in Deep Residual Networks” paper.
        ResNetV1 ResNet V1 model from “Deep Residual Learning for Image Recognition” paper.
        ResNetV2 ResNet V2 model from “Identity Mappings in Deep Residual Networks” paper.
        BasicBlockV1 BasicBlock V1 from “Deep Residual Learning for Image Recognition” paper.
        BasicBlockV2 BasicBlock V2 from “Identity Mappings in Deep Residual Networks” paper.
        BottleneckV1 Bottleneck V1 from “Deep Residual Learning for Image Recognition” paper.
        BottleneckV2 Bottleneck V2 from “Identity Mappings in Deep Residual Networks” paper.
        get_resnet ResNet V1 model from “Deep Residual Learning for Image Recognition” paper.

        VGG

        vgg11 VGG-11 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg13 VGG-13 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg16 VGG-16 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg19 VGG-19 model from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg11_bn VGG-11 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg13_bn VGG-13 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg16_bn VGG-16 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.
        vgg19_bn VGG-19 model with batch normalization from the “Very Deep Convolutional Networks for Large-Scale Image Recognition” paper.

        Alexnet

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

        DenseNet

        densenet121 Densenet-BC 121-layer model from the “Densely Connected Convolutional Networks” paper.
        densenet161 Densenet-BC 161-layer model from the “Densely Connected Convolutional Networks” paper.
        densenet169 Densenet-BC 169-layer model from the “Densely Connected Convolutional Networks” paper.
        densenet201 Densenet-BC 201-layer model from the “Densely Connected Convolutional Networks” paper.
        DenseNet Densenet-BC model from the “Densely Connected Convolutional Networks” paper.

        SqueezeNet

        squeezenet1_0 SqueezeNet 1.0 model from the “SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and <0.5MB model size” paper.
        squeezenet1_1 SqueezeNet 1.1 model from the official SqueezeNet repo.

        Inception

        inception_v3 Inception v3 model from “Rethinking the Inception Architecture for Computer Vision” paper.
        Inception3 Inception v3 model from “Rethinking the Inception Architecture for Computer Vision” paper.

        MobileNet

        MXNet 的应用案例

        后期继续更新……


        相关实践学习
        基于阿里云DeepGPU实例,用AI画唯美国风少女
        本实验基于阿里云DeepGPU实例,使用aiacctorch加速stable-diffusion-webui,用AI画唯美国风少女,可提升性能至高至原性能的2.6倍。
        相关文章
        |
        8天前
        |
        机器学习/深度学习 API 语音技术
        |
        10天前
        |
        机器学习/深度学习 监控 安全
        智能化视野下的守卫者:基于深度学习的图像识别技术在智能监控领域的革新应用
        【4月更文挑战第9天】 随着人工智能技术的飞速发展,深度学习已经成为了推动计算机视觉进步的重要力量。尤其在智能监控领域,基于深度学习的图像识别技术正逐步转变着传统监控系统的功能与效率。本文旨在探讨深度学习技术如何赋能智能监控,提高对场景理解的准确性,增强异常行为检测的能力,并讨论其在实际部署中所面临的挑战和解决方案。通过深入分析,我们揭示了深度学习在智能监控中的应用不仅优化了安全防范体系,也为城市管理和公共安全提供了有力的技术支持。
        |
        10天前
        |
        机器学习/深度学习 算法 数据处理
        深度学习在图像识别中的创新应用
        【4月更文挑战第9天】 随着人工智能技术的飞速发展,深度学习已成为推动计算机视觉领域进步的关键技术之一。特别是在图像识别任务中,深度学习模型已经展现出超越传统算法的性能。本文将深入探讨深度学习在图像识别领域的最新进展,包括卷积神经网络(CNN)的变体、数据增强技术以及迁移学习等策略。通过对这些技术的综合运用,我们能够实现对复杂图像数据的高效识别和分类,进一步拓展了深度学习在实际应用中的可能性。
        12 1
        |
        10天前
        |
        机器学习/深度学习 人工智能 算法
        深度学习在医学影像诊断中的应用与挑战
        传统医学影像诊断一直是医学领域的重要组成部分,但其依赖于医生的经验和技能,存在着诊断准确性不高和效率低下的问题。近年来,随着深度学习技术的发展,越来越多的研究表明,深度学习在医学影像诊断中具有巨大的潜力。本文将探讨深度学习在医学影像诊断中的应用现状、挑战和未来发展趋势。
        15 0
        |
        11天前
        |
        机器学习/深度学习 人工智能 算法
        深度学习在图像识别中的应用与挑战
        【4月更文挑战第8天】 随着人工智能技术的飞速发展,深度学习已经成为了计算机视觉领域的核心动力。本文聚焦于深度学习技术在图像识别任务中的运用,探讨了卷积神经网络(CNN)的基本原理、关键结构和训练技巧,并通过实验分析展示了其在处理复杂图像数据时的强大能力。同时,文章也指出了当前深度学习方法面临的主要挑战,如数据偏差、模型泛化能力和计算资源消耗等,并对未来的发展方向进行了展望。
        |
        2天前
        |
        机器学习/深度学习 并行计算 算法
        R语言深度学习不同模型对比分析案例
        R语言深度学习不同模型对比分析案例
        21 0
        |
        3天前
        |
        机器学习/深度学习 计算机视觉 异构计算
        深度学习在图像识别中的应用与挑战
        【4月更文挑战第16天】 随着人工智能技术的飞速发展,深度学习作为其核心技术之一,在图像识别领域取得了显著的成果。本文将探讨深度学习在图像识别中的应用,分析其优势和面临的挑战,并提出相应的解决方案。通过对现有技术的研究和实践,我们旨在为读者提供一个全面了解深度学习在图像识别领域的应用现状和未来发展趋势的视角。
        |
        3天前
        |
        机器学习/深度学习 监控 安全
        深度学习驱动下的智能监控革新:图像识别技术的实战应用
        【4月更文挑战第16天】 随着人工智能的迅猛发展,深度学习技术在图像处理和分析领域取得了突破性的进展。尤其是在智能监控系统中,基于深度学习的图像识别技术已经成为提高安全水平、实现自动化监控的关键工具。本文聚焦于深度学习在智能监控中的应用,探讨了卷积神经网络(CNN)、递归神经网络(RNN)等先进结构在实时视频流分析和异常行为检测方面的具体实践。通过深入分析多个案例,我们展示了深度学习如何提升监控系统的准确性、效率及智能化程度,同时对面临的挑战和未来发展趋势进行了展望。
        8 2
        |
        5天前
        |
        机器学习/深度学习 安全 计算机视觉
        深度学习在图像识别中的应用与挑战
        【4月更文挑战第14天】 随着人工智能技术的飞速发展,深度学习已成为推动计算机视觉领域进步的关键力量。本文聚焦于深度学习技术在图像识别任务中的运用,探讨了卷积神经网络(CNN)的基本原理、关键架构以及优化策略,并对当前面临的主要挑战进行了分析。通过实验结果与案例分析,本文揭示了深度学习在提高图像识别准确性方面的潜力及存在的限制因素。
        |
        6天前
        |
        机器学习/深度学习 数据采集 算法
        深度学习在图像识别方面的应用
        【4月更文挑战第8天】
        19 3