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)文章
Python pandas dataframe之重命名相同列名
這篇文章主要介紹了Python pandas dataframe之重命名相同列名方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-09-09Python sklearn中的.fit與.predict的用法說明
這篇文章主要介紹了Python sklearn中的.fit與.predict的用法說明,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧2020-06-06Pandas實(shí)現(xiàn)Excel文件讀取,增刪,打開,保存操作
Pandas?是一種基于?NumPy?的開源數(shù)據(jù)分析工具,用于處理和分析大量數(shù)據(jù)。本文將通過Pandas實(shí)現(xiàn)對Excel文件進(jìn)行讀取、增刪、打開、保存等操作,需要的可以參考一下2023-04-04