Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
400de784
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
大约 1 年 前同步成功
通知
115
Star
4999
Fork
1114
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
6
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleClas
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
6
合并请求
6
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
400de784
编写于
3月 07, 2023
作者:
Y
Yang Nie
提交者:
Tingquan Gao
4月 06, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update RandAugmentV3
上级
5f2eaa7c
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
91 addition
and
9 deletion
+91
-9
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x0_5.yaml
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x0_5.yaml
+2
-3
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x0_75.yaml
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x0_75.yaml
+2
-3
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x1_0.yaml
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x1_0.yaml
+2
-3
ppcls/data/preprocess/ops/randaugment.py
ppcls/data/preprocess/ops/randaugment.py
+85
-0
未找到文件。
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x0_5.yaml
浏览文件 @
400de784
...
@@ -79,10 +79,9 @@ DataLoader:
...
@@ -79,10 +79,9 @@ DataLoader:
use_log_aspect
:
True
use_log_aspect
:
True
-
RandFlipImage
:
-
RandFlipImage
:
flip_code
:
1
flip_code
:
1
-
TimmAutoAugment
:
-
RandAugmentV3
:
config_str
:
rand-m9-mstd0.5-inc1
num_layers
:
2
interpolation
:
bicubic
interpolation
:
bicubic
img_size
:
256
-
NormalizeImage
:
-
NormalizeImage
:
scale
:
1.0/255.0
scale
:
1.0/255.0
mean
:
[
0.0
,
0.0
,
0.0
]
mean
:
[
0.0
,
0.0
,
0.0
]
...
...
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x0_75.yaml
浏览文件 @
400de784
...
@@ -79,10 +79,9 @@ DataLoader:
...
@@ -79,10 +79,9 @@ DataLoader:
use_log_aspect
:
True
use_log_aspect
:
True
-
RandFlipImage
:
-
RandFlipImage
:
flip_code
:
1
flip_code
:
1
-
TimmAutoAugment
:
-
RandAugmentV3
:
config_str
:
rand-m9-mstd0.5-inc1
num_layers
:
2
interpolation
:
bicubic
interpolation
:
bicubic
img_size
:
256
-
NormalizeImage
:
-
NormalizeImage
:
scale
:
1.0/255.0
scale
:
1.0/255.0
mean
:
[
0.0
,
0.0
,
0.0
]
mean
:
[
0.0
,
0.0
,
0.0
]
...
...
ppcls/configs/ImageNet/MobileViTv3/MobileViTv3_x1_0.yaml
浏览文件 @
400de784
...
@@ -79,10 +79,9 @@ DataLoader:
...
@@ -79,10 +79,9 @@ DataLoader:
use_log_aspect
:
True
use_log_aspect
:
True
-
RandFlipImage
:
-
RandFlipImage
:
flip_code
:
1
flip_code
:
1
-
TimmAutoAugment
:
-
RandAugmentV3
:
config_str
:
rand-m9-mstd0.5-inc1
num_layers
:
2
interpolation
:
bicubic
interpolation
:
bicubic
img_size
:
256
-
NormalizeImage
:
-
NormalizeImage
:
scale
:
1.0/255.0
scale
:
1.0/255.0
mean
:
[
0.0
,
0.0
,
0.0
]
mean
:
[
0.0
,
0.0
,
0.0
]
...
...
ppcls/data/preprocess/ops/randaugment.py
浏览文件 @
400de784
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
import
random
import
random
from
.operators
import
RawColorJitter
from
.operators
import
RawColorJitter
from
.timm_autoaugment
import
_pil_interp
from
paddle.vision.transforms
import
transforms
as
T
from
paddle.vision.transforms
import
transforms
as
T
import
numpy
as
np
import
numpy
as
np
...
@@ -260,3 +261,87 @@ class RandAugmentV2(RandAugment):
...
@@ -260,3 +261,87 @@ class RandAugmentV2(RandAugment):
"invert"
:
lambda
img
,
_
:
ImageOps
.
invert
(
img
),
"invert"
:
lambda
img
,
_
:
ImageOps
.
invert
(
img
),
"cutout"
:
lambda
img
,
magnitude
:
cutout
(
img
,
magnitude
,
replace
=
fillcolor
[
0
])
"cutout"
:
lambda
img
,
magnitude
:
cutout
(
img
,
magnitude
,
replace
=
fillcolor
[
0
])
}
}
class
RandAugmentV3
(
RandAugment
):
"""Customed RandAugment for MobileViTv2"""
def
__init__
(
self
,
num_layers
=
2
,
magnitude
=
3
,
fillcolor
=
(
0
,
0
,
0
),
interpolation
=
"bicubic"
):
self
.
num_layers
=
num_layers
self
.
magnitude
=
magnitude
self
.
max_level
=
10
interpolation
=
_pil_interp
(
interpolation
)
abso_level
=
self
.
magnitude
/
self
.
max_level
self
.
level_map
=
{
"shearX"
:
0.3
*
abso_level
,
"shearY"
:
0.3
*
abso_level
,
"translateX"
:
150.0
/
331.0
*
abso_level
,
"translateY"
:
150.0
/
331.0
*
abso_level
,
"rotate"
:
30
*
abso_level
,
"color"
:
0.9
*
abso_level
,
"posterize"
:
8
-
int
(
4.0
*
abso_level
),
"solarize"
:
255.0
*
(
1
-
abso_level
),
"contrast"
:
0.9
*
abso_level
,
"sharpness"
:
0.9
*
abso_level
,
"brightness"
:
0.9
*
abso_level
,
"autocontrast"
:
0
,
"equalize"
:
0
,
"invert"
:
0
}
rnd_ch_op
=
random
.
choice
self
.
func
=
{
"shearX"
:
lambda
img
,
magnitude
:
img
.
transform
(
img
.
size
,
Image
.
AFFINE
,
(
1
,
magnitude
*
rnd_ch_op
([
-
1
,
1
]),
0
,
0
,
1
,
0
),
interpolation
,
fillcolor
=
fillcolor
),
"shearY"
:
lambda
img
,
magnitude
:
img
.
transform
(
img
.
size
,
Image
.
AFFINE
,
(
1
,
0
,
0
,
magnitude
*
rnd_ch_op
([
-
1
,
1
]),
1
,
0
),
interpolation
,
fillcolor
=
fillcolor
),
"translateX"
:
lambda
img
,
magnitude
:
img
.
transform
(
img
.
size
,
Image
.
AFFINE
,
(
1
,
0
,
magnitude
*
img
.
size
[
0
]
*
rnd_ch_op
([
-
1
,
1
]),
0
,
1
,
0
),
interpolation
,
fillcolor
=
fillcolor
),
"translateY"
:
lambda
img
,
magnitude
:
img
.
transform
(
img
.
size
,
Image
.
AFFINE
,
(
1
,
0
,
0
,
0
,
1
,
magnitude
*
img
.
size
[
1
]
*
rnd_ch_op
([
-
1
,
1
])),
interpolation
,
fillcolor
=
fillcolor
),
"rotate"
:
lambda
img
,
magnitude
:
img
.
rotate
(
magnitude
*
rnd_ch_op
([
-
1
,
1
]),
interpolation
,
fillcolor
=
fillcolor
),
"color"
:
lambda
img
,
magnitude
:
ImageEnhance
.
Color
(
img
).
enhance
(
1
+
magnitude
*
rnd_ch_op
([
-
1
,
1
])),
"posterize"
:
lambda
img
,
magnitude
:
ImageOps
.
posterize
(
img
,
magnitude
),
"solarize"
:
lambda
img
,
magnitude
:
ImageOps
.
solarize
(
img
,
magnitude
),
"contrast"
:
lambda
img
,
magnitude
:
ImageEnhance
.
Contrast
(
img
).
enhance
(
1
+
magnitude
*
rnd_ch_op
([
-
1
,
1
])),
"sharpness"
:
lambda
img
,
magnitude
:
ImageEnhance
.
Sharpness
(
img
).
enhance
(
1
+
magnitude
*
rnd_ch_op
([
-
1
,
1
])),
"brightness"
:
lambda
img
,
magnitude
:
ImageEnhance
.
Brightness
(
img
).
enhance
(
1
+
magnitude
*
rnd_ch_op
([
-
1
,
1
])),
"autocontrast"
:
lambda
img
,
_
:
ImageOps
.
autocontrast
(
img
),
"equalize"
:
lambda
img
,
_
:
ImageOps
.
equalize
(
img
),
"invert"
:
lambda
img
,
_
:
ImageOps
.
invert
(
img
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录