Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
0ea0f8e8
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
接近 2 年 前同步成功
通知
284
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
0ea0f8e8
编写于
9月 16, 2022
作者:
jm_12138
提交者:
GitHub
9月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update user_guided_colorization (#1994)
* update user_guided_colorization * add clean func
上级
9d830b93
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
95 addition
and
1 deletion
+95
-1
modules/image/Image_editing/colorization/user_guided_colorization/README.md
...e_editing/colorization/user_guided_colorization/README.md
+4
-0
modules/image/Image_editing/colorization/user_guided_colorization/README_en.md
...diting/colorization/user_guided_colorization/README_en.md
+5
-0
modules/image/Image_editing/colorization/user_guided_colorization/module.py
...e_editing/colorization/user_guided_colorization/module.py
+1
-1
modules/image/Image_editing/colorization/user_guided_colorization/test.py
...age_editing/colorization/user_guided_colorization/test.py
+85
-0
未找到文件。
modules/image/Image_editing/colorization/user_guided_colorization/README.md
浏览文件 @
0ea0f8e8
...
...
@@ -201,4 +201,8 @@
初始发布
-
```shell
$ hub install user_guided_colorization==1.0.0
```
modules/image/Image_editing/colorization/user_guided_colorization/README_en.md
浏览文件 @
0ea0f8e8
...
...
@@ -203,3 +203,8 @@
*
1.0.0
First release
-
```shell
$ hub install user_guided_colorization==1.0.0
```
modules/image/Image_editing/colorization/user_guided_colorization/module.py
浏览文件 @
0ea0f8e8
...
...
@@ -20,7 +20,7 @@ from paddle.nn import Conv2D, Conv2DTranspose
from
paddlehub.module.module
import
moduleinfo
import
paddlehub.vision.transforms
as
T
from
paddlehub.module.cv_module
import
ImageColorizeModule
from
user_guided_colorization
.data_feed
import
ColorizePreprocess
from
.data_feed
import
ColorizePreprocess
@
moduleinfo
(
...
...
modules/image/Image_editing/colorization/user_guided_colorization/test.py
0 → 100644
浏览文件 @
0ea0f8e8
import
os
import
shutil
import
unittest
import
cv2
import
requests
import
numpy
as
np
import
paddlehub
as
hub
os
.
environ
[
'CUDA_VISIBLE_DEVICES'
]
=
'0'
class
TestHubModule
(
unittest
.
TestCase
):
@
classmethod
def
setUpClass
(
cls
)
->
None
:
img_url
=
'https://unsplash.com/photos/1sLIu1XKQrY/download?ixid=MnwxMjA3fDB8MXxhbGx8MTJ8fHx8fHwyfHwxNjYyMzQxNDUx&force=true&w=640'
if
not
os
.
path
.
exists
(
'tests'
):
os
.
makedirs
(
'tests'
)
response
=
requests
.
get
(
img_url
)
assert
response
.
status_code
==
200
,
'Network Error.'
with
open
(
'tests/test.jpg'
,
'wb'
)
as
f
:
f
.
write
(
response
.
content
)
cls
.
module
=
hub
.
Module
(
name
=
"user_guided_colorization"
)
@
classmethod
def
tearDownClass
(
cls
)
->
None
:
shutil
.
rmtree
(
'tests'
)
shutil
.
rmtree
(
'colorization'
)
def
test_predict1
(
self
):
results
=
self
.
module
.
predict
(
images
=
[
'tests/test.jpg'
],
visualization
=
False
)
gray
=
results
[
0
][
'gray'
]
hint
=
results
[
0
][
'hint'
]
real
=
results
[
0
][
'real'
]
fake_reg
=
results
[
0
][
'fake_reg'
]
self
.
assertIsInstance
(
gray
,
np
.
ndarray
)
self
.
assertIsInstance
(
hint
,
np
.
ndarray
)
self
.
assertIsInstance
(
real
,
np
.
ndarray
)
self
.
assertIsInstance
(
fake_reg
,
np
.
ndarray
)
def
test_predict2
(
self
):
results
=
self
.
module
.
predict
(
images
=
[
cv2
.
imread
(
'tests/test.jpg'
)],
visualization
=
False
)
gray
=
results
[
0
][
'gray'
]
hint
=
results
[
0
][
'hint'
]
real
=
results
[
0
][
'real'
]
fake_reg
=
results
[
0
][
'fake_reg'
]
self
.
assertIsInstance
(
gray
,
np
.
ndarray
)
self
.
assertIsInstance
(
hint
,
np
.
ndarray
)
self
.
assertIsInstance
(
real
,
np
.
ndarray
)
self
.
assertIsInstance
(
fake_reg
,
np
.
ndarray
)
def
test_predict3
(
self
):
results
=
self
.
module
.
predict
(
images
=
[
cv2
.
imread
(
'tests/test.jpg'
)],
visualization
=
True
)
gray
=
results
[
0
][
'gray'
]
hint
=
results
[
0
][
'hint'
]
real
=
results
[
0
][
'real'
]
fake_reg
=
results
[
0
][
'fake_reg'
]
self
.
assertIsInstance
(
gray
,
np
.
ndarray
)
self
.
assertIsInstance
(
hint
,
np
.
ndarray
)
self
.
assertIsInstance
(
real
,
np
.
ndarray
)
self
.
assertIsInstance
(
fake_reg
,
np
.
ndarray
)
def
test_predict4
(
self
):
self
.
assertRaises
(
IndexError
,
self
.
module
.
predict
,
images
=
[
'no.jpg'
],
visualization
=
False
)
if
__name__
==
"__main__"
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录