GinMoo 2017-04-24 07:27 采纳率: 0%
浏览 5181

Tensorflow 图像添加标注框展示出错

Tensorflow 图像添加标注框展示出错:《Tensorflow:实战Google深度学习框架》第七章中:

with tf.Session() as sess:

boxes = tf.constant([[[0.05, 0.05, 0.9, 0.7], [0.35, 0.47, 0.5, 0.56]])

batched = tf.expand_dims(tf.image.convert_image_dtype(img_data, tf.float32), 0) 
image_with_box = tf.image.draw_bounding_boxes(batched, bbox_for_draw)

plt.imshow(image_with_box.eval())
plt.show()                                               

报如下错误:

TypeError Traceback (most recent call last)
in ()
11
12
---> 13 plt.imshow(image_with_box.eval())
14 plt.show()
15

/home/ginmoo/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.pyc in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, hold, data, **kwargs)
3156 filternorm=filternorm, filterrad=filterrad,
3157 imlim=imlim, resample=resample, url=url, data=data,
-> 3158 **kwargs)
3159 finally:
3160 ax._hold = washold

/home/ginmoo/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
1890 warnings.warn(msg % (label_namer, func.__name__),
1891 RuntimeWarning, stacklevel=2)
-> 1892 return func(ax, *args, **kwargs)
1893 pre_doc = inner.__doc__
1894 if pre_doc is None:

/home/ginmoo/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
5116 resample=resample, **kwargs)
5117
-> 5118 im.set_data(X)
5119 im.set_alpha(alpha)
5120 if im.get_clip_path() is None:

/home/ginmoo/anaconda2/lib/python2.7/site-packages/matplotlib/image.pyc in set_data(self, A)
547 if (self._A.ndim not in (2, 3) or
548 (self._A.ndim == 3 and self._A.shape[-1] not in (3, 4))):
--> 549 raise TypeError("Invalid dimensions for image data")
550
551 self._imcache = None

TypeError: Invalid dimensions for image data

请路过帮忙指导一下,谢谢

  • 写回答

3条回答 默认 最新

  • Leyooo 2017-04-29 06:05
    关注

    “Invalid dimensions for image data”,这不是说的很明白么

    评论

报告相同问题?

悬赏问题

  • ¥15 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler