提交 b8a15893 编写于 作者: Y Yang Nie 提交者: Tingquan Gao

update data augment and init method for MobileViTv3-v2

上级 c32e2b09
......@@ -687,15 +687,25 @@ class MobileViTv3(nn.Layer):
def _init_weights(self, m):
if isinstance(m, nn.Conv2D):
fan_in = m.weight.shape[1] * m.weight.shape[2] * m.weight.shape[3]
fan_out = m.weight.shape[0] * m.weight.shape[2] * m.weight.shape[3]
nn.initializer.KaimingNormal(fan_in=fan_out)(m.weight)
if m.bias is not None:
nn.initializer.Constant(0)(m.bias)
if self.mobilevit_v2_based:
bound = 1.0 / fan_in**0.5
nn.initializer.Uniform(-bound, bound)(m.weight)
if m.bias is not None:
nn.initializer.Uniform(-bound, bound)(m.bias)
else:
nn.initializer.KaimingNormal(fan_in=fan_out)(m.weight)
if m.bias is not None:
nn.initializer.Constant(0)(m.bias)
elif isinstance(m, nn.BatchNorm2D):
nn.initializer.Constant(1)(m.weight)
nn.initializer.Constant(0)(m.bias)
elif isinstance(m, nn.Linear):
nn.initializer.TruncatedNormal(std=.02)(m.weight)
if self.mobilevit_v2_based:
nn.initializer.XavierUniform()(m.weight)
else:
nn.initializer.TruncatedNormal(std=.02)(m.weight)
if m.bias is not None:
nn.initializer.Constant(0)(m.bias)
......
......@@ -93,15 +93,15 @@ DataLoader:
r1: 0.3
attempt: 10
use_log_aspect: True
mode: pixel
mode: const
batch_transform_ops:
- OpSampler:
MixupOperator:
alpha: 0.2
prob: 0.5
prob: 0.25
CutmixOperator:
alpha: 1.0
prob: 0.5
prob: 0.25
sampler:
name: DistributedBatchSampler
batch_size: 128
......@@ -111,7 +111,7 @@ DataLoader:
num_workers: 4
use_shared_memory: True
Eval:
dataset:
dataset:
name: ImageNetDataset
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/val_list.txt
......
......@@ -93,15 +93,15 @@ DataLoader:
r1: 0.3
attempt: 10
use_log_aspect: True
mode: pixel
mode: const
batch_transform_ops:
- OpSampler:
MixupOperator:
alpha: 0.2
prob: 0.5
prob: 0.25
CutmixOperator:
alpha: 1.0
prob: 0.5
prob: 0.25
sampler:
name: DistributedBatchSampler
batch_size: 128
......@@ -111,7 +111,7 @@ DataLoader:
num_workers: 4
use_shared_memory: True
Eval:
dataset:
dataset:
name: ImageNetDataset
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/val_list.txt
......
......@@ -93,15 +93,15 @@ DataLoader:
r1: 0.3
attempt: 10
use_log_aspect: True
mode: pixel
mode: const
batch_transform_ops:
- OpSampler:
MixupOperator:
alpha: 0.2
prob: 0.5
prob: 0.25
CutmixOperator:
alpha: 1.0
prob: 0.5
prob: 0.25
sampler:
name: DistributedBatchSampler
batch_size: 128
......@@ -111,7 +111,7 @@ DataLoader:
num_workers: 4
use_shared_memory: True
Eval:
dataset:
dataset:
name: ImageNetDataset
image_root: ./dataset/ILSVRC2012/
cls_label_path: ./dataset/ILSVRC2012/val_list.txt
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册