- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试通过为 cifar
数据集构建分类器来熟悉神经网络。我决定从 tflearn 存储库中获取一个示例,但是我遇到了麻烦。
有一些注意事项:
我正在使用 Jupyter
Notebook 来测试我的模型。
我正在使用 https://www.cs.toronto.edu/~kriz/cifar.html 上的 Cifar
数据集。每个图像都是形状为 [3072] 的数组(它被展平为单个数组)
版本:Python 3.5、Tensorflow 0.10、TFLearn 0.2.1
import tflearn
from tflearn.data_utils import shuffle, to_categorical
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.estimator import regression
(X, Y), (X_test, Y_test) = (raw_train_data, raw_train_labels), \
(raw_test_data, raw_test_labels)
X, Y = shuffle(X, Y)
Y = to_categorical(Y, 10)
Y_test = to_categorical(Y_test, 10)
# X, X_test = tf.reshape(X, [-1, 32, 32, 3]), tf.reshape(X_test, [-1, 32, 32, 3])
# Convolutional network building
network = input_data(shape=[None, 32, 32, 3],
data_preprocessing=img_prep,
data_augmentation=img_aug)
network = conv_2d(network, 32, 3, activation='relu')
network = max_pool_2d(network, 2)
network = conv_2d(network, 64, 3, activation='relu')
network = conv_2d(network, 64, 3, activation='relu')
network = max_pool_2d(network, 2)
network = fully_connected(network, 512, activation='relu')
network = dropout(network, 0.5)
network = fully_connected(network, 10, activation='softmax')
network = regression(network, optimizer='adam',
loss='categorical_crossentropy',
learning_rate=0.01)
model = tflearn.DNN(network, tensorboard_verbose=0)
model.fit(X, Y, n_epoch=2, shuffle=False, validation_set=(X_test, Y_test),
show_metric=False, batch_size=50, run_id='cifar10_cnn')
第一次运行时出现以下异常:线程 Thread-17 中出现异常:
ValueError:输入必须 >= 2-d
。
当我重新运行笔记本而不重置内核时,我的错误消息更改为:
IndexError:列表索引超出范围
最后当我尝试使用 Tensorflow reshape 数据时:
类型错误:“张量”对象不可迭代
。
最佳答案
我觉得这是您的 tf 和 tf-learn 安装的问题。我强烈建议您重新安装tensorflow和tflearn(不确定Jupyter正在使用什么)因为我刚刚使用 virtualenv 进行了全新安装。一切都像带有 .py 文件的终端的魅力一样。您能否指出 Jupyter Notebook,以便我看一下 tf 和 tf-learn 的版本?
这是代码的修改版本(带有您的参数):我使用了 convnet 示例 here作为基础。
https://gist.github.com/hakanu/1cc91000548978e0245a901e565040d1
关于python - TFLearn CovNet 示例导致使用 CIFAR-10 时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40200311/
为了进行微调,您将使用 CIFAR-100 数据集“bus”和“tiger”类的数据。你的任务是找出如何微调预训练的 CNN 模型,使用训练数据(我认为每个类 500 个图像)“bus”和“tiger
我想使用 CIFAR-10 数据集,但我只想要 Frog 、狗、猫、马和鸟类,到目前为止我已经使用了以下代码: # Plot ad hoc CIFAR10 instances from ker
我尝试为 CIFAR-10 数据库构建神经网络。我使用了 Pytorch 框架。 我有一个关于数据加载步骤的问题。 transform_train = T.Compose([ T.Random
我想使用较少的训练数据样本来训练深度神经网络,以减少测试我的代码的时间。我想知道如何使用 Keras TensorFlow 对 Cifar-10 数据集进行子集化。我有以下代码用于训练 Cifar-1
在机器学习方面,我是一个相对初学者。 我一直在使用 Keras 和 TensorFlow 作为后端,但由于某种原因,当我使用 CIFAR-10 数据集时,我没有获得很好的准确性。 这是我的代码。 mo
美好的一天! (或夜晚) CIFAR-10 数据集上的全连接神经网络训练集的误分类错误可以有多低(对于 < 30 个隐藏层)? 是否有可能达到 0.001 或 0? 你能告诉我你的经历吗? 附注我想从
我正在尝试了解 Tensorflow,并且看到了官方示例之一,即 Cifar-10 模型。 在 cifar10.py ,在 inference() 中,您可以看到以下几行: with tf.varia
我想创建一个与 cifar-10 数据集格式相同的数据集,以便与 Tensorflow 一起使用。它应该有图像和标签。基本上,我希望能够获取 cifar-10 代码,但具有不同的图像和标签,并运行该代
我试图在 python 中加载 CIFAR-10 数据集,但它显示的键的名称非常不正常。 dict.keys() 给出以下输出: dict_keys([b'labels', b'batch_label
我已尝试修改 CIFAR-10 示例以在新的 TensorFlow 分布式运行时上运行。但是,在尝试运行该程序时出现以下错误: InvalidArgumentError: Cannot assign
我正在使用 cifar-10 数据集来训练我的分类器。我已经下载了数据集并尝试显示数据集中的图像。我使用了以下代码: from six.moves import cPickle as pickle f
为了让所有事情变得清楚,让我展示整个模型,这非常简单: from keras.datasets import cifar10 #much more libraries imported # simpl
我正在尝试使用深度学习技术构建一个分类器,并使用 cifar-10 数据集来构建一个分类器。我尝试构建一个具有 1024 个隐藏节点的分类器。每个图像的大小为 32*32*3(R-G-B)。由于我的计
我试图在 tensorflow 中使用 cifar100 数据集训练图像分类器模型,但准确率没有增加超过 1.2%。我用谷歌搜索了这个问题并找到了几种解决方案,但我的模型仍然表现不佳。 我实现了一些步
关闭。这个问题需要多问focused 。目前不接受答案。 想要改进此问题吗?更新问题,使其仅关注一个问题 editing this post . 已关闭 2 年前。 Improve this ques
我想使用 cifar 数据集和 keras 框架训练单层神经网络。由于数据集的每个图像都是 32 x 32 x 3,所以我不太确定如何使用没有卷积的单层网络来处理图像。我认为将每个图像展平为形状为 N
我试图使用来自 tensorflow 的 cifar-10 预测单个图像的类别。 我找到了这段代码,但是失败并出现了这个错误: 赋值要求两个张量的形状匹配。 lhs 形状= [18,384] rhs
我正在尝试下载 CIFAR-10 图像数据集; http://www.cs.toronto.edu/~kriz/cifar.html 在 R 中,但我似乎无法提取文件。我已经尝试了所有三种格式 .bi
我正在尝试通过为 cifar 数据集构建分类器来熟悉神经网络。我决定从 tflearn 存储库中获取一个示例,但是我遇到了麻烦。 有一些注意事项: 我正在使用 Jupyter Notebook 来测试
我正在尝试在 Keras 中的 CIFAR-10 数据集上训练 CNN,但只能获得 10% 左右的准确率,基本上是随机的。我正在训练超过 50 个 epoch,批量大小为 32,学习率为 0.01。我
我是一名优秀的程序员,十分优秀!