Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yinnxinn
chineseocr
提交
f2cb5aa2
C
chineseocr
项目概览
yinnxinn
/
chineseocr
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
chineseocr
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
f2cb5aa2
编写于
5月 27, 2019
作者:
W
wenlihaoyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
升级opencv版本到4.0.0.21,opencv调用darknet部分无识别结果
上级
c6efd637
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
19 deletion
+31
-19
setup-cpu.md
setup-cpu.md
+1
-1
setup.md
setup.md
+1
-1
text/opencv_dnn_detect.py
text/opencv_dnn_detect.py
+29
-17
未找到文件。
setup-cpu.md
浏览文件 @
f2cb5aa2
...
@@ -3,7 +3,7 @@ conda create -n chineseocr python=3.6 pip scipy numpy jupyter ipython ##运用co
...
@@ -3,7 +3,7 @@ conda create -n chineseocr python=3.6 pip scipy numpy jupyter ipython ##运用co
source activate chineseocr
source activate chineseocr
git submodule init && git submodule update
git submodule init && git submodule update
cd darknet/ && make && cd ..
cd darknet/ && make && cd ..
pip install easydict opencv-contrib-python==
3.4.2.16
Cython h5py lmdb mahotas pandas requests bs4 matplotlib lxml -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install easydict opencv-contrib-python==
4.0.0.21
Cython h5py lmdb mahotas pandas requests bs4 matplotlib lxml -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -U pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -U pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install web.py==0.40.dev0
pip install web.py==0.40.dev0
pip install keras==2.1.5 tensorflow==1.8
pip install keras==2.1.5 tensorflow==1.8
...
...
setup.md
浏览文件 @
f2cb5aa2
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
conda create -n chineseocr python=3.6 pip scipy numpy jupyter ipython ##运用conda 创建python环境
conda create -n chineseocr python=3.6 pip scipy numpy jupyter ipython ##运用conda 创建python环境
source activate chineseocr
source activate chineseocr
git submodule init && git submodule update
git submodule init && git submodule update
pip install easydict opencv-contrib-python==
3.4.2.16
Cython h5py lmdb mahotas pandas requests bs4 matplotlib lxml -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install easydict opencv-contrib-python==
4.0.0.21
Cython h5py lmdb mahotas pandas requests bs4 matplotlib lxml -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -U pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install -U pillow -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install keras==2.1.5 tensorflow==1.8 tensorflow-gpu==1.8
pip install keras==2.1.5 tensorflow==1.8 tensorflow-gpu==1.8
pip install web.py==0.40.dev0
pip install web.py==0.40.dev0
...
...
text/opencv_dnn_detect.py
浏览文件 @
f2cb5aa2
...
@@ -24,24 +24,36 @@ if opencvFlag=='keras':
...
@@ -24,24 +24,36 @@ if opencvFlag=='keras':
else
:
else
:
angleNet
=
cv2
.
dnn
.
readNetFromTensorflow
(
AngleModelPb
,
AngleModelPbtxt
)
##dnn 文字方向检测
angleNet
=
cv2
.
dnn
.
readNetFromTensorflow
(
AngleModelPb
,
AngleModelPbtxt
)
##dnn 文字方向检测
textNet
=
cv2
.
dnn
.
readNetFromDarknet
(
yoloCfg
,
yoloWeights
)
##文字定位
textNet
=
cv2
.
dnn
.
readNetFromDarknet
(
yoloCfg
,
yoloWeights
)
##文字定位
def
text_detect
(
img
):
def
text_detect
(
img
):
thresh
=
0
thresh
=
0
h
,
w
=
img
.
shape
[:
2
]
img_height
,
img_width
=
img
.
shape
[:
2
]
inputBlob
=
cv2
.
dnn
.
blobFromImage
(
img
,
scalefactor
=
1.0
,
size
=
IMGSIZE
,
swapRB
=
True
,
crop
=
False
);
inputBlob
=
cv2
.
dnn
.
blobFromImage
(
img
,
scalefactor
=
0.00390625
,
size
=
IMGSIZE
,
swapRB
=
True
,
crop
=
False
);
textNet
.
setInput
(
inputBlob
/
255.0
)
textNet
.
setInput
(
inputBlob
)
outputName
=
textNet
.
getUnconnectedOutLayersNames
()
pred
=
textNet
.
forward
()
outputs
=
textNet
.
forward
(
outputName
)
cx
=
pred
[:,
0
]
*
w
class_ids
=
[]
cy
=
pred
[:,
1
]
*
h
confidences
=
[]
xmin
=
cx
-
pred
[:,
2
]
*
w
/
2
boxes
=
[]
xmax
=
cx
+
pred
[:,
2
]
*
w
/
2
for
output
in
outputs
:
ymin
=
cy
-
pred
[:,
3
]
*
h
/
2
for
detection
in
output
:
ymax
=
cy
+
pred
[:,
3
]
*
h
/
2
scores
=
detection
[
5
:]
scores
=
pred
[:,
4
]
class_id
=
np
.
argmax
(
scores
)
indx
=
np
.
where
(
scores
>
thresh
)[
0
]
confidence
=
scores
[
class_id
]
scores
=
scores
[
indx
]
if
confidence
>
thresh
:
boxes
=
np
.
array
(
list
(
zip
(
xmin
[
indx
],
ymin
[
indx
],
xmax
[
indx
],
ymax
[
indx
])))
center_x
=
int
(
detection
[
0
]
*
img_width
)
return
boxes
,
scores
center_y
=
int
(
detection
[
1
]
*
img_height
)
width
=
int
(
detection
[
2
]
*
img_width
)
height
=
int
(
detection
[
3
]
*
img_height
)
left
=
int
(
center_x
-
width
/
2
)
top
=
int
(
center_y
-
height
/
2
)
if
class_id
==
1
:
class_ids
.
append
(
class_id
)
confidences
.
append
(
float
(
confidence
))
boxes
.
append
([
left
,
top
,
left
+
width
,
top
+
height
])
return
np
.
array
(
boxes
),
np
.
array
(
confidences
)
def
angle_detect_dnn
(
img
,
adjust
=
True
):
def
angle_detect_dnn
(
img
,
adjust
=
True
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录