pytorch之Resize()函數(shù)具體使用詳解
Resize函數(shù)用于對(duì)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ù)有兩個(gè)參數(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)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
Python pandas dataframe之重命名相同列名
這篇文章主要介紹了Python pandas dataframe之重命名相同列名方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-09-09
Python sklearn中的.fit與.predict的用法說(shuō)明
這篇文章主要介紹了Python sklearn中的.fit與.predict的用法說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-06-06
編寫(xiě)python代碼實(shí)現(xiàn)簡(jiǎn)單抽獎(jiǎng)器
這篇文章主要介紹了編寫(xiě)python代碼實(shí)現(xiàn)簡(jiǎn)單抽獎(jiǎng)器,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-10-10
完美解決ARIMA模型中plot_acf畫(huà)不出圖的問(wèn)題
這篇文章主要介紹了完美解決ARIMA模型中plot_acf畫(huà)不出圖的問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧2020-06-06
Pandas實(shí)現(xiàn)Excel文件讀取,增刪,打開(kāi),保存操作
Pandas?是一種基于?NumPy?的開(kāi)源數(shù)據(jù)分析工具,用于處理和分析大量數(shù)據(jù)。本文將通過(guò)Pandas實(shí)現(xiàn)對(duì)Excel文件進(jìn)行讀取、增刪、打開(kāi)、保存等操作,需要的可以參考一下2023-04-04
教你如何用python操作攝像頭以及對(duì)視頻流的處理
這篇文章主要介紹了教你如何用python操作攝像頭以及對(duì)視頻流的處理,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-10-10

