mxnet解决AttributeError: module 'mxnet.test_utils' has no attribute 'get_mnist'这个报错
来源:互联网 发布:艾默生ups监控软件 编辑:程序博客网 时间:2024/06/15 03:08
出现 AttributeError: module 'mxnet.test_utils' has no attribute 'get_mnist'
这个报错,主要是因为mxnet版本过低,有两个解决办法。
1,升级mxnet版本。
2,不升级版本,利用mxnet.io.MNISTIter来加载数据。步骤如下:
(1)先去http://yann.lecun.com/exdb/mnist/下载mnist数据集。
(2)下载好之后,解压,得到4个以-ubyte结尾的文件。
(3)先看看mxnet.io.MNISTIter的参数:
Parameters: image (string, optional, default='./train-images-idx3-ubyte') – Dataset Param: Mnist image path. label (string, optional, default='./train-labels-idx1-ubyte') – Dataset Param: Mnist label path. batch_size (int, optional, default='128') – Batch Param: Batch Size. shuffle (boolean, optional, default=1) – Augmentation Param: Whether to shuffle data. flat (boolean, optional, default=0) – Augmentation Param: Whether to flat the data into 1D. seed (int, optional, default='0') – Augmentation Param: Random Seed. silent (boolean, optional, default=0) – Auxiliary Param: Whether to print out data info. num_parts (int, optional, default='1') – partition the data into multiple parts part_index (int, optional, default='0') – the index of the part will read prefetch_buffer (long (non-negative), optional, default=4) – Maximum number of batches to prefetch. dtype ({None, 'float16', 'float32', 'float64', 'int32', 'uint8'},optional, default='None') – Output data type. None means no change.
(4)重要的参数主要是image,label,batch_size,shuffle。于是利用下面的代码构建数据:
path = 'E:\python file\data_set\mnist/' # 数据所在的位置train_iter = mx.io.MNISTIter(image=path+'train-images.idx3-ubyte', label=path+'train-labels.idx1-ubyte', batch_size=100, shuffle=True)val_iter = mx.io.MNISTIter(image=path+'t10k-images.idx3-ubyte', label=path+'t10k-labels.idx1-ubyte', batch_size=100)
注意,这里的E:\python file\data_set\mnist
是数据存放的绝对位置,你需要根据你自己数据存放的位置改动。
至此,就可以使用train_iter 和 val_iter去训练你的模型了。
阅读全文
0 0
- mxnet解决AttributeError: module 'mxnet.test_utils' has no attribute 'get_mnist'这个报错
- mxnet运行时报错:AttributeError: module 'mxnet.ndarray' has no attribute 'random'
- import module报错AttributeError: 'module' object has no attribute
- python3 报错: AttributeError: 'module' object has no attribute 'urlopen'
- 报错AttributeError: 'module' object has no attribute 'HTTPSConnection'
- 报错 AttributeError: 'module' object has no attribute 'bool_'
- Tensorflow报错:AttributeError: 'module' object has no attribute 'summary'
- 【Tensorflow】报错:AttributeError: 'module' object has no attribute 'scalar_summary'
- Tensorflow报错:AttributeError: 'module' object has no attribute 'scalar_summary'
- pandas报错AttributeError: 'module' object has no attribute 'plotting'
- tensorflow报错:AttributeError: 'module' object has no attribute 'get_or_create_global_step'
- 解决Python报错: AttributeError: 'module' object has no attribute '_base'
- AttributeError: 'module' object has no attribute 'Spider' 解决了
- AttributeError: module 'tensorflow' has no attribute 'global_variables_initializer'解决
- 解决 AttributeError: 'module' object has no attribute 'convolution'
- AttributeError: 'module' object has no attribute 'showinfo'(已解决)
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- python文件名不要跟模块名相同,报错AttributeError: 'module' object has no attribute 'Differ'
- CSS文件引入顺序
- JVM调优
- 命令行下收集主机信息
- texteview的下划线
- git 命令
- mxnet解决AttributeError: module 'mxnet.test_utils' has no attribute 'get_mnist'这个报错
- request
- Go语言开发环境搭建与配置
- 对webapp下上传文件夹中的文件按时间排序展示到页面中
- oracle跨数据库配置
- QQ音乐API整理
- IntelliJ IDEA 中 右键新建时,选项没有Java class的解决方法和具体解释
- IDEA liveTemplate生成JAVA Doc模板
- lc#2使用链表实现两数相加