提交 1e8a020f 编写于 作者: C cuicheng01

fix bug of image transforms

上级 d13cb223
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -76,8 +76,6 @@ DataLoader: ...@@ -76,8 +76,6 @@ DataLoader:
image_root: "./dataset/ILSVRC2012/" image_root: "./dataset/ILSVRC2012/"
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage:
size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
mean: [0.485, 0.456, 0.406] mean: [0.485, 0.456, 0.406]
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,7 +77,9 @@ DataLoader: ...@@ -77,7 +77,9 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
size: 224 resize_short: 320
- CropImage:
size: 299
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
mean: [0.485, 0.456, 0.406] mean: [0.485, 0.456, 0.406]
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -24,6 +24,7 @@ Loss: ...@@ -24,6 +24,7 @@ Loss:
Train: Train:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
epsilon: 0.1
Eval: Eval:
- CELoss: - CELoss:
weight: 1.0 weight: 1.0
...@@ -75,6 +76,8 @@ DataLoader: ...@@ -75,6 +76,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -17,7 +17,7 @@ Global: ...@@ -17,7 +17,7 @@ Global:
# model architecture # model architecture
Arch: Arch:
name: "ResNet101_vd" name: "ResNet34_vd"
# loss function config for traing/eval process # loss function config for traing/eval process
Loss: Loss:
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
# global configs # global configs
Global: Global:
checkpoints: null checkpoints: "output/ResNet50/ppcls_epoch_15"
pretrained_model: null pretrained_model: null
output_dir: "./output/" output_dir: "./output/"
device: "gpu" device: "gpu"
...@@ -77,6 +77,8 @@ DataLoader: ...@@ -77,6 +77,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -75,6 +75,8 @@ DataLoader: ...@@ -75,6 +75,8 @@ DataLoader:
cls_label_path: "./dataset/ILSVRC2012/val_list.txt" cls_label_path: "./dataset/ILSVRC2012/val_list.txt"
transform_ops: transform_ops:
- ResizeImage: - ResizeImage:
resize_short: 256
- CropImage:
size: 224 size: 224
- NormalizeImage: - NormalizeImage:
scale: 0.00392157 scale: 0.00392157
......
...@@ -30,13 +30,18 @@ from .common_dataset import CommonDataset ...@@ -30,13 +30,18 @@ from .common_dataset import CommonDataset
class ImageNetDataset(CommonDataset): class ImageNetDataset(CommonDataset):
def _load_anno(self): def _load_anno(self, seed=None):
assert os.path.exists(self._cls_path) assert os.path.exists(self._cls_path)
assert os.path.exists(self._img_root) assert os.path.exists(self._img_root)
self.images = [] self.images = []
self.labels = [] self.labels = []
with open(self._cls_path) as fd: with open(self._cls_path) as fd:
lines = fd.readlines() lines = fd.readlines()
if seed is not None:
np.random.RandomState(seed).shuffle(lines)
else:
np.random.shuffle(lines)
for l in lines: for l in lines:
l = l.strip().split(" ") l = l.strip().split(" ")
self.images.append(os.path.join(self._img_root, l[0])) self.images.append(os.path.join(self._img_root, l[0]))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册