Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
03bd4e44
P
PaddleClas
项目概览
PaddlePaddle
/
PaddleClas
接近 2 年 前同步成功
通知
116
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看板
提交
03bd4e44
编写于
9月 29, 2022
作者:
Y
Yang Nie
提交者:
Tingquan Gao
4月 04, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add use_log_aspect for RandCropImage
上级
cc4333a3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
9 deletion
+15
-9
ppcls/configs/ImageNet/MicroNet/micronet_m3.yaml
ppcls/configs/ImageNet/MicroNet/micronet_m3.yaml
+4
-0
ppcls/data/preprocess/ops/operators.py
ppcls/data/preprocess/ops/operators.py
+11
-9
未找到文件。
ppcls/configs/ImageNet/MicroNet/micronet_m3.yaml
浏览文件 @
03bd4e44
...
...
@@ -53,9 +53,11 @@ DataLoader:
-
DecodeImage
:
to_rgb
:
True
channel_first
:
False
backend
:
pil
-
RandCropImage
:
size
:
224
interpolation
:
bilinear
use_log_aspect
:
True
backend
:
pil
-
RandFlipImage
:
flip_code
:
1
...
...
@@ -83,6 +85,7 @@ DataLoader:
-
DecodeImage
:
to_rgb
:
True
channel_first
:
False
backend
:
pil
-
ResizeImage
:
resize_short
:
256
interpolation
:
bilinear
...
...
@@ -110,6 +113,7 @@ Infer:
-
DecodeImage
:
to_rgb
:
True
channel_first
:
False
backend
:
pil
-
ResizeImage
:
resize_short
:
256
interpolation
:
bilinear
...
...
ppcls/data/preprocess/ops/operators.py
浏览文件 @
03bd4e44
...
...
@@ -445,6 +445,7 @@ class RandCropImage(object):
scale
=
None
,
ratio
=
None
,
interpolation
=
None
,
use_log_aspect
=
False
,
backend
=
"cv2"
):
if
type
(
size
)
is
int
:
self
.
size
=
(
size
,
size
)
# (h, w)
...
...
@@ -454,6 +455,7 @@ class RandCropImage(object):
self
.
progress_size
=
progress_size
self
.
scale
=
[
0.08
,
1.0
]
if
scale
is
None
else
scale
self
.
ratio
=
[
3.
/
4.
,
4.
/
3.
]
if
ratio
is
None
else
ratio
self
.
use_log_aspect
=
use_log_aspect
self
.
_resize_func
=
UnifiedResize
(
interpolation
=
interpolation
,
backend
=
backend
)
...
...
@@ -464,21 +466,21 @@ class RandCropImage(object):
scale
=
self
.
scale
ratio
=
self
.
ratio
aspect_ratio
=
math
.
sqrt
(
random
.
uniform
(
*
ratio
))
w
=
1.
*
aspect_ratio
h
=
1.
/
aspect_ratio
if
self
.
use_log_aspect
:
log_ratio
=
list
(
map
(
math
.
log
,
ratio
))
aspect_ratio
=
math
.
exp
(
random
.
uniform
(
*
log_ratio
))
else
:
aspect_ratio
=
random
.
uniform
(
*
ratio
)
img_h
,
img_w
=
img
.
shape
[:
2
]
bound
=
min
((
float
(
img_w
)
/
img_h
)
/
(
w
**
2
),
(
float
(
img_h
)
/
img_w
)
/
(
h
**
2
))
bound
=
min
((
float
(
img_w
)
/
img_h
)
/
aspect_ratio
,
(
float
(
img_h
)
/
img_w
)
*
aspect_ratio
)
scale_max
=
min
(
scale
[
1
],
bound
)
scale_min
=
min
(
scale
[
0
],
bound
)
target_area
=
img_w
*
img_h
*
random
.
uniform
(
scale_min
,
scale_max
)
target_size
=
math
.
sqrt
(
target_area
)
w
=
int
(
target_size
*
w
)
h
=
int
(
target_size
*
h
)
w
=
int
(
math
.
sqrt
(
target_area
*
aspect_ratio
))
h
=
int
(
math
.
sqrt
(
target_area
/
aspect_ratio
))
i
=
random
.
randint
(
0
,
img_w
-
w
)
j
=
random
.
randint
(
0
,
img_h
-
h
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录