matplotlib.pyplot.imshow
2016-03-04 16:23
621 查看
官方:Display an image on the axes.
注意这个参数X
输入参数X的shape为: (n, m) or (n, m, 3) or (n, m, 4). 若为(m,n,5)会报错。
在deep learning 可视化中,经常需要可视化N×C×H×W的数据,而imshow的输入只能为(n, m) or (n, m, 3) or (n, m, 4),所以必须将N×C×H×W的数据转换:
1. 如果C=3 or 4, 则需将N×H×W的数据转换成N×M形式的,具体见show_data,这样,可以得到彩图。
2. 如果C>4, 比如某一层卷积核参数总共为32×32×5×5,就要可视化32^2 ×5×5的数据,即可视化32^2个卷积核,得到的是灰度图,具体见show_features.在show_data或show_feature中,要经过reshape, transpose,再reshape的操作。
3. 总之需要记住:输入参数X的shape为: (n, m) or (n, m, 3) or (n, m, 4).
注意这个参数X
[code]X : array_like, shape (n, m) or (n, m, 3) or (n, m, 4) Display the image in X to current axes. X may be a float array, a uint8 array or a PIL image. If X is an array, it can have the following shapes: MxN – luminance (grayscale, float array only) MxNx3 – RGB (float or uint8 array) MxNx4 – RGBA (float or uint8 array) The value for each component of MxNx3 and MxNx4 float arrays should be in the range 0.0 to 1.0; MxN float arrays may be normalised.
输入参数X的shape为: (n, m) or (n, m, 3) or (n, m, 4). 若为(m,n,5)会报错。
在deep learning 可视化中,经常需要可视化N×C×H×W的数据,而imshow的输入只能为(n, m) or (n, m, 3) or (n, m, 4),所以必须将N×C×H×W的数据转换:
1. 如果C=3 or 4, 则需将N×H×W的数据转换成N×M形式的,具体见show_data,这样,可以得到彩图。
2. 如果C>4, 比如某一层卷积核参数总共为32×32×5×5,就要可视化32^2 ×5×5的数据,即可视化32^2个卷积核,得到的是灰度图,具体见show_features.在show_data或show_feature中,要经过reshape, transpose,再reshape的操作。
3. 总之需要记住:输入参数X的shape为: (n, m) or (n, m, 3) or (n, m, 4).
相关文章推荐
- php.ini中date.timezone设置
- php 计算时间差
- ./upload/source/class/class_core.php
- 23.2 WinInet 和 FTP
- ./upload/index.php
- /usr/local/php/bin/phpize生成configure文件时报错 Cannot find autoconf. Please check your autoconf
- 解决PHP编译cURL的reinstall the libcurl问题
- PHP开发者常犯的10个MySQL错误
- PHP中static的用法
- ThinkPhp中M和D的区别
- 基于yii1.1开发个人博客系统
- laravel5.2 学习之服务提供者
- php 类中方法之间参数怎么调用 ?
- PHP运行出现Notice : Use of undefined constant 完美解决方案
- php字符串的比较
- 提高php代码效率的若干写法(真的很实用)
- PHP----String
- 关于phpdoc导出文档中@package的warning及Error错误
- Zend Studio 修改高亮变量的颜色、括号颜色
- php 处理url的三个函数