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

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”,这不是说的很明白么

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料