python - Tensorflow:准备输入数据

标签 python tensorflow deep-learning conv-neural-network

我正在尝试从研究论文中复制深度神经网络。该架构可以在这里找到:

我已经完成了模型设计,现在正在尝试准备训练数据。我一直在使用此处找到的 tensorflow 教程作为指导:https://www.tensorflow.org/get_started/mnist/pros

对于 mnist 数据,27x27 图像将转换为 x 的一维向量。另一方面,y_ 的形状为 [none, 10],因为每个图像都有可能以 10 种不同的方式进行标记 (0-9)

 x = tf.placeholder(tf.float32, shape=[None, 784])
 y_ = tf.placeholder(tf.float32, shape=[None, 10])

我的数据是 32x32x7 3d 图像,因此 x 很容易计算。

 x = tf.placeholder(tf.float32, shape=[None, 7168])

虽然我的图像尺寸为 32x32x7,但每个像素都有一个与其关联的密度和标签。我相信密度值将被加载到 x 中,标签将被加载到 y 中。这是一个正确的假设还是我应该以不同的方式加载数据?

 y_ = tf.placeholder(tf.float32, shape=[None, 7168])

最佳答案

my image is 32x32x7, each pixel has a density and label associated with it

如果是这样,那么网络的输出和目标y_的形状将是:

[
 None,         # Batch size
 32 * 32 * 7,  # Vector size
 N             # N target labels (one hot encoded)
]

关于python - Tensorflow:准备输入数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47060869/

相关文章:

python - spacy 的 en_core_web_sm、en_core_web_md 和 en_core_web_lg 模型有什么区别?

python - 如何对 Pandas 对象执行切片(使用 ix、loc、iloc)操作(排除某些指定索引)

tensorflow - 如何使用 tensorflow feature_columns 作为 keras 模型的输入

python - TensorFlow 'global_step' 变量未针对指数衰减进行更新

python - 使用 TF Estimator 时 Tensorflow 分布式训练的损失和学习率缩放策略

python - 如何清除图例中的 matplotlib 标签?

python - 获取数组中按钮的索引(按下时)

python - tensorflow RNN 中的单步模拟

neural-network - 如何在 pycaffe 中获取图层类型?

image-processing - 具有反卷积或其他功能的高档层