Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DAN
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Automatic Text Recognition
DAN
Commits
a633050e
Commit
a633050e
authored
1 year ago
by
Manon Blanco
Committed by
Mélodie Boillet
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Always save model with the lowest "cer"
parent
cb58891e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!210
Always save model with the lowest "cer"
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
dan/manager/training.py
+2
-19
2 additions, 19 deletions
dan/manager/training.py
dan/ocr/document/train.py
+0
-2
0 additions, 2 deletions
dan/ocr/document/train.py
docs/usage/train/parameters.md
+0
-2
0 additions, 2 deletions
docs/usage/train/parameters.md
tests/conftest.py
+0
-2
0 additions, 2 deletions
tests/conftest.py
with
2 additions
and
25 deletions
dan/manager/training.py
+
2
−
19
View file @
a633050e
...
...
@@ -522,7 +522,6 @@ class GenericTrainingManager:
self
.
save_params
()
# init variables
self
.
begin_time
=
time
()
focus_metric_name
=
self
.
params
[
"
training_params
"
][
"
focus_metric
"
]
nb_epochs
=
self
.
params
[
"
training_params
"
][
"
max_nb_epochs
"
]
metric_names
=
self
.
params
[
"
training_params
"
][
"
train_metrics
"
]
...
...
@@ -642,25 +641,9 @@ class GenericTrainingManager:
)
if
valid_set_name
==
self
.
params
[
"
training_params
"
][
"
set_name_focus_metric
"
]
and
(
self
.
best
is
None
or
(
eval_values
[
focus_metric_name
]
<=
self
.
best
and
self
.
params
[
"
training_params
"
][
"
expected_metric_value
"
]
==
"
low
"
)
or
(
eval_values
[
focus_metric_name
]
>=
self
.
best
and
self
.
params
[
"
training_params
"
][
"
expected_metric_value
"
]
==
"
high
"
)
):
]
and
(
self
.
best
is
None
or
eval_values
[
"
cer
"
]
<=
self
.
best
):
self
.
save_model
(
epoch
=
num_epoch
,
name
=
"
best
"
)
self
.
best
=
eval_values
[
focus_metric_name
]
self
.
best
=
eval_values
[
"
cer
"
]
# Handle curriculum learning update
if
self
.
dataset
.
train_dataset
.
curriculum_config
:
...
...
This diff is collapsed.
Click to expand it.
dan/ocr/document/train.py
+
0
−
2
View file @
a633050e
...
...
@@ -181,8 +181,6 @@ def get_config():
"
lr_schedulers
"
:
None
,
# Learning rate schedulers
"
eval_on_valid
"
:
True
,
# Whether to eval and logs metrics on validation set during training or not
"
eval_on_valid_interval
"
:
5
,
# Interval (in epochs) to evaluate during training
"
focus_metric
"
:
"
cer
"
,
# Metrics to focus on to determine best epoch
"
expected_metric_value
"
:
"
low
"
,
# ["high", "low"] What is best for the focus metric value
"
set_name_focus_metric
"
:
"
{}-val
"
.
format
(
dataset_name
),
# Which dataset to focus on to select best weights
...
...
This diff is collapsed.
Click to expand it.
docs/usage/train/parameters.md
+
0
−
2
View file @
a633050e
...
...
@@ -159,8 +159,6 @@ For a detailed description of all augmentation transforms, see the [dedicated pa
|
`training_params.lr_schedulers`
| Learning rate schedulers. | custom class |
`None`
|
|
`training_params.eval_on_valid`
| Whether to evaluate and log metrics on the validation set during training. |
`bool`
|
`True`
|
|
`training_params.eval_on_valid_interval`
| Interval (in epochs) to evaluate during training. |
`int`
|
`5`
|
|
`training_params.focus_metric`
| Metrics to focus on to determine best epoch. |
`str`
|
`cer`
|
|
`training_params.expected_metric_value`
| Best value for the focus metric. Should be either
`"high"`
or
`"low"`
. |
`low`
|
`cer`
|
|
`training_params.set_name_focus_metric`
| Dataset to focus on to select best weights. |
`str`
| |
|
`training_params.train_metrics`
| List of metrics to compute during training. |
`list`
|
`["loss_ce", "cer", "wer", "wer_no_punct"]`
|
|
`training_params.eval_metrics`
| List of metrics to compute during validation. |
`list`
|
`["cer", "wer", "wer_no_punct"]`
|
...
...
This diff is collapsed.
Click to expand it.
tests/conftest.py
+
0
−
2
View file @
a633050e
...
...
@@ -125,8 +125,6 @@ def training_config():
"
lr_schedulers
"
:
None
,
# Learning rate schedulers
"
eval_on_valid
"
:
True
,
# Whether to eval and logs metrics on validation set during training or not
"
eval_on_valid_interval
"
:
2
,
# Interval (in epochs) to evaluate during training
"
focus_metric
"
:
"
cer
"
,
# Metrics to focus on to determine best epoch
"
expected_metric_value
"
:
"
low
"
,
# ["high", "low"] What is best for the focus metric value
"
set_name_focus_metric
"
:
"
training-val
"
,
# Which dataset to focus on to select best weights
"
train_metrics
"
:
[
"
loss_ce
"
,
...
...
This diff is collapsed.
Click to expand it.
Mélodie Boillet
@mboillet
mentioned in commit
95b168cf
·
1 year ago
mentioned in commit
95b168cf
mentioned in commit 95b168cfae8304943e0ceed39304f4592d6d8668
Toggle commit list
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment