python display方法_Python display.Image方法代码示例

本文详细介绍了Python中的IPython.display.Image方法,包括如何使用它展示图像,并给出了29个实用代码示例,涵盖了从图像加载到显示的各种应用场景。适合正在学习Python图像处理和IPython库的开发者参考。
摘要由CSDN通过智能技术生成

本文整理汇总了Python中IPython.display.Image方法的典型用法代码示例。如果您正苦于以下问题:Python display.Image方法的具体用法?Python display.Image怎么用?Python display.Image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在模块IPython.display的用法示例。

在下文中一共展示了display.Image方法的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: AddMLPModel

​点赞 6

# 需要导入模块: from IPython import display [as 别名]

# 或者: from IPython.display import Image [as 别名]

def AddMLPModel(model, data):

size = 28 * 28 * 1

sizes = [size, size * 2, size * 2, 10]

layer = data

for i in range(len(sizes) - 1):

layer = brew.fc(model, layer, 'dense_{}'.format(i), dim_in=sizes[i], dim_out=sizes[i + 1])

layer = brew.relu(model, layer, 'relu_{}'.format(i))

softmax = brew.softmax(model, layer, 'softmax')

return softmax

# ### LeNet Model Definition

#

# **Note**: This is the model used when the flag *USE_LENET_MODEL=True*

#

# Below is another possible (and very powerful) architecture called LeNet. The primary difference from the MLP model is that LeNet is a Convolutional Neural Network (CNN), and therefore uses convolutional layers ([Conv](https://caffe2.ai/docs/operators-catalogue.html#conv)), max pooling layers ([MaxPool](https://caffe2.ai/docs/operators-catalogue.html#maxpool)), [ReLUs](https://caffe2.ai/docs/operators-catalogue.html#relu), *and* fully-connected ([FC](https://caffe2.ai/docs/operators-catalogue.html#fc)) layers. A full explanation of how a CNN works is beyond the scope of this tutorial but here are a few good resources for the curious reader:

#

# - [Stanford cs231 CNNs for Visual Recognition](http://cs231n.github.io/convolutional-networks/) (**Recommended**)

# - [Explanation of Kernels in Image Processing](https://en.wikipedia.org/wiki/Kernel_%28image_processing%29)

# - [Convolutional Arithmetic Tutorial](http://deeplearning.net/software/theano_versions/dev/tutorial/conv_arithmetic.html)

#

# Notice, this function also uses Brew. However, this time we add more than just FC and Softmax layers.

# In[5]:

开发者ID:facebookarchive,项目名称:tutorials,代码行数:27,

示例2: show

​点赞 6

# 需要导入模块: from IPython import display [as 别名]

# 或者: from IPython.display import Image [as 别名]

def show(self, exec_widget=True):

super(Viewer, self).show()

self.viewAll()

rec = self.app.desktop().screenGeometry()

self.move(rec.width() - self.size().width(),

rec.height() - self.size().height())

if not exec_widget:

timer = QtCore.QTimer()

# timer.timeout.connect(self.close)

timer.singleShot(20, self.close)

self.app.exec_()

try:

from IPython.display import Image

return Image(self.name)

except ImportError as e:

print(e)

开发者ID:coin3d,项目名称:pivy,代码行数:18,

示例3: logoNotebook

​点赞 6

# 需要导入模块: from IPython import display [as 别名]

# 或者: from IPython.display import Image [as 别名]

def logoNotebook(symbol, token='', version='', filter=''):

'''This is a helper function, but the google APIs url is standardized.

https://iexcloud.io/docs/api/#logo

8am UTC daily

Args:

symbol (string); Ticker to request

token (string); Access token

version (string); API version

filter (string); filters: https://iexcloud.io/docs/api/#filter-results

Returns:

image: result

'''

_raiseIfNotStr(symbol)

url = logo(symbol, token, version, filter)['url']

return ImageI(url=url)

开发者ID:timkpaine,项目名称:pyEX,代码行数:20,

示例4: embed_mp4_as_gif

​点赞 6

# 需要导入模块: from IPython import display [as 别名]

# 或者: from IPython.display import Image [as 别名]

def embed_mp4_as_gif(filename):

""" Makes a temporary gif version of an mp4 using ffmpeg for embedding in

IPython. Intended for use in Jupyter notebooks. """

if not os.path.exists(filename):

print('file does not exist.')

return

dirname = os.path.dirname(filename)

basename = os.path.basename(filename)

newfile = tempfile.NamedTemporaryFile()

newname = newfile.name + '.gif'

if len(dirname) != 0:

os.chdir(dirname)

os.system('ffmpeg -i ' + basename + ' '

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值