Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
2d7e320a
Commit
2d7e320a
authored
Apr 26, 2014
by
Davis King
Browse files
Added user settable loss to the structural_track_association_trainer.
parent
d6c10818
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
+89
-0
dlib/svm/structural_track_association_trainer.h
dlib/svm/structural_track_association_trainer.h
+48
-0
dlib/svm/structural_track_association_trainer_abstract.h
dlib/svm/structural_track_association_trainer_abstract.h
+41
-0
No files found.
dlib/svm/structural_track_association_trainer.h
View file @
2d7e320a
...
@@ -91,6 +91,48 @@ namespace dlib
...
@@ -91,6 +91,48 @@ namespace dlib
return
max_cache_size
;
return
max_cache_size
;
}
}
void
set_loss_per_false_association
(
double
loss
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
loss
>
0
,
"
\t
void structural_track_association_trainer::set_loss_per_false_association(loss)"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
loss: "
<<
loss
<<
"
\n\t
this: "
<<
this
);
loss_per_false_association
=
loss
;
}
double
get_loss_per_false_association
(
)
const
{
return
loss_per_false_association
;
}
void
set_loss_per_track_break
(
double
loss
)
{
// make sure requires clause is not broken
DLIB_ASSERT
(
loss
>
0
,
"
\t
void structural_track_association_trainer::set_loss_per_track_break(loss)"
<<
"
\n\t
Invalid inputs were given to this function "
<<
"
\n\t
loss: "
<<
loss
<<
"
\n\t
this: "
<<
this
);
loss_per_track_break
=
loss
;
}
double
get_loss_per_track_break
(
)
const
{
return
loss_per_track_break
;
}
void
be_verbose
(
void
be_verbose
(
)
)
{
{
...
@@ -178,6 +220,8 @@ namespace dlib
...
@@ -178,6 +220,8 @@ namespace dlib
trainer
.
set_max_cache_size
(
max_cache_size
);
trainer
.
set_max_cache_size
(
max_cache_size
);
trainer
.
set_num_threads
(
num_threads
);
trainer
.
set_num_threads
(
num_threads
);
trainer
.
set_oca
(
solver
);
trainer
.
set_oca
(
solver
);
trainer
.
set_loss_per_missed_association
(
loss_per_track_break
);
trainer
.
set_loss_per_false_association
(
loss_per_false_association
);
std
::
vector
<
std
::
pair
<
std
::
vector
<
detection_type
>
,
std
::
vector
<
track_type
>
>
>
assignment_samples
;
std
::
vector
<
std
::
pair
<
std
::
vector
<
detection_type
>
,
std
::
vector
<
track_type
>
>
>
assignment_samples
;
std
::
vector
<
std
::
vector
<
long
>
>
labels
;
std
::
vector
<
std
::
vector
<
long
>
>
labels
;
...
@@ -338,6 +382,8 @@ namespace dlib
...
@@ -338,6 +382,8 @@ namespace dlib
unsigned
long
num_threads
;
unsigned
long
num_threads
;
unsigned
long
max_cache_size
;
unsigned
long
max_cache_size
;
bool
learn_nonnegative_weights
;
bool
learn_nonnegative_weights
;
double
loss_per_track_break
;
double
loss_per_false_association
;
void
set_defaults
()
void
set_defaults
()
{
{
...
@@ -347,6 +393,8 @@ namespace dlib
...
@@ -347,6 +393,8 @@ namespace dlib
num_threads
=
2
;
num_threads
=
2
;
max_cache_size
=
5
;
max_cache_size
=
5
;
learn_nonnegative_weights
=
false
;
learn_nonnegative_weights
=
false
;
loss_per_track_break
=
1
;
loss_per_false_association
=
1
;
}
}
};
};
...
...
dlib/svm/structural_track_association_trainer_abstract.h
View file @
2d7e320a
...
@@ -39,6 +39,8 @@ namespace dlib
...
@@ -39,6 +39,8 @@ namespace dlib
- #get_num_threads() == 2
- #get_num_threads() == 2
- #get_max_cache_size() == 5
- #get_max_cache_size() == 5
- #learns_nonnegative_weights() == false
- #learns_nonnegative_weights() == false
- #get_loss_per_track_break() == 1
- #get_loss_per_false_association() == 1
!*/
!*/
void
set_num_threads
(
void
set_num_threads
(
...
@@ -113,6 +115,45 @@ namespace dlib
...
@@ -113,6 +115,45 @@ namespace dlib
- this object will not print anything to standard out
- this object will not print anything to standard out
!*/
!*/
void
set_loss_per_false_association
(
double
loss
);
/*!
requires
- loss > 0
ensures
- #get_loss_per_false_association() == loss
!*/
double
get_loss_per_false_association
(
)
const
;
/*!
ensures
- returns the amount of loss experienced for assigning a detection to the
wrong track. If you care more about avoiding false associations than
avoiding track breaks then you can increase this value.
!*/
void
set_loss_per_track_break
(
double
loss
);
/*!
requires
- loss > 0
ensures
- #get_loss_per_track_break() == loss
!*/
double
get_loss_per_track_break
(
)
const
;
/*!
ensures
- returns the amount of loss experienced for incorrectly assigning a
detection to a new track instead of assigning it to its existing track.
If you care more about avoiding track breaks than avoiding things like
track swaps then you can increase this value.
!*/
void
set_oca
(
void
set_oca
(
const
oca
&
item
const
oca
&
item
);
);
...
...
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