pytorch之Resize()函數(shù)具體使用詳解
Resize函數(shù)用于對PIL圖像的預(yù)處理,它的包在:
from torchvision.transforms import Compose, CenterCrop, ToTensor, Resize
使用如:
def input_transform(crop_size, upscale_factor):
return Compose([
CenterCrop(crop_size),
Resize(crop_size // upscale_factor),
ToTensor(),
])
而Resize函數(shù)有兩個參數(shù),
CLASS torchvision.transforms.Resize(size, interpolation=2)
size (sequence or int) – Desired output size. If size is a sequence like (h, w), output size will be matched to this. If size is an int, smaller edge of the image will be matched to this number. i.e, if height > width, then image will be rescaled to (size * height / width, size)
interpolation (int, optional) – Desired interpolation. Default is PIL.Image.BILINEAR
size : 獲取輸出圖像的大小
interpolation : 插值,默認(rèn)的 PIL.Image.BILINEAR, 一共有4中的插值方法
Image.BICUBIC,PIL.Image.LANCZOS,PIL.Image.BILINEAR,PIL.Image.NEAREST
到此這篇關(guān)于pytorch之Resize()函數(shù)具體使用詳解的文章就介紹到這了,更多相關(guān)pytorch Resize() 內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
面向?qū)ο髮W(xué)習(xí)之pygame坦克大戰(zhàn)
這篇文章主要為大家詳細(xì)介紹了面向?qū)ο髮W(xué)習(xí)之pygame坦克大戰(zhàn),具有一定的參考價值,感興趣的小伙伴們可以參考一下2019-09-09
Python使用pyenv實現(xiàn)多環(huán)境管理
這篇文章主要介紹了Python使用pyenv實現(xiàn)多環(huán)境管理,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-02-02
django restframework使用redis實現(xiàn)token認(rèn)證
本文主要介紹了django restframework使用redis實現(xiàn)token認(rèn)證,文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-09-09
Pytest實現(xiàn)setup和teardown的詳細(xì)使用詳解
這篇文章主要介紹了Pytest實現(xiàn)setup和teardown的詳細(xì)使用詳解,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-04-04
keras .h5轉(zhuǎn)移動端的.tflite文件實現(xiàn)方式
這篇文章主要介紹了keras .h5轉(zhuǎn)移動端的.tflite文件實現(xiàn)方式,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-05-05

