def __init__(self, input_size, color_mean):
     '''
     :param input_size: int
         size to which image will be resized
     :param color_mean: tuple
         (B, G, R). every mean of B, G, R
     '''
     self.data_transform = {
         'train':
         Compose([
             ConvertFromInts(),
             ToAbsoluteCoords(),
             PhotometricDistort(),
             Expand(color_mean),
             RandomSampleCrop(),
             ToPercentCoords(),
             Resize(input_size),
             SubtractMeans(color_mean)
         ]),
         'val':
         Compose([
             ConvertFromInts(),
             Resize(input_size),
             SubtractMeans(color_mean)
         ])
     }
Beispiel #2
0
 def __init__(self, input_size, color_mean, color_std):
     self.data_transform = {
         'train':
         Compose([
             Scale(scale=[0.5, 1.5]),  # 画像の拡大縮小
             RandomRotation(angle=[-10, 10]),  # 画像の回転
             RandomMirror(),  # 50%の確率で画像の反転
             Resize(input_size),  # リサイズ
             Normalize_Tensor(color_mean, color_std)  # 標準化とTensor型への変換
         ]),
         'val':
         Compose(
             [Resize(input_size),
              Normalize_Tensor(color_mean, color_std)])
     }
Beispiel #3
0
 def __init__(self, input_size, color_mean, color_std):
     self.data_transform = {
         'train':
         Compose([
             Scale(scale=[0.5, 1.5]),  # 画像の拡大
             RandomRotation(angle=[-10, 10]),  # 回転
             RandomMirror(),  # ランダムミラー
             Resize(input_size),  # リサイズ(input_size)
             Normalize_Tensor(color_mean, color_std)  # 色情報の標準化とテンソル化
         ]),
         'val':
         Compose([
             Resize(input_size),  # リサイズ(input_size)
             Normalize_Tensor(color_mean, color_std)  # 色情報の標準化とテンソル化
         ])
     }
Beispiel #4
0
 def __init__(self, input_size: int, palette_dict: dict):
     self.data_transform = {
         'train':
         Compose([
             Scale(scale=[0.5, 1.5]),  # 画像の拡大
             RandomRotation(angle=[-10, 10]),  # 回転
             RandomMirror(),  # ランダムミラー
             Resize(input_size),  # リサイズ(input_size)
             Normalize_Tensor_RGB(palette_dict)  # 色情報の標準化とテンソル化
         ]),
         'val':
         Compose([
             Resize(input_size),  # リサイズ(input_size)
             Normalize_Tensor_RGB(palette_dict)  # 色情報の標準化とテンソル化
         ])
     }
Beispiel #5
0
 def __init__(self, input_size, color_mean):
     self.data_transform = {
         'train': Compose([
             ConvertFromInts(),  # intをfloat32に変換
             ToAbsoluteCoords(),  # アノテーションデータの規格化を戻す
             PhotometricDistort(),  # 画像の色調などをランダムに変化
             Expand(color_mean),  # 画像のキャンバスを広げる
             RandomSampleCrop(),  # 画像内の部分をランダムに抜き出す
             RandomMirror(),  # 画像を反転させる
             ToPercentCoords(),  # アノテーションデータを0-1に規格化
             Resize(input_size),  # 画像サイズをinput_size×input_sizeに変形
             SubtractMeans(color_mean)  # BGRの色の平均値を引き算
         ]),
         'val': Compose([
             ConvertFromInts(),  # intをfloatに変換
             Resize(input_size),  # 画像サイズをinput_size×input_sizeに変形
             SubtractMeans(color_mean)  # BGRの色の平均値を引き算
         ])
     }
Beispiel #6
0
 def __init__(self, input_size, color_mean):
     normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406],
                                      std=[0.229, 0.224, 0.225])
     self.data_transform = {
         "train":
         Compose([
             ConvertFromInts(),  # intをfloat32に変換
             ToAbsoluteCoords(),  # アノテーションデータの規格化を戻す
             PhotometricDistort(),  # 画像の色調などをランダムに変化
             #Expand(color_mean),  # 画像のキャンバスを広げる
             #RandomSampleCrop(),  # 画像内の部分をランダムに抜き出す
             RandomMirror(),  # 画像を反転させる
             ToPercentCoords(),  # アノテーションデータを0-1に規格化
             Resize(input_size),  # 画像サイズをinput_size×input_sizeに変形
             Normalize()  # Preprocess for resnets
         ]),
         "val":
         Compose([
             ConvertFromInts(),  # intをfloatに変換
             Resize(input_size),  # 画像サイズをinput_size×input_sizeに変形
             Normalize()
         ])
     }
Beispiel #7
0
 def __init__(self, input_size: int, color_mean: Tuple[int, int, int]):
     self.data_transform = {
         'train':
         Compose([
             ConvertFromInts(),
             # NOTE: dataset items are not normalized
             ToAbsoluteCoords(),  # de-normalize annotation data
             PhotometricDistort(),  # change image color randomly
             Expand(color_mean),  # expand image canvas
             RandomSampleCrop(),  # extract part of image randomly
             RandomMirror(),
             ToPercentCoords(),  # normalize annotation data with 0-1 range
             Resize(input_size
                    ),  # transform image size to input_size × input_size
             SubtractMeans(color_mean)
         ]),
         'val':
         Compose([
             ConvertFromInts(),
             Resize(input_size
                    ),  # transform image size to input_size × input_size
             SubtractMeans(color_mean)
         ])
     }