Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bob
bob.learn.tensorflow
Commits
9deb39b8
Commit
9deb39b8
authored
Oct 05, 2017
by
Tiago de Freitas Pereira
Browse files
[sphinx] Documented some classes [skip ci]
parent
0c5be077
Pipeline
#13009
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bob/learn/tensorflow/loss/BaseLoss.py
View file @
9deb39b8
...
...
@@ -13,8 +13,7 @@ slim = tf.contrib.slim
class
BaseLoss
(
object
):
"""
Base loss function.
One exam
Stupid class. Don't know why I did that.
"""
def
__init__
(
self
,
loss
,
operation
,
name
=
"loss"
):
...
...
@@ -28,20 +27,17 @@ class BaseLoss(object):
class
MeanSoftMaxLoss
(
object
):
"""
Mean softmax loss. Basically it wrapps the function tf.nn.sparse_softmax_cross_entropy_with_logits.
Simple CrossEntropy loss.
Basically it wrapps the function tf.nn.sparse_softmax_cross_entropy_with_logits.
**Parameters**
name: Scope name
add_regularization_losses: Regulize the loss???
"""
def
__init__
(
self
,
name
=
"loss"
,
add_regularization_losses
=
True
):
"""
Constructor
**Parameters**
name:
Scope name
"""
self
.
name
=
name
self
.
add_regularization_losses
=
add_regularization_losses
...
...
@@ -58,20 +54,17 @@ class MeanSoftMaxLoss(object):
class
MeanSoftMaxLossCenterLoss
(
object
):
"""
Mean softmax loss. Basically it wrapps the function tf.nn.sparse_softmax_cross_entropy_with_logits.
"""
Implementation of the CrossEntropy + Center Loss from the paper
"A Discriminative Feature Learning Approach for Deep Face Recognition"(http://ydwen.github.io/papers/WenECCV16.pdf)
**Parameters**
name: Scope name
alpha: Alpha factor ((1-alpha)*centers-prelogits)
factor: Weight factor of the center loss
n_classes: Number of classes of your task
"""
def
__init__
(
self
,
name
=
"loss"
,
alpha
=
0.9
,
factor
=
0.01
,
n_classes
=
10
):
"""
Constructor
**Parameters**
name:
Scope name
"""
self
.
name
=
name
self
.
n_classes
=
n_classes
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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