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
d3802e79
Commit
d3802e79
authored
Feb 26, 2017
by
Yuxin Wu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some internal rename
parent
01f54c26
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
tensorpack/callbacks/inference.py
tensorpack/callbacks/inference.py
+9
-10
tensorpack/callbacks/inference_runner.py
tensorpack/callbacks/inference_runner.py
+2
-0
No files found.
tensorpack/callbacks/inference.py
View file @
d3802e79
...
...
@@ -46,8 +46,7 @@ class Inferencer(object):
def
after_inference
(
self
):
"""
Called after a round of inference ends.
Returns a dict of statistics which will be logged by the :class:`InferenceRunner`.
The inferencer needs to handle other type of logging by itself, if there is any.
Returns a dict of scalar statistics which will be logged to monitors.
"""
return
self
.
_after_inference
()
...
...
@@ -72,17 +71,17 @@ class ScalarStats(Inferencer):
The value will be averaged over all given datapoints.
"""
def
__init__
(
self
,
names
_to_print
,
prefix
=
'validation'
):
def
__init__
(
self
,
names
,
prefix
=
'validation'
):
"""
Args:
names
_to_print
(list or str): list of names or just one name. The
names(list or str): list of names or just one name. The
corresponding tensors have to be scalar.
prefix(str): a prefix for logging
"""
if
not
isinstance
(
names
_to_print
,
list
):
self
.
names
=
[
names
_to_print
]
if
not
isinstance
(
names
,
list
):
self
.
names
=
[
names
]
else
:
self
.
names
=
names
_to_print
self
.
names
=
names
self
.
prefix
=
prefix
def
_get_output_tensors
(
self
):
...
...
@@ -128,7 +127,7 @@ class ClassificationError(Inferencer):
wrong_tensor_name(str): name of the ``wrong`` tensor.
The default is the same as the default output name of
:meth:`prediction_incorrect`.
summary_name(str): the name
for logging
.
summary_name(str): the name
to log the error with
.
"""
self
.
wrong_tensor_name
=
wrong_tensor_name
self
.
summary_name
=
summary_name
...
...
@@ -161,7 +160,7 @@ class BinaryClassificationStats(Inferencer):
prediction vector and the label vector.
"""
def
__init__
(
self
,
pred_tensor_name
,
label_tensor_name
,
summary_
prefix
=
'val'
):
def
__init__
(
self
,
pred_tensor_name
,
label_tensor_name
,
prefix
=
'val'
):
"""
Args:
pred_tensor_name(str): name of the 0/1 prediction tensor.
...
...
@@ -169,7 +168,7 @@ class BinaryClassificationStats(Inferencer):
"""
self
.
pred_tensor_name
=
pred_tensor_name
self
.
label_tensor_name
=
label_tensor_name
self
.
prefix
=
summary_
prefix
self
.
prefix
=
prefix
def
_get_output_tensors
(
self
):
return
[
self
.
pred_tensor_name
,
self
.
label_tensor_name
]
...
...
tensorpack/callbacks/inference_runner.py
View file @
d3802e79
...
...
@@ -57,6 +57,8 @@ class OutputTensorDispatcher(object):
def
summary_inferencer
(
trainer
,
infs
):
for
inf
in
infs
:
ret
=
inf
.
after_inference
()
if
ret
is
None
:
continue
for
k
,
v
in
six
.
iteritems
(
ret
):
try
:
v
=
float
(
v
)
...
...
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