Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
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
Commits
e8e21970
Commit
e8e21970
authored
Nov 11, 2018
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
samples: use findFile() in dnn
parent
c4c31f5b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
19 additions
and
15 deletions
+19
-15
colorization.cpp
samples/dnn/colorization.cpp
+3
-3
common.py
samples/dnn/common.py
+4
-0
edge_detection.py
samples/dnn/edge_detection.py
+1
-1
fast_neural_style.py
samples/dnn/fast_neural_style.py
+1
-1
mask_rcnn.py
samples/dnn/mask_rcnn.py
+2
-2
mobilenet_ssd_accuracy.py
samples/dnn/mobilenet_ssd_accuracy.py
+2
-2
object_detection.py
samples/dnn/object_detection.py
+2
-2
openpose.cpp
samples/dnn/openpose.cpp
+3
-3
openpose.py
samples/dnn/openpose.py
+1
-1
No files found.
samples/dnn/colorization.cpp
View file @
e8e21970
...
...
@@ -64,9 +64,9 @@ int main(int argc, char **argv)
parser
.
printMessage
();
return
0
;
}
string
modelTxt
=
parser
.
get
<
string
>
(
"proto"
);
string
modelBin
=
parser
.
get
<
string
>
(
"model"
);
string
imageFile
=
parser
.
get
<
string
>
(
"image"
);
string
modelTxt
=
samples
::
findFile
(
parser
.
get
<
string
>
(
"proto"
)
);
string
modelBin
=
samples
::
findFile
(
parser
.
get
<
string
>
(
"model"
)
);
string
imageFile
=
samples
::
findFile
(
parser
.
get
<
string
>
(
"image"
)
);
bool
useOpenCL
=
parser
.
has
(
"opencl"
);
if
(
!
parser
.
check
())
{
...
...
samples/dnn/common.py
View file @
e8e21970
...
...
@@ -86,6 +86,10 @@ def findFile(filename):
if
os
.
path
.
exists
(
filename
):
return
filename
fpath
=
cv
.
samples
.
findFile
(
filename
,
False
)
if
fpath
:
return
fpath
samplesDataDir
=
os
.
path
.
join
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'..'
,
'data'
,
...
...
samples/dnn/edge_detection.py
View file @
e8e21970
...
...
@@ -43,7 +43,7 @@ cv.dnn_registerLayer('Crop', CropLayer)
#! [Register]
# Load the model.
net
=
cv
.
dnn
.
readNet
(
args
.
prototxt
,
args
.
caffemodel
)
net
=
cv
.
dnn
.
readNet
(
cv
.
samples
.
findFile
(
args
.
prototxt
),
cv
.
samples
.
findFile
(
args
.
caffemodel
)
)
kWinName
=
'Holistically-Nested Edge Detection'
cv
.
namedWindow
(
'Input'
,
cv
.
WINDOW_NORMAL
)
...
...
samples/dnn/fast_neural_style.py
View file @
e8e21970
...
...
@@ -13,7 +13,7 @@ parser.add_argument('--height', default=-1, type=int, help='Resize input to spec
parser
.
add_argument
(
'--median_filter'
,
default
=
0
,
type
=
int
,
help
=
'Kernel size of postprocessing blurring.'
)
args
=
parser
.
parse_args
()
net
=
cv
.
dnn
.
readNetFromTorch
(
args
.
model
)
net
=
cv
.
dnn
.
readNetFromTorch
(
cv
.
samples
.
findFile
(
args
.
model
)
)
net
.
setPreferableBackend
(
cv
.
dnn
.
DNN_BACKEND_OPENCV
);
if
args
.
input
:
...
...
samples/dnn/mask_rcnn.py
View file @
e8e21970
...
...
@@ -68,13 +68,13 @@ def drawBox(frame, classId, conf, left, top, right, bottom):
# Load a network
net
=
cv
.
dnn
.
readNet
(
args
.
model
,
args
.
config
)
net
=
cv
.
dnn
.
readNet
(
cv
.
samples
.
findFile
(
args
.
model
),
cv
.
samples
.
findFile
(
args
.
config
)
)
net
.
setPreferableBackend
(
cv
.
dnn
.
DNN_BACKEND_OPENCV
)
winName
=
'Mask-RCNN in OpenCV'
cv
.
namedWindow
(
winName
,
cv
.
WINDOW_NORMAL
)
cap
=
cv
.
VideoCapture
(
args
.
input
if
args
.
input
else
0
)
cap
=
cv
.
VideoCapture
(
cv
.
samples
.
findFileOrKeep
(
args
.
input
)
if
args
.
input
else
0
)
legend
=
None
while
cv
.
waitKey
(
1
)
<
0
:
hasFrame
,
frame
=
cap
.
read
()
...
...
samples/dnn/mobilenet_ssd_accuracy.py
View file @
e8e21970
...
...
@@ -26,12 +26,12 @@ parser.add_argument('--annotations', help='Path to COCO annotations file.', requ
args
=
parser
.
parse_args
()
### Get OpenCV predictions #####################################################
net
=
cv
.
dnn
.
readNetFromTensorflow
(
args
.
weights
,
args
.
prototxt
)
net
=
cv
.
dnn
.
readNetFromTensorflow
(
cv
.
samples
.
findFile
(
args
.
weights
),
cv
.
samples
.
findFile
(
args
.
prototxt
)
)
net
.
setPreferableBackend
(
cv
.
dnn
.
DNN_BACKEND_OPENCV
);
detections
=
[]
for
imgName
in
os
.
listdir
(
args
.
images
):
inp
=
cv
.
imread
(
os
.
path
.
join
(
args
.
images
,
imgName
))
inp
=
cv
.
imread
(
cv
.
samples
.
findFile
(
os
.
path
.
join
(
args
.
images
,
imgName
)
))
rows
=
inp
.
shape
[
0
]
cols
=
inp
.
shape
[
1
]
inp
=
cv
.
resize
(
inp
,
(
300
,
300
))
...
...
samples/dnn/object_detection.py
View file @
e8e21970
...
...
@@ -67,7 +67,7 @@ if args.classes:
classes
=
f
.
read
()
.
rstrip
(
'
\n
'
)
.
split
(
'
\n
'
)
# Load a network
net
=
cv
.
dnn
.
readNet
(
args
.
model
,
args
.
config
,
args
.
framework
)
net
=
cv
.
dnn
.
readNet
(
cv
.
samples
.
findFile
(
args
.
model
),
cv
.
samples
.
findFile
(
args
.
config
)
,
args
.
framework
)
net
.
setPreferableBackend
(
args
.
backend
)
net
.
setPreferableTarget
(
args
.
target
)
outNames
=
net
.
getUnconnectedOutLayersNames
()
...
...
@@ -182,7 +182,7 @@ def callback(pos):
cv
.
createTrackbar
(
'Confidence threshold,
%
'
,
winName
,
int
(
confThreshold
*
100
),
99
,
callback
)
cap
=
cv
.
VideoCapture
(
args
.
input
if
args
.
input
else
0
)
cap
=
cv
.
VideoCapture
(
cv
.
samples
.
findFileOrKeep
(
args
.
input
)
if
args
.
input
else
0
)
while
cv
.
waitKey
(
1
)
<
0
:
hasFrame
,
frame
=
cap
.
read
()
if
not
hasFrame
:
...
...
samples/dnn/openpose.cpp
View file @
e8e21970
...
...
@@ -66,9 +66,9 @@ int main(int argc, char **argv)
"{ t threshold | 0.1 | threshold or confidence value for the heatmap }"
);
String
modelTxt
=
parser
.
get
<
string
>
(
"proto"
);
String
modelBin
=
parser
.
get
<
string
>
(
"model"
);
String
imageFile
=
parser
.
get
<
String
>
(
"image"
);
String
modelTxt
=
samples
::
findFile
(
parser
.
get
<
string
>
(
"proto"
)
);
String
modelBin
=
samples
::
findFile
(
parser
.
get
<
string
>
(
"model"
)
);
String
imageFile
=
samples
::
findFile
(
parser
.
get
<
String
>
(
"image"
)
);
int
W_in
=
parser
.
get
<
int
>
(
"width"
);
int
H_in
=
parser
.
get
<
int
>
(
"height"
);
float
thresh
=
parser
.
get
<
float
>
(
"threshold"
);
...
...
samples/dnn/openpose.py
View file @
e8e21970
...
...
@@ -45,7 +45,7 @@ else:
inWidth
=
args
.
width
inHeight
=
args
.
height
net
=
cv
.
dnn
.
readNetFromCaffe
(
args
.
proto
,
args
.
model
)
net
=
cv
.
dnn
.
readNetFromCaffe
(
cv
.
samples
.
findFile
(
args
.
proto
),
cv
.
samples
.
findFile
(
args
.
model
)
)
cap
=
cv
.
VideoCapture
(
args
.
input
if
args
.
input
else
0
)
...
...
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