Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Zahra Rajabi
py-faster-rcnn
Commits
c70cf0dd
Commit
c70cf0dd
authored
Apr 28, 2015
by
Ross Girshick
Browse files
minor edits
parent
62f2c46e
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/fast_rcnn/test.py
View file @
c70cf0dd
...
...
@@ -13,7 +13,7 @@ from utils.timer import Timer
import
numpy
as
np
import
cv2
import
caffe
import
utils.cython_nms
from
utils.cython_nms
import
nms
import
cPickle
import
heapq
from
utils.blob
import
im_list_to_blob
...
...
@@ -207,7 +207,7 @@ def im_detect(net, im, boxes):
return
scores
,
pred_boxes
def
_
vis_detections
(
im
,
class_name
,
dets
,
thresh
=
0.3
):
def
vis_detections
(
im
,
class_name
,
dets
,
thresh
=
0.3
):
"""Visual debugging of detections."""
import
matplotlib.pyplot
as
plt
im
=
im
[:,
:,
(
2
,
1
,
0
)]
...
...
@@ -224,7 +224,7 @@ def _vis_detections(im, class_name, dets, thresh=0.3):
edgecolor
=
'g'
,
linewidth
=
3
)
)
plt
.
title
(
'{} {:.3f}'
.
format
(
class_name
,
score
))
plt
.
pause
(
1
)
plt
.
show
(
)
def
apply_nms
(
all_boxes
,
thresh
):
"""Apply non-maximum suppression to all predicted boxes output by the
...
...
@@ -239,7 +239,7 @@ def apply_nms(all_boxes, thresh):
dets
=
all_boxes
[
cls_ind
][
im_ind
]
if
dets
==
[]:
continue
keep
=
utils
.
cython_nms
.
nms
(
dets
,
thresh
)
keep
=
nms
(
dets
,
thresh
)
if
len
(
keep
)
==
0
:
continue
nms_boxes
[
cls_ind
][
im_ind
]
=
dets
[
keep
,
:].
copy
()
...
...
@@ -303,8 +303,8 @@ def test_net(net, imdb):
.
astype
(
np
.
float32
,
copy
=
False
)
if
0
:
keep
=
utils
.
cython_nms
.
nms
(
all_boxes
[
j
][
i
],
0.3
)
_
vis_detections
(
im
,
imdb
.
classes
[
j
],
all_boxes
[
j
][
i
][
keep
,
:])
keep
=
nms
(
all_boxes
[
j
][
i
],
0.3
)
vis_detections
(
im
,
imdb
.
classes
[
j
],
all_boxes
[
j
][
i
][
keep
,
:])
_t
[
'misc'
].
toc
()
print
'im_detect: {:d}/{:d} {:.3f}s {:.3f}s'
\
...
...
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