gpt4 book ai didi

python - 使用 MxNet 运行 Alexnet

转载 作者:行者123 更新时间:2023-12-01 03:15:00 24 4
gpt4 key购买 nike

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

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

它没有做任何事情。我有 HPC 背景。我想测试这个框架每个节点和跨节点(分布式)的可扩展性。任何帮助将不胜感激。

谢谢

最佳答案

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了解更多详情。

关于python - 使用 MxNet 运行 Alexnet,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42536556/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com