Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleClas
提交
e4780174
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看板
提交
e4780174
编写于
7月 07, 2021
作者:
W
weishengyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
decorate open by with
上级
0c3c266a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
18 addition
and
11 deletion
+18
-11
deploy/paddleserving/image_http_client.py
deploy/paddleserving/image_http_client.py
+4
-2
docs/en/advanced_tutorials/image_augmentation/ImageAugment_en.md
.../advanced_tutorials/image_augmentation/ImageAugment_en.md
+6
-4
docs/zh_CN/advanced_tutorials/image_augmentation/ImageAugment.md
..._CN/advanced_tutorials/image_augmentation/ImageAugment.md
+6
-4
ppcls/data/dataloader/vehicle_dataset.py
ppcls/data/dataloader/vehicle_dataset.py
+2
-1
未找到文件。
deploy/paddleserving/image_http_client.py
浏览文件 @
e4780174
...
@@ -23,9 +23,11 @@ py_version = sys.version_info[0]
...
@@ -23,9 +23,11 @@ py_version = sys.version_info[0]
def
predict
(
image_path
,
server
):
def
predict
(
image_path
,
server
):
if
py_version
==
2
:
if
py_version
==
2
:
image
=
base64
.
b64encode
(
open
(
image_path
).
read
())
with
open
(
image_path
)
as
f
:
image
=
base64
.
b64encode
(
f
.
read
())
else
:
else
:
image
=
base64
.
b64encode
(
open
(
image_path
,
"rb"
).
read
()).
decode
(
"utf-8"
)
with
open
(
image_path
,
"rb"
)
as
f
:
image
=
base64
.
b64encode
(
f
.
read
()).
decode
(
"utf-8"
)
req
=
json
.
dumps
({
"feed"
:
[{
"image"
:
image
}],
"fetch"
:
[
"prediction"
]})
req
=
json
.
dumps
({
"feed"
:
[{
"image"
:
image
}],
"fetch"
:
[
"prediction"
]})
r
=
requests
.
post
(
r
=
requests
.
post
(
server
,
data
=
req
,
headers
=
{
"Content-Type"
:
"application/json"
})
server
,
data
=
req
,
headers
=
{
"Content-Type"
:
"application/json"
})
...
...
docs/en/advanced_tutorials/image_augmentation/ImageAugment_en.md
浏览文件 @
e4780174
...
@@ -154,10 +154,12 @@ cutout_op = Cutout(n_holes=1, length=112)
...
@@ -154,10 +154,12 @@ cutout_op = Cutout(n_holes=1, length=112)
ops
=
[
decode_op
,
resize_op
,
cutout_op
]
ops
=
[
decode_op
,
resize_op
,
cutout_op
]
imgs_dir
=
image_path
imgs_dir
=
"imgs_dir"
fnames
=
os
.
listdir
(
imgs_dir
)
file_names
=
os
.
listdir
(
imgs_dir
)
for
f
in
fnames
:
for
file_name
in
file_names
:
data
=
open
(
os
.
path
.
join
(
imgs_dir
,
f
)).
read
()
file_path
=
os
.
join
(
imgs_dir
,
file_name
)
with
open
(
file_path
)
as
f
:
data
=
f
.
read
()
img
=
transform
(
data
,
ops
)
img
=
transform
(
data
,
ops
)
```
```
...
...
docs/zh_CN/advanced_tutorials/image_augmentation/ImageAugment.md
浏览文件 @
e4780174
...
@@ -74,10 +74,12 @@ autoaugment_op = ImageNetPolicy()
...
@@ -74,10 +74,12 @@ autoaugment_op = ImageNetPolicy()
ops
=
[
decode_op
,
resize_op
,
autoaugment_op
]
ops
=
[
decode_op
,
resize_op
,
autoaugment_op
]
imgs_dir
=
图像路径
imgs_dir
=
"imgs_dir"
fnames
=
os
.
listdir
(
imgs_dir
)
file_names
=
os
.
listdir
(
imgs_dir
)
for
f
in
fnames
:
for
file_name
in
file_names
:
data
=
open
(
os
.
path
.
join
(
imgs_dir
,
f
)).
read
()
file_path
=
os
.
join
(
imgs_dir
,
file_name
)
with
open
(
file_path
)
as
f
:
data
=
f
.
read
()
img
=
transform
(
data
,
ops
)
img
=
transform
(
data
,
ops
)
```
```
...
...
ppcls/data/dataloader/vehicle_dataset.py
浏览文件 @
e4780174
...
@@ -61,7 +61,8 @@ class CompCars(Dataset):
...
@@ -61,7 +61,8 @@ class CompCars(Dataset):
label_path
=
os
.
path
.
join
(
self
.
_label_root
,
label_path
=
os
.
path
.
join
(
self
.
_label_root
,
l
[
0
].
split
(
'.'
)[
0
]
+
'.txt'
)
l
[
0
].
split
(
'.'
)[
0
]
+
'.txt'
)
assert
os
.
path
.
exists
(
label_path
)
assert
os
.
path
.
exists
(
label_path
)
bbox
=
open
(
label_path
).
readlines
()[
-
1
].
strip
().
split
()
with
open
(
label_path
)
as
f
:
bbox
=
f
.
readlines
()[
-
1
].
strip
().
split
()
bbox
=
[
int
(
x
)
for
x
in
bbox
]
bbox
=
[
int
(
x
)
for
x
in
bbox
]
self
.
images
.
append
(
os
.
path
.
join
(
self
.
_img_root
,
l
[
0
]))
self
.
images
.
append
(
os
.
path
.
join
(
self
.
_img_root
,
l
[
0
]))
self
.
labels
.
append
(
int
(
l
[
1
]))
self
.
labels
.
append
(
int
(
l
[
1
]))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录