Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv_contrib
Commits
2b788904
Commit
2b788904
authored
Jul 11, 2016
by
Anguelos Nicolaou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attenpt to supress visual studio and IOS warnings
parent
53a86776
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
15 deletions
+14
-15
FindProtobuf.cmake
modules/text/FindProtobuf.cmake
+1
-1
dictnet_demo.py
modules/text/samples/dictnet_demo.py
+1
-1
ocr_holistic.cpp
modules/text/src/ocr_holistic.cpp
+12
-13
No files found.
modules/text/FindProtobuf.cmake
View file @
2b788904
#
Protobuf package required for Caffe
#
Protobuf package required for Caffe
unset
(
Protobuf_FOUND
)
find_library
(
Protobuf_LIBS NAMES protobuf
...
...
modules/text/samples/dictnet_demo.py
View file @
2b788904
...
...
@@ -42,7 +42,7 @@ def mouseCallback(event, x, y, flags, param):
if
__name__
==
'__main__'
:
USEGPU
=
False
helpStr
=
"""
Usage: """
+
sys
.
argv
[
0
]
+
""" IMAGE_FILENAME
helpStr
=
"""Usage: """
+
sys
.
argv
[
0
]
+
""" IMAGE_FILENAME
Press 'q' or 'Q' exit
...
...
modules/text/src/ocr_holistic.cpp
View file @
2b788904
...
...
@@ -67,7 +67,7 @@ protected:
net_
->
Reshape
();
float
*
inputBuffer
=
net_
->
input_blobs
()[
0
]
->
mutable_cpu_data
();
float
*
inputData
=
inputBuffer
;
for
(
in
t
imgNum
=
0
;
imgNum
<
inputImageList
.
size
();
imgNum
++
){
for
(
size_
t
imgNum
=
0
;
imgNum
<
inputImageList
.
size
();
imgNum
++
){
Mat
preprocessed
;
cv
::
Mat
netInputWraped
(
this
->
inputGeometry_
.
height
,
this
->
inputGeometry_
.
width
,
CV_32FC1
,
inputData
);
this
->
preprocess
(
inputImageList
[
imgNum
],
preprocessed
);
...
...
@@ -87,11 +87,16 @@ protected:
Size
inputGeometry_
;
const
int
minibatchSz_
;
const
bool
gpuBackend_
;
Ptr
<
Mat
>
meanImage_
;
bool
standarize_
;
std
::
vector
<
std
::
string
>
labels_
;
int
outputSize_
;
public
:
DictNetCaffeImpl
(
const
DictNetCaffeImpl
&
dn
)
:
inputGeometry_
(
dn
.
inputGeometry_
),
minibatchSz_
(
dn
.
minibatchSz_
),
gpuBackend_
(
dn
.
gpuBackend_
),
outputSize_
(
dn
.
outputSize_
){
//Implemented to supress Visual Studio warning
#ifdef HAVE_CAFFE
this
->
net_
=
dn
.
net_
;
#endif
}
DictNetCaffeImpl
(
String
modelArchFilename
,
String
modelWeightsFilename
,
int
maxMinibatchSz
,
bool
useGpu
)
:
minibatchSz_
(
maxMinibatchSz
),
gpuBackend_
(
useGpu
){
CV_Assert
(
this
->
minibatchSz_
>
0
);
...
...
@@ -128,9 +133,9 @@ public:
void
classifyBatch
(
InputArrayOfArrays
inputImageList
,
OutputArray
classProbabilities
){
std
::
vector
<
Mat
>
allImageVector
;
inputImageList
.
getMatVector
(
allImageVector
);
classProbabilities
.
create
(
Size
(
this
->
outputSize_
,
allImageVector
.
size
()),
CV_32F
);
classProbabilities
.
create
(
Size
(
unsigned
int
(
this
->
outputSize_
)
,
allImageVector
.
size
()),
CV_32F
);
Mat
outputMat
=
classProbabilities
.
getMat
();
for
(
int
imgNum
=
0
;
imgNum
<
int
(
allImageVector
.
size
()
);
imgNum
+=
this
->
minibatchSz_
){
for
(
size_t
imgNum
=
0
;
imgNum
<
allImageVector
.
size
(
);
imgNum
+=
this
->
minibatchSz_
){
int
rangeEnd
=
imgNum
+
std
::
min
<
int
>
(
allImageVector
.
size
()
-
imgNum
,
this
->
minibatchSz_
);
std
::
vector
<
Mat
>::
const_iterator
from
=
allImageVector
.
begin
()
+
imgNum
;
std
::
vector
<
Mat
>::
const_iterator
to
=
allImageVector
.
begin
()
+
rangeEnd
;
...
...
@@ -250,7 +255,7 @@ public:
}
if
(
component_confidences
!=
NULL
){
component_confidences
->
resize
(
1
);
(
*
component_confidences
)[
0
]
=
confidence
;
(
*
component_confidences
)[
0
]
=
float
(
confidence
)
;
}
}
void
run
(
Mat
&
image
,
Mat
&
mask
,
std
::
string
&
output_text
,
std
::
vector
<
Rect
>*
component_rects
=
NULL
,
...
...
@@ -261,13 +266,7 @@ public:
}
std
::
vector
<
String
>&
getVocabulary
(){
return
this
->
labels_
;
}
/*
void getVocabulary(CV_OUT const std::vector<String>& voc){
voc.reshape(this->labels_.size());
for(int k =0;k<voc.size();k++){
voc[k]=this->labels_[k];
}
}*/
};
Ptr
<
OCRHolisticWordRecognizer
>
OCRHolisticWordRecognizer
::
create
(
Ptr
<
TextImageClassifier
>
classifierPtr
,
String
vocabullaryFilename
){
...
...
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