【发布时间】:2017-01-19 05:44:43
【问题描述】:
我在机器学习和 python 方面有一些背景,但我只是在学习 TensorFlow。我正在通过tutorial on deep convolutional neural nets 教自己如何使用它进行图像分类。一路上有一个练习,我无法完成。
练习: inference() 中的模型架构与 cuda-convnet 中指定的 CIFAR-10 模型略有不同。特别是,Alex 的原始模型的顶层是局部连接的,而不是全连接的。尝试编辑架构以在顶层精确再现本地连接的架构。
练习参考cifar10.py model 中的 inference() 函数。倒数第二层(称为 local4)的 shape=[384, 192],顶层的 shape=[192, NUM_CLASSES],其中 NUM_CLASSES=10。我认为我们被要求编辑的代码位于定义顶层的代码中:
with tf.variable_scope('softmax_linear') as scope:
weights = _variable_with_weight_decay('weights', [192, NUM_CLASSES],
stddev=1/192.0, wd=0.0)
biases = _variable_on_cpu('biases', [NUM_CLASSES],
tf.constant_initializer(0.0))
softmax_linear = tf.add(tf.matmul(local4, weights), biases,name=scope.name
_activation_summary(softmax_linear)
但是我没有看到任何确定层之间连接概率的代码,所以我不知道我们如何将模型从完全连接更改为本地连接。有人知道怎么做吗?
【问题讨论】:
标签: python tensorflow conv-neural-network