提交 c291b68f 编写于 作者: F fuyi02

modify padding value

上级 dd4e5cf0
...@@ -410,7 +410,7 @@ def rand_crop(crop_img, crop_seg, mode=ModelPhase.TRAIN): ...@@ -410,7 +410,7 @@ def rand_crop(crop_img, crop_seg, mode=ModelPhase.TRAIN):
0, 0,
pad_width, pad_width,
cv2.BORDER_CONSTANT, cv2.BORDER_CONSTANT,
value=cfg.MEAN) value=cfg.DATASET.PADDING_VALUE)
if crop_seg is not None: if crop_seg is not None:
crop_seg = cv2.copyMakeBorder( crop_seg = cv2.copyMakeBorder(
crop_seg, crop_seg,
......
...@@ -246,7 +246,7 @@ class SegDataset(object): ...@@ -246,7 +246,7 @@ class SegDataset(object):
img, img,
grt, grt,
rich_crop_max_rotation=cfg.AUG.RICH_CROP.MAX_ROTATION, rich_crop_max_rotation=cfg.AUG.RICH_CROP.MAX_ROTATION,
mean_value=cfg.MEAN) mean_value=cfg.DATASET.PADDING_VALUE)
img, grt = aug.rand_scale_aspect( img, grt = aug.rand_scale_aspect(
img, img,
......
...@@ -292,7 +292,7 @@ def train(cfg): ...@@ -292,7 +292,7 @@ def train(cfg):
for var in load_vars: for var in load_vars:
print("Parameter[{}] loaded sucessfully!".format(var.name)) print("Parameter[{}] loaded sucessfully!".format(var.name))
for var in load_fail_vars: for var in load_fail_vars:
print("Parameter[{}] shape does not match current network, skip" print("Parameter[{}] don't exist or shape does not match current network, skip"
" to load it.".format(var.name)) " to load it.".format(var.name))
print("{}/{} pretrained parameters loaded successfully!".format( print("{}/{} pretrained parameters loaded successfully!".format(
len(load_vars), len(load_vars),
......
...@@ -97,6 +97,8 @@ class SegConfig(dict): ...@@ -97,6 +97,8 @@ class SegConfig(dict):
raise KeyError( raise KeyError(
'DATASET.IMAGE_TYPE config error, only support `rgb`, `gray` and `rgba`' 'DATASET.IMAGE_TYPE config error, only support `rgb`, `gray` and `rgba`'
) )
if self.MEAN is not None:
self.DATASET.PADDING_VALUE = [x*255.0 for x in self.MEAN]
if not self.TRAIN_CROP_SIZE: if not self.TRAIN_CROP_SIZE:
raise ValueError( raise ValueError(
......
...@@ -65,6 +65,8 @@ cfg.DATASET.DATA_DIM = 3 ...@@ -65,6 +65,8 @@ cfg.DATASET.DATA_DIM = 3
cfg.DATASET.SEPARATOR = ' ' cfg.DATASET.SEPARATOR = ' '
# 忽略的像素标签值, 默认为255,一般无需改动 # 忽略的像素标签值, 默认为255,一般无需改动
cfg.DATASET.IGNORE_INDEX = 255 cfg.DATASET.IGNORE_INDEX = 255
# 数据增强是图像的padding值
cfg.DATASET.PADDING_VALUE = [127.5,127.5,127.5]
########################### 数据增强配置 ###################################### ########################### 数据增强配置 ######################################
# 图像镜像左右翻转 # 图像镜像左右翻转
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册