Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
paddle_dbnet
Commits
16003260
Unverified
Commit
16003260
authored
Jul 15, 2020
by
dyning
Committed by
GitHub
Jul 15, 2020
Browse files
Merge pull request #338 from littletomatodonkey/disable_debug
disable config info for cpp infer
parents
586daaea
11723722
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
deploy/cpp_infer/src/ocr_det.cpp
deploy/cpp_infer/src/ocr_det.cpp
+2
-1
deploy/cpp_infer/src/ocr_rec.cpp
deploy/cpp_infer/src/ocr_rec.cpp
+2
-1
deploy/cpp_infer/src/postprocess_op.cpp
deploy/cpp_infer/src/postprocess_op.cpp
+12
-2
No files found.
deploy/cpp_infer/src/ocr_det.cpp
View file @
16003260
...
@@ -38,6 +38,7 @@ void DBDetector::LoadModel(const std::string &model_dir) {
...
@@ -38,6 +38,7 @@ void DBDetector::LoadModel(const std::string &model_dir) {
config
.
SwitchIrOptim
(
true
);
config
.
SwitchIrOptim
(
true
);
config
.
EnableMemoryOptim
();
config
.
EnableMemoryOptim
();
config
.
DisableGlogInfo
();
this
->
predictor_
=
CreatePaddlePredictor
(
config
);
this
->
predictor_
=
CreatePaddlePredictor
(
config
);
}
}
...
@@ -106,4 +107,4 @@ void DBDetector::Run(cv::Mat &img,
...
@@ -106,4 +107,4 @@ void DBDetector::Run(cv::Mat &img,
}
}
}
}
}
// namespace PaddleOCR
}
// namespace PaddleOCR
\ No newline at end of file
deploy/cpp_infer/src/ocr_rec.cpp
View file @
16003260
...
@@ -127,6 +127,7 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) {
...
@@ -127,6 +127,7 @@ void CRNNRecognizer::LoadModel(const std::string &model_dir) {
config
.
SwitchIrOptim
(
true
);
config
.
SwitchIrOptim
(
true
);
config
.
EnableMemoryOptim
();
config
.
EnableMemoryOptim
();
config
.
DisableGlogInfo
();
this
->
predictor_
=
CreatePaddlePredictor
(
config
);
this
->
predictor_
=
CreatePaddlePredictor
(
config
);
}
}
...
@@ -186,4 +187,4 @@ cv::Mat CRNNRecognizer::GetRotateCropImage(const cv::Mat &srcimage,
...
@@ -186,4 +187,4 @@ cv::Mat CRNNRecognizer::GetRotateCropImage(const cv::Mat &srcimage,
}
}
}
}
}
// namespace PaddleOCR
}
// namespace PaddleOCR
\ No newline at end of file
deploy/cpp_infer/src/postprocess_op.cpp
View file @
16003260
...
@@ -57,8 +57,12 @@ cv::RotatedRect PostProcessor::UnClip(std::vector<std::vector<float>> box,
...
@@ -57,8 +57,12 @@ cv::RotatedRect PostProcessor::UnClip(std::vector<std::vector<float>> box,
points
.
emplace_back
(
soln
[
j
][
i
].
X
,
soln
[
j
][
i
].
Y
);
points
.
emplace_back
(
soln
[
j
][
i
].
X
,
soln
[
j
][
i
].
Y
);
}
}
}
}
cv
::
RotatedRect
res
=
cv
::
minAreaRect
(
points
);
cv
::
RotatedRect
res
;
if
(
points
.
size
()
<=
0
)
{
res
=
cv
::
RotatedRect
(
cv
::
Point2f
(
0
,
0
),
cv
::
Size2f
(
1
,
1
),
0
);
}
else
{
res
=
cv
::
minAreaRect
(
points
);
}
return
res
;
return
res
;
}
}
...
@@ -215,6 +219,9 @@ PostProcessor::BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap,
...
@@ -215,6 +219,9 @@ PostProcessor::BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap,
std
::
vector
<
std
::
vector
<
std
::
vector
<
int
>>>
boxes
;
std
::
vector
<
std
::
vector
<
std
::
vector
<
int
>>>
boxes
;
for
(
int
_i
=
0
;
_i
<
num_contours
;
_i
++
)
{
for
(
int
_i
=
0
;
_i
<
num_contours
;
_i
++
)
{
if
(
contours
[
_i
].
size
()
<=
0
)
{
continue
;
}
float
ssid
;
float
ssid
;
cv
::
RotatedRect
box
=
cv
::
minAreaRect
(
contours
[
_i
]);
cv
::
RotatedRect
box
=
cv
::
minAreaRect
(
contours
[
_i
]);
auto
array
=
GetMiniBoxes
(
box
,
ssid
);
auto
array
=
GetMiniBoxes
(
box
,
ssid
);
...
@@ -233,6 +240,9 @@ PostProcessor::BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap,
...
@@ -233,6 +240,9 @@ PostProcessor::BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap,
// start for unclip
// start for unclip
cv
::
RotatedRect
points
=
UnClip
(
box_for_unclip
,
det_db_unclip_ratio
);
cv
::
RotatedRect
points
=
UnClip
(
box_for_unclip
,
det_db_unclip_ratio
);
if
(
points
.
size
.
height
<
1.001
&&
points
.
size
.
width
<
1.001
)
{
continue
;
}
// end for unclip
// end for unclip
cv
::
RotatedRect
clipbox
=
points
;
cv
::
RotatedRect
clipbox
=
points
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment