记个原图
all = [“Compose”, “ToTensor”, “PILToTensor”, “ConvertImageDtype”, “ToPILImage”, “Normalize”, “Resize”, “Scale”, “CenterCrop”, “Pad”, “Lambda
” 、「RandomApply」、「RandomChoice」、「RandomOrder」、「RandomCrop」、「RandomhorizontalFlip」、「RandomVerticalFlip」、「
RandomResizeCrop」、「RandomSizedCrop」、「FiveCrop」、「TenCrop」、
「LinearTransformation」、「ColorJitter」、 RandomRotation」、「RandomAffine」、「Grayscale」、「RandomGrayscale」、「
RandomPerspective」、「RandomErasing」、「GaussianBlur」、「InterpolationMode」、「RandomInvert」、「RandomPosterize」、「RandomSolarize」、
「RandomAdjustSharpness」、「RandomAutocontrast」 、「ランダムイコライズ」]
クロップ効果は非常に明確で、主に他のものです。
PILimageへ
RandomRotation 回転
transforms.RandomRotation(degrees=5)
不要周围白边
transforms.RandomRotation(degrees=5,expand=True)
カラージッタートーニング
パラメータ
明るさ: 明るさ
コントラスト: コントラスト
彩度: 彩度
色相: 色相 0<= 色相 <= 0.5
亮度
transforms.ColorJitter(brightness=10)
对比度
transforms.ColorJitter(contrast=5)
饱和度
transforms.ColorJitter(saturation=10)
色调
transforms.ColorJitter(hue=(-0.5, 0.5))
コントラストを自動調整する RandomAutocontrast
transforms.RandomAutocontrast(p=1)
イコライザー ランダムイコライズ
transforms.RandomEqualize(p=1)
GaussianBlur ガウスぼかし
kernel_size ガウス カーネル サイズ
シグマ標準偏差
transforms.GaussianBlur(kernel_size=(5, 11),
sigma=(5, 10.0))
ランダム色を反転
transforms.RandomInvert(p=1)
ランダム反転ソラリゼーション
thresh パラメータを追加しない場合の効果は、RandomInvert で色を反転するのと同じです。
RandomPosterize 後処理(?)
カラー チャネルごとのビット数を減らすことにより、指定された確率で画像をランダムに後処理します
。 bit : 各チャネルで保持するビット数
transforms.RandomPosterize(1, p=1)
transforms.RandomPosterize(5, p=1)
シャープ化ランダム調整シャープネス
transforms.RandomAdjustSharpness(sharpness_factor=20,p=1)
ひっくり返す
Random水平水平ミラーを反転
ランダム垂直垂直ミラーを反転
グレースケール グレースケール
transforms.Grayscale(num_output_channels=1)
パッド充填
transforms.Pad(padding, fill=0, padding_mode='constant')
パディング
フィルの値は何ですか (定数モードのみ)
padding_mode パディングモード
常数
transforms.Pad((10, 20, 30, 40), fill=0, padding_mode="constant")
延伸
transforms.Pad((10, 20, 30, 40), padding_mode="edge")
镜像,这俩区别不是很大?
transforms.Pad((10, 20, 30, 40), padding_mode="reflect")
transforms.Pad((10, 20, 30, 40), padding_mode="symmetric")
ランダムアフィンアフィン(就是旋转平移这样的线性变换吧)
度: 回転角度
変換: 水平オフセット
スケール: 比率
シアー: クリッピング
リサンプル ({PIL.Image.NEAREST、PIL.Image.BILINEAR、PIL.Image.BICUBIC}、オプション)
fill: 画像の外側の塗りつぶし色 int
transforms.RandomAffine(degrees=30, translate=(0, 0.2), scale=(0.9, 1), shear=(6, 9), fill=66)
RandomPerspective アート パースペクティブ
distortion_scale: 歪みの度合いを 0 から 1 の範囲で制御するパラメータ。デフォルト値は 0.5 です。
p
interpolation: 補間、PIL.Image.BILINEAR、PIL.Image.NEAREST、PIL.Image.BICUBIC
fil: 外側領域のピクセル塗りつぶし値
transforms.RandomPerspective(distortion_scale=0.5, p=0.5, fill=0)
そして自作の
たとえばhttps://www.pythonheidong.com/blog/article/147611/92d69853c6c8f67525d5/この塩とコショウのノイズ
テンソルに
ノーマライズ
transforms.Normalize(mean=[0.5, ], std=[0.5, ])
オクルージョンランダム消去
スケール: 入力画像に対する消去領域の比率 Ratio
: 消去領域のアスペクト比
value:
inplace: インプレイスするかどうかを決定します(?试了下也没啥变化啊?)
value输三元组tuple,其实就是rgb共同调一个色出来
value输一个int,其实就是三元组统一一个数
transforms.RandomErasing(p=1, scale=(0.02, 0.33), ratio=(0.3, 3.3), value=(254 / 255, 0, 127 / 255))
马赛克
transforms.RandomErasing(p=1, scale=(0.02, 0.33), ratio=(0.3, 3.3), value='random')
ちなみにランダムシードについては
https://blog.csdn.net/m0_37163827/article/details/111284328について言及
v0.8.0 以降、すべてのランダム変換では、torch のデフォルトのランダム ジェネレーターを使用してランダム パラメーターをサンプリングします。これは下位互換性を破壊する変更であり、ユーザーはランダムな状態を次のように設定する必要があります。
# Previous versions # import random # random.seed(12) # Now import torch torch.manual_seed(17)