【问题标题】:Running Alexnet using MxNet使用 MxNet 运行 Alexnet
【发布时间】:2017-03-01 16:06:53
【问题描述】:

我正在尝试使用 MxNet Framework 使用 /mxnet/example/image-classification/symbols 目录中的 alexnet 代码。我不是人工智能方面的专家。有人可以解释一下如何使用 GPU 运行它吗?我为单个 GPU 尝试了以下方法:

python alexnet.py --network resnet --num-layers 110 --batch-size 128 --gpus 0

它什么也没做。我有高性能计算背景。我想测试每个节点和跨节点(分布式)的这个框架的可扩展性。任何帮助将不胜感激。

谢谢,

【问题讨论】:

  • alexnet.py 只包含一个函数,所以显然它在直接调用时不会做任何事情。我以前没有使用过 mxnet,但根据 readme,您可以尝试通过调用在 cifar10 数据集上训练 resnet:python train_cifar10.py --network resnet --num-layers 110 --batch-size 128 --gpus 0

标签: python mxnet


【解决方案1】:

alexnet.py(以及examples/image-classification/symbols 文件夹中的其他Python 文件)仅返回代表网络的符号。

首先下载并解压缩您的数据集:

/mxnet/example/image-classification/data# wget http://www.image-net.org/image/whatever-zip-or-tar-file
/mxnet/example/image-classification/data# unzip whatever-zip-or-tar-file

将数据格式转换为RecordIO:

/mxnet/example/image-classification/data# python ../../../tools/im2rec.py --list True --recursive True --train-ratio 0.95 mydata tiny-imagenet-200
/mxnet/example/image-classification/data# python ../../../tools/im2rec.py --num-thread 16 mydata tiny-imagenet-200

使用 train_imagenet.py 脚本在 alexnet 上进行训练(如果您愿意,可以切换到任何其他符号):

/mxnet/example/image-classification/data# cd ..
/mxnet/example/image-classification# python train_imagenet.py --network alexnet --data-train /mxnet/example/image-classification/data/mydata_train.rec --data-val /mxnet/example/image-classification/data/mydata_val.rec --num-layers 110 --batch-size 64 --gpus 0

查看README了解更多详情。

【讨论】:

    猜你喜欢
    • 2020-07-30
    • 2018-08-24
    • 2018-03-02
    • 1970-01-01
    • 1970-01-01
    • 2017-11-29
    • 1970-01-01
    • 1970-01-01
    • 2019-02-22
    相关资源
    最近更新 更多