Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Hypo
DeepMosaics
提交
6ca84044
DeepMosaics
项目概览
Hypo
/
DeepMosaics
8 个月 前同步成功
通知
341
Star
84
Fork
13
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
17
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
DeepMosaics
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
17
Issue
17
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6ca84044
编写于
9月 11, 2020
作者:
H
hypox64
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bug
#28
上级
480fea7b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
9 deletion
+22
-9
README.md
README.md
+2
-2
README_CN.md
README_CN.md
+2
-2
cores/options.py
cores/options.py
+1
-1
deepmosaic.py
deepmosaic.py
+11
-0
util/image_processing.py
util/image_processing.py
+6
-4
未找到文件。
README.md
浏览文件 @
6ca84044
...
...
@@ -67,11 +67,11 @@ You can download pre_trained models and put them into './pretrained_models'.<br>
#### Simple example
*
Add Mosaic (output media will save in './result')
<br>
```
bash
python
3
deepmosaic.py
--media_path
./imgs/ruoruo.jpg
--model_path
./pretrained_models/mosaic/add_face.pth
--use_gpu
0
python deepmosaic.py
--media_path
./imgs/ruoruo.jpg
--model_path
./pretrained_models/mosaic/add_face.pth
--use_gpu
0
```
*
Clean Mosaic (output media will save in './result')
<br>
```
bash
python
3
deepmosaic.py
--media_path
./result/ruoruo_add.jpg
--model_path
./pretrained_models/mosaic/clean_face_HD.pth
--use_gpu
0
python deepmosaic.py
--media_path
./result/ruoruo_add.jpg
--model_path
./pretrained_models/mosaic/clean_face_HD.pth
--use_gpu
0
```
#### More parameters
If you want to test other image or video, please refer to this file.
<br>
...
...
README_CN.md
浏览文件 @
6ca84044
...
...
@@ -64,11 +64,11 @@ cd DeepMosaics
#### 简单的例子
*
为视频添加马赛克,例子中认为脸是需要打码的区域 ,可以通过切换预训练模型切换自动打码区域(输出结果将储存到 './result')
<br>
```
bash
python
3
deepmosaic.py
--media_path
./imgs/ruoruo.jpg
--model_path
./pretrained_models/mosaic/add_face.pth
--use_gpu
0
python deepmosaic.py
--media_path
./imgs/ruoruo.jpg
--model_path
./pretrained_models/mosaic/add_face.pth
--use_gpu
0
```
*
将视频中的马赛克移除,对于不同的打码物体需要使用对应的预训练模型进行马赛克消除(输出结果将储存到 './result')
<br>
```
bash
python
3
deepmosaic.py
--media_path
./result/ruoruo_add.jpg
--model_path
./pretrained_models/mosaic/clean_face_HD.pth
--use_gpu
0
python deepmosaic.py
--media_path
./result/ruoruo_add.jpg
--model_path
./pretrained_models/mosaic/clean_face_HD.pth
--use_gpu
0
```
#### 更多的参数
如果想要测试其他的图片或视频,请参照以下文件输入参数.
<br>
...
...
cores/options.py
浏览文件 @
6ca84044
...
...
@@ -13,7 +13,7 @@ class Options():
self
.
parser
.
add_argument
(
'--use_gpu'
,
type
=
int
,
default
=
0
,
help
=
'if -1, use cpu'
)
self
.
parser
.
add_argument
(
'--media_path'
,
type
=
str
,
default
=
'./imgs/ruoruo.jpg'
,
help
=
'your videos or images path'
)
self
.
parser
.
add_argument
(
'-ss'
,
'--start_time'
,
type
=
str
,
default
=
'00:00:00'
,
help
=
'start position of video, default is the beginning of video'
)
self
.
parser
.
add_argument
(
'-t'
,
'--last_time'
,
type
=
str
,
default
=
'00:00:00'
,
help
=
'
limit the
duration of the video, default is the entire video'
)
self
.
parser
.
add_argument
(
'-t'
,
'--last_time'
,
type
=
str
,
default
=
'00:00:00'
,
help
=
'duration of the video, default is the entire video'
)
self
.
parser
.
add_argument
(
'--mode'
,
type
=
str
,
default
=
'auto'
,
help
=
'Program running mode. auto | add | clean | style'
)
self
.
parser
.
add_argument
(
'--model_path'
,
type
=
str
,
default
=
'./pretrained_models/mosaic/add_face.pth'
,
help
=
'pretrained model path'
)
self
.
parser
.
add_argument
(
'--result_dir'
,
type
=
str
,
default
=
'./result'
,
help
=
'output media will be saved here'
)
...
...
deepmosaic.py
浏览文件 @
6ca84044
...
...
@@ -65,6 +65,17 @@ if __name__ == '__main__':
print
(
'Finished!'
)
except
Exception
as
ex
:
print
(
'--------------------ERROR--------------------'
)
print
(
'--------------Environment--------------'
)
print
(
'DeepMosaics: 0.4.0'
)
print
(
'Python:'
,
sys
.
version
)
import
torch
print
(
'Pytorch:'
,
torch
.
__version__
)
import
cv2
print
(
'OpenCV:'
,
cv2
.
__version__
)
import
platform
print
(
'Platform:'
,
platform
.
platform
())
print
(
'--------------BUG--------------'
)
ex_type
,
ex_val
,
ex_stack
=
sys
.
exc_info
()
print
(
'Error Type:'
,
ex_type
)
print
(
ex_val
)
...
...
util/image_processing.py
浏览文件 @
6ca84044
...
...
@@ -24,7 +24,7 @@ def imread(file_path,mod = 'normal',loadsize = 0):
'''
if
system_type
==
'Linux'
:
if
mod
==
'normal'
:
img
=
cv2
.
imread
(
file_path
)
img
=
cv2
.
imread
(
file_path
,
1
)
elif
mod
==
'gray'
:
img
=
cv2
.
imread
(
file_path
,
0
)
elif
mod
==
'all'
:
...
...
@@ -33,11 +33,13 @@ def imread(file_path,mod = 'normal',loadsize = 0):
#In windows, for chinese path, use cv2.imdecode insteaded.
#It will loss EXIF, I can't fix it
else
:
if
mod
==
'gray'
:
if
mod
==
'normal'
:
img
=
cv2
.
imdecode
(
np
.
fromfile
(
file_path
,
dtype
=
np
.
uint8
),
1
)
elif
mod
==
'gray'
:
img
=
cv2
.
imdecode
(
np
.
fromfile
(
file_path
,
dtype
=
np
.
uint8
),
0
)
el
se
:
el
if
mod
==
'all'
:
img
=
cv2
.
imdecode
(
np
.
fromfile
(
file_path
,
dtype
=
np
.
uint8
),
-
1
)
if
loadsize
!=
0
:
img
=
resize
(
img
,
loadsize
,
interpolation
=
cv2
.
INTER_CUBIC
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录