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
Compare revisions
9dfc3d59abf3f4e7e733826f3a71d63e13b8fee4 to df6bda94f0e35d9875091b88e76b96f64e23c318
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
atr/dan
Select target project
No results found
df6bda94f0e35d9875091b88e76b96f64e23c318
Select Git revision
Swap
Target
atr/dan
Select target project
atr/dan
1 result
9dfc3d59abf3f4e7e733826f3a71d63e13b8fee4
Select Git revision
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (4)
Remove unused hardware, software and date
· 9168b38e
Yoann Schneider
authored
1 year ago
and
Solene Tarride
committed
1 year ago
9168b38e
Do not log any artifacts if mlflow logging is disabled
· d5cfdda5
Yoann Schneider
authored
1 year ago
d5cfdda5
Remove teacher_forcing_error_rate
· 4d63e074
Nolan
authored
1 year ago
and
Yoann Schneider
committed
1 year ago
4d63e074
Remove edit_and_num_items_for_ged_from_str_simara function
· df6bda94
Nolan
authored
1 year ago
and
Yoann Schneider
committed
1 year ago
df6bda94
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dan/manager/metrics.py
+0
-14
0 additions, 14 deletions
dan/manager/metrics.py
dan/manager/training.py
+4
-28
4 additions, 28 deletions
dan/manager/training.py
with
4 additions
and
42 deletions
dan/manager/metrics.py
View file @
df6bda94
...
@@ -16,7 +16,6 @@ class MetricManager:
...
@@ -16,7 +16,6 @@ class MetricManager:
if
"
simara
"
in
dataset_name
and
"
page
"
in
dataset_name
:
if
"
simara
"
in
dataset_name
and
"
page
"
in
dataset_name
:
self
.
post_processing_module
=
PostProcessingModuleSIMARA
self
.
post_processing_module
=
PostProcessingModuleSIMARA
self
.
matching_tokens
=
SIMARA_MATCHING_TOKENS
self
.
matching_tokens
=
SIMARA_MATCHING_TOKENS
self
.
edit_and_num_edge_nodes
=
edit_and_num_items_for_ged_from_str_simara
else
:
else
:
self
.
matching_tokens
=
dict
()
self
.
matching_tokens
=
dict
()
...
@@ -549,16 +548,3 @@ def graph_edit_distance(g1, g2):
...
@@ -549,16 +548,3 @@ def graph_edit_distance(g1, g2):
):
):
new_edit
=
v
new_edit
=
v
return
new_edit
return
new_edit
def
edit_and_num_items_for_ged_from_str_simara
(
str_gt
,
str_pred
):
"""
Compute graph edit distance and num nodes/edges for normalized graph edit distance
For the SIMARA dataset
"""
g_gt
=
str_to_graph_simara
(
str_gt
)
g_pred
=
str_to_graph_simara
(
str_pred
)
return
(
graph_edit_distance
(
g_gt
,
g_pred
),
g_gt
.
number_of_nodes
()
+
g_gt
.
number_of_edges
(),
)
This diff is collapsed.
Click to expand it.
dan/manager/training.py
View file @
df6bda94
...
@@ -4,8 +4,6 @@ import json
...
@@ -4,8 +4,6 @@ import json
import
os
import
os
import
pickle
import
pickle
import
random
import
random
import
sys
from
datetime
import
date
from
time
import
time
from
time
import
time
import
numpy
as
np
import
numpy
as
np
...
@@ -523,7 +521,6 @@ class GenericTrainingManager:
...
@@ -523,7 +521,6 @@ class GenericTrainingManager:
return
return
params
=
copy
.
deepcopy
(
self
.
params
)
params
=
copy
.
deepcopy
(
self
.
params
)
params
=
class_to_str_dict
(
params
)
params
=
class_to_str_dict
(
params
)
params
[
"
date
"
]
=
date
.
today
().
strftime
(
"
%d/%m/%Y
"
)
total_params
=
0
total_params
=
0
for
model_name
in
self
.
models
.
keys
():
for
model_name
in
self
.
models
.
keys
():
current_params
=
compute_nb_params
(
self
.
models
[
model_name
])
current_params
=
compute_nb_params
(
self
.
models
[
model_name
])
...
@@ -533,21 +530,6 @@ class GenericTrainingManager:
...
@@ -533,21 +530,6 @@ class GenericTrainingManager:
]
]
total_params
+=
current_params
total_params
+=
current_params
params
[
"
model_params
"
][
"
total_params
"
]
=
"
{:,}
"
.
format
(
total_params
)
params
[
"
model_params
"
][
"
total_params
"
]
=
"
{:,}
"
.
format
(
total_params
)
params
[
"
hardware
"
]
=
dict
()
if
self
.
device
!=
"
cpu
"
:
for
i
in
range
(
self
.
params
[
"
training_params
"
][
"
nb_gpu
"
]):
params
[
"
hardware
"
][
str
(
i
)]
=
"
{} {}
"
.
format
(
torch
.
cuda
.
get_device_name
(
i
),
torch
.
cuda
.
get_device_properties
(
i
)
)
else
:
params
[
"
hardware
"
][
"
0
"
]
=
"
CPU
"
params
[
"
software
"
]
=
{
"
python_version
"
:
sys
.
version
,
"
pytorch_version
"
:
torch
.
__version__
,
"
cuda_version
"
:
torch
.
version
.
cuda
,
"
cudnn_version
"
:
torch
.
backends
.
cudnn
.
version
(),
}
with
open
(
path
,
"
w
"
)
as
f
:
with
open
(
path
,
"
w
"
)
as
f
:
json
.
dump
(
params
,
f
,
indent
=
4
)
json
.
dump
(
params
,
f
,
indent
=
4
)
...
@@ -871,8 +853,9 @@ class GenericTrainingManager:
...
@@ -871,8 +853,9 @@ class GenericTrainingManager:
with
open
(
path
,
"
w
"
)
as
f
:
with
open
(
path
,
"
w
"
)
as
f
:
yaml
.
dump
(
metrics
,
stream
=
f
)
yaml
.
dump
(
metrics
,
stream
=
f
)
# Log mlflow artifacts
if
mlflow_logging
:
mlflow
.
log_artifact
(
path
,
"
predictions
"
)
# Log mlflow artifacts
mlflow
.
log_artifact
(
path
,
"
predictions
"
)
def
output_pred
(
self
,
name
):
def
output_pred
(
self
,
name
):
path
=
os
.
path
.
join
(
path
=
os
.
path
.
join
(
...
@@ -1104,14 +1087,7 @@ class Manager(OCRManager):
...
@@ -1104,14 +1087,7 @@ class Manager(OCRManager):
reduced_size
=
[
s
[:
2
]
for
s
in
batch_data
[
"
imgs_reduced_shape
"
]]
reduced_size
=
[
s
[:
2
]
for
s
in
batch_data
[
"
imgs_reduced_shape
"
]]
y_len
=
batch_data
[
"
labels_len
"
]
y_len
=
batch_data
[
"
labels_len
"
]
# add errors in teacher forcing
if
"
label_noise_scheduler
"
in
self
.
params
[
"
training_params
"
]:
if
(
"
teacher_forcing_error_rate
"
in
self
.
params
[
"
training_params
"
]
and
self
.
params
[
"
training_params
"
][
"
teacher_forcing_error_rate
"
]
is
not
None
):
error_rate
=
self
.
params
[
"
training_params
"
][
"
teacher_forcing_error_rate
"
]
simulated_y_pred
,
y_len
=
self
.
add_label_noise
(
y
,
y_len
,
error_rate
)
elif
"
label_noise_scheduler
"
in
self
.
params
[
"
training_params
"
]:
error_rate
=
(
error_rate
=
(
self
.
params
[
"
training_params
"
][
"
label_noise_scheduler
"
][
self
.
params
[
"
training_params
"
][
"
label_noise_scheduler
"
][
"
min_error_rate
"
"
min_error_rate
"
...
...
This diff is collapsed.
Click to expand it.