Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
seminar-breakout
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Shashank Suhas
seminar-breakout
Commits
d2c5cc16
Commit
d2c5cc16
authored
Jul 13, 2018
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a better timer when available.
parent
7877a7f7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
16 deletions
+25
-16
README.md
README.md
+1
-1
examples/FasterRCNN/README.md
examples/FasterRCNN/README.md
+3
-2
examples/FasterRCNN/model_fpn.py
examples/FasterRCNN/model_fpn.py
+2
-2
tensorpack/callbacks/group.py
tensorpack/callbacks/group.py
+7
-3
tensorpack/train/interface.py
tensorpack/train/interface.py
+1
-1
tensorpack/utils/timer.py
tensorpack/utils/timer.py
+11
-7
No files found.
README.md
View file @
d2c5cc16
...
@@ -62,7 +62,7 @@ demonstrating its flexibility for actual research.
...
@@ -62,7 +62,7 @@ demonstrating its flexibility for actual research.
Dependencies:
Dependencies:
+
Python 2.7 or 3
+
Python 2.7 or 3
.3+
+
Python bindings for OpenCV (Optional, but required by a lot of features)
+
Python bindings for OpenCV (Optional, but required by a lot of features)
+
TensorFlow >= 1.3.0 (Optional if you only want to use
`tensorpack.dataflow`
alone as a data processing library)
+
TensorFlow >= 1.3.0 (Optional if you only want to use
`tensorpack.dataflow`
alone as a data processing library)
```
```
...
...
examples/FasterRCNN/README.md
View file @
d2c5cc16
...
@@ -80,7 +80,8 @@ MaskRCNN results contain both box and mask mAP.
...
@@ -80,7 +80,8 @@ MaskRCNN results contain both box and mask mAP.
<a
id=
"ft2"
>
2
</a>
: Numbers taken from
[
Group Normalization
](
https://arxiv.org/abs/1803.08494
)
<a
id=
"ft2"
>
2
</a>
: Numbers taken from
[
Group Normalization
](
https://arxiv.org/abs/1803.08494
)
Performance in
[
Detectron
](
https://github.com/facebookresearch/Detectron/
)
can be reproduced.
Performance in
[
Detectron
](
https://github.com/facebookresearch/Detectron/
)
can
be roughly reproduced, some are better but some are worse, probably due to many tiny implementation details.
Note that most of these numbers are better than what's in the paper.
Note that most of these numbers are better than what's in the paper.
## Notes
## Notes
...
...
examples/FasterRCNN/model_fpn.py
View file @
d2c5cc16
...
@@ -218,5 +218,5 @@ def generate_fpn_proposals(
...
@@ -218,5 +218,5 @@ def generate_fpn_proposals(
cfg
.
RPN
.
TRAIN_POST_NMS_TOPK
if
ctx
.
is_training
else
cfg
.
RPN
.
TEST_POST_NMS_TOPK
)
cfg
.
RPN
.
TRAIN_POST_NMS_TOPK
if
ctx
.
is_training
else
cfg
.
RPN
.
TEST_POST_NMS_TOPK
)
tf
.
sigmoid
(
proposal_scores
,
name
=
'probs'
)
# for visualization
tf
.
sigmoid
(
proposal_scores
,
name
=
'probs'
)
# for visualization
return
tf
.
identity
(
proposal_boxes
,
name
=
'boxes'
),
\
return
tf
.
stop_gradient
(
proposal_boxes
,
name
=
'boxes'
),
\
tf
.
identity
(
proposal_scores
,
name
=
'scores'
)
tf
.
stop_gradient
(
proposal_scores
,
name
=
'scores'
)
tensorpack/callbacks/group.py
View file @
d2c5cc16
...
@@ -4,14 +4,18 @@
...
@@ -4,14 +4,18 @@
import
tensorflow
as
tf
import
tensorflow
as
tf
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
import
time
from
time
import
time
as
timer
import
traceback
import
traceback
import
six
from
.base
import
Callback
from
.base
import
Callback
from
.hooks
import
CallbackToHook
from
.hooks
import
CallbackToHook
from
..utils
import
logger
from
..utils
import
logger
from
..utils.utils
import
humanize_time_delta
from
..utils.utils
import
humanize_time_delta
if
six
.
PY3
:
from
time
import
perf_counter
as
timer
# noqa
__all__
=
[
'Callbacks'
]
__all__
=
[
'Callbacks'
]
...
@@ -26,9 +30,9 @@ class CallbackTimeLogger(object):
...
@@ -26,9 +30,9 @@ class CallbackTimeLogger(object):
@
contextmanager
@
contextmanager
def
timed_callback
(
self
,
name
):
def
timed_callback
(
self
,
name
):
s
=
time
.
time
()
s
=
time
r
()
yield
yield
self
.
add
(
name
,
time
.
time
()
-
s
)
self
.
add
(
name
,
time
r
()
-
s
)
def
log
(
self
):
def
log
(
self
):
...
...
tensorpack/train/interface.py
View file @
d2c5cc16
...
@@ -52,7 +52,7 @@ def launch_train_with_config(config, trainer):
...
@@ -52,7 +52,7 @@ def launch_train_with_config(config, trainer):
present a simple training interface. It basically does the following
present a simple training interface. It basically does the following
3 things (and you can easily do them by yourself if you need more control):
3 things (and you can easily do them by yourself if you need more control):
1. Setup the input with automatic prefetching,
1. Setup the input with automatic prefetching
heuristics
,
from `config.data` or `config.dataflow`.
from `config.data` or `config.dataflow`.
2. Call `trainer.setup_graph` with the input as well as `config.model`.
2. Call `trainer.setup_graph` with the input as well as `config.model`.
3. Call `trainer.train` with rest of the attributes of config.
3. Call `trainer.train` with rest of the attributes of config.
...
...
tensorpack/utils/timer.py
View file @
d2c5cc16
...
@@ -3,14 +3,18 @@
...
@@ -3,14 +3,18 @@
from
contextlib
import
contextmanager
from
contextlib
import
contextmanager
import
time
from
collections
import
defaultdict
from
collections
import
defaultdict
import
six
import
six
import
atexit
import
atexit
from
time
import
time
as
timer
from
.stats
import
StatCounter
from
.stats
import
StatCounter
from
.
import
logger
from
.
import
logger
if
six
.
PY3
:
from
time
import
perf_counter
as
timer
# noqa
__all__
=
[
'total_timer'
,
'timed_operation'
,
__all__
=
[
'total_timer'
,
'timed_operation'
,
'print_total_timer'
,
'IterSpeedCounter'
]
'print_total_timer'
,
'IterSpeedCounter'
]
...
@@ -38,10 +42,10 @@ def timed_operation(msg, log_start=False):
...
@@ -38,10 +42,10 @@ def timed_operation(msg, log_start=False):
"""
"""
if
log_start
:
if
log_start
:
logger
.
info
(
'Start {} ...'
.
format
(
msg
))
logger
.
info
(
'Start {} ...'
.
format
(
msg
))
start
=
time
.
time
()
start
=
time
r
()
yield
yield
logger
.
info
(
'{} finished, time:{:.4f}sec.'
.
format
(
logger
.
info
(
'{} finished, time:{:.4f}sec.'
.
format
(
msg
,
time
.
time
()
-
start
))
msg
,
time
r
()
-
start
))
_TOTAL_TIMER_DATA
=
defaultdict
(
StatCounter
)
_TOTAL_TIMER_DATA
=
defaultdict
(
StatCounter
)
...
@@ -50,9 +54,9 @@ _TOTAL_TIMER_DATA = defaultdict(StatCounter)
...
@@ -50,9 +54,9 @@ _TOTAL_TIMER_DATA = defaultdict(StatCounter)
@
contextmanager
@
contextmanager
def
total_timer
(
msg
):
def
total_timer
(
msg
):
""" A context which add the time spent inside to TotalTimer. """
""" A context which add the time spent inside to TotalTimer. """
start
=
time
.
time
()
start
=
time
r
()
yield
yield
t
=
time
.
time
()
-
start
t
=
time
r
()
-
start
_TOTAL_TIMER_DATA
[
msg
]
.
feed
(
t
)
_TOTAL_TIMER_DATA
[
msg
]
.
feed
(
t
)
...
@@ -96,7 +100,7 @@ class IterSpeedCounter(object):
...
@@ -96,7 +100,7 @@ class IterSpeedCounter(object):
self
.
name
=
name
if
name
else
'IterSpeed'
self
.
name
=
name
if
name
else
'IterSpeed'
def
reset
(
self
):
def
reset
(
self
):
self
.
start
=
time
.
time
()
self
.
start
=
time
r
()
def
__call__
(
self
):
def
__call__
(
self
):
if
self
.
cnt
==
0
:
if
self
.
cnt
==
0
:
...
@@ -104,6 +108,6 @@ class IterSpeedCounter(object):
...
@@ -104,6 +108,6 @@ class IterSpeedCounter(object):
self
.
cnt
+=
1
self
.
cnt
+=
1
if
self
.
cnt
%
self
.
print_every
!=
0
:
if
self
.
cnt
%
self
.
print_every
!=
0
:
return
return
t
=
time
.
time
()
-
self
.
start
t
=
time
r
()
-
self
.
start
logger
.
info
(
"{}: {:.2f} sec, {} times, {:.3g} sec/time"
.
format
(
logger
.
info
(
"{}: {:.2f} sec, {} times, {:.3g} sec/time"
.
format
(
self
.
name
,
t
,
self
.
cnt
,
t
/
self
.
cnt
))
self
.
name
,
t
,
self
.
cnt
,
t
/
self
.
cnt
))
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