- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这个问题有点像 How can I use values read from TFRecords as arguments to tf.reshape? 的延伸
我使用以下代码将我的图像转换成某种形状:
height = tf.cast(features['height'],tf.int32)
width = tf.cast(features['width'],tf.int32)
image = tf.reshape(image,tf.pack([height, width, 3]))
height = IMAGE_SIZE
width = IMAGE_SIZE
distorted_image = tf.random_crop(image, [height, width, 3])
distorted_image = image
Traceback (most recent call last):
File "cnn_train.py", line 128, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/default/_app.py", line 30, in run
sys.exit(main(sys.argv))
File "cnn_train.py", line 124, in main
train()
File "cnn_train.py", line 56, in train
images, labels = cnn.distorted_inputs()
File "/home/samuelchin/tensorflow/my_code/CNN/cnn.py", line 123, in distorted_inputs
batch_size=BATCH_SIZE)
File "/home/samuelchin/tensorflow/my_code/CNN/cnn_input.py", line 128, in distorted_inputs
min_queue_examples, batch_size)
File "/home/samuelchin/tensorflow/my_code/CNN/cnn_input.py", line 70, in _generate_image_and_label_batch
min_after_dequeue=min_queue_examples)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/input.py", line 494, in shuffle_batch
dtypes=types, shapes=shapes)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/data_flow_ops.py", line 404, in __init__
shapes = _as_shape_list(shapes, dtypes)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/data_flow_ops.py", line 70, in _as_shape_list
raise ValueError("All shapes must be fully defined: %s" % shapes)
ValueError: All shapes must be fully defined: [TensorShape([Dimension(None), Dimension(None), Dimension(None)]), TensorShape([])]
最佳答案
因为您是动态生成图像,包括从 tf 记录文件中动态提取高度和宽度,TensorFlow 不知道生成的图像的形状。管道中的许多后期操作需要能够确定 Python 执行时的形状。tf.random_crop
具有将图像大小设置为已知的固定大小并使其形状暴露以供后续处理的附带效果。
您可以将图像切片到您想要的大小,而不是进行 random_crop,但是您需要执行一些操作将图像变成固定大小的东西。如果你希望它是 32x32 并且你知道你的输入高度和宽度是 32x32,那么你可以对它执行 set_shape (但你最好是对的)。否则,您可以裁剪和/或调整到您想要的大小。
关于tensorflow - 由于注释掉 tf.random_crop 导致的 ValueError : All shapes must be fully defined. 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35691102/
我想选择 仅第一个表中的元素,而不是第二个表中的元素。是否有任何 CSS 选择器可以这样做? 澄清一下:我只想选择 里面按照表格,只有当 em 完全包含在 p 中时。即:如果只包含 . 顺便说一下,
如何让我的固定宽度网站在 webkit(iphone 和 android)浏览器上始终显示为“完全放大”? 现在,它在 iPhone 上看起来不错,但在分辨率更高的 Android 手机上“太小/缩小
我正在使用的代码片段:: br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Ge
我有一个 A 形框架组件,它在某个时候创建一个“基础”实体,上面挂着一堆子元素(基本上是带有彩色面的盒子)。完成所有这些子元素(包括网格)后,我想使用 geometry-merger 合并它们的几
我需要一些帮助来完全理解运行这段代码时发生了什么 public class Main extends Thread { private static int x; public sta
我正在阅读HttpCore documentation并遇到了这条线。 public static void consume(HttpEntity entity) throws IOException
在我的 Django 环境“完全加载”后,我需要执行一些相当简单的任务。 更具体地说,我需要做一些事情,比如 Signal.disconnect() 默认情况下由我的第三方库设置的一些 Django
git 的一个好处是“每个人都可以拥有完整的备份”作为 DVCS 相对于 SVN。不太懂。 例如,John 有一个 git 仓库和他的分支 branch_a,Peter 有另一个 git 仓库和 br
以下内容对我来说毫无意义 % git clone $REPO_URL --branch dev wd % cd wd % git fetch origin master:master From git
我有一个现有的 Angular 应用程序,它在 Angular 4 时开始开发,现在它在 Angular 12 上。但是在开发时,strict mode 没有启用。现在,在应用程序稳定并部署到生产环境
我想知道为什么我需要包含 (:gen-class) 来访问从其他 ns 导入的函数而不完全限定它们。 例子: (ns project.core (:gen-class)) (defn foo []
(还有几个关于超时和 maxSpoutPending 的问题) 我在 Storm 文档中看到很多关于消息被完全处理的引用。但是我的 KafkaSpout 如何知道消息何时被完全处理? 希望它知道我的
我正在使用 Gremlin-Python 客户端通过 janusgraph 后端查询 Gremlin 服务器。 运行以下查询: graph = Graph() g = graph.traversal(
我正在尝试使用 reqwest 库获取一个网站。 问题是某些网站将在几毫秒或大约一秒内完全呈现。 (就像html渲染后加载表格元素一样) let client = reqwest::Client::b
如果hashCode()计算使用不可变字段并且equals()使用所有字段,那么会是这样吗?当类用作哈希键时有问题吗?例如 import java.util.Objects; public class
我认为这只是一个一般的 C++ 问题: 我正在尝试使用 gnu c++ 编译器在 Linux Fedora 上编译本地版本的 ffmpeg。我的源代码位于以下一堆文件夹中: ~//Downloads/
我收到了这则消息 Fully shadowed APK PROBLEM This APK will not be served to any users because it is completel
我的文档通常包含这种形式的“完全受限”框架: \begin{frame} Lorem ipsum dolor. \end{frame} 由于第一行末尾的 ,像这样的帧 没有出现在我用 pdfl
我正在 SBCL 中尝试这个来翻转列表中的点对: (mapcar (lambda (x) (let ((num (random 2))) (if (
有没有办法对 以但可能不完全包含给定字符串的数据字段进行 MySQL 查询? 例如,如果我有以下数据项列表: my_table 1. example.com 2. example.com/subpag
我是一名优秀的程序员,十分优秀!