Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
Data Generator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
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
Data Generator
Commits
601a3fce
Commit
601a3fce
authored
3 years ago
by
Martin
Browse files
Options
Downloads
Patches
Plain Diff
fail with error instead of error message
parent
fd021209
No related branches found
No related tags found
1 merge request
!22
Add style filter (handwritten, typewritten); support ignored_classes
Pipeline
#74331
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kaldi_data_generator/main.py
+4
-10
4 additions, 10 deletions
kaldi_data_generator/main.py
with
4 additions
and
10 deletions
kaldi_data_generator/main.py
+
4
−
10
View file @
601a3fce
...
...
@@ -184,7 +184,6 @@ class HTRDataGenerator:
def
get_accepted_zones
(
self
,
page_id
:
str
):
try
:
skip_count
=
0
accepted_zones
=
[]
for
elt
in
self
.
api_client
.
cached_paginate
(
"
ListElementChildren
"
,
id
=
page_id
,
with_classes
=
True
...
...
@@ -223,14 +222,9 @@ class HTRDataGenerator:
found_class
=
list
(
style_counts
.
keys
())[
0
]
found_class
=
Style
(
found_class
)
else
:
logger
.
info
(
f
"
Multiple style classes on the same element!
Skipping
{
elt
[
'
id
'
]
}
-
{
elem_classes
}
"
raise
ValueError
(
f
"
Multiple style classes on the same element!
{
elt
[
'
id
'
]
}
-
{
elem_classes
}
"
)
skip_count
+=
1
continue
# raise ValueError(
# f"Multiple style classes on the same element! {elt['id']} - {elem_classes}"
# )
if
found_class
==
self
.
style
:
accepted_zones
.
append
(
elt
[
"
zone
"
][
"
id
"
])
...
...
@@ -238,8 +232,8 @@ class HTRDataGenerator:
accepted_zones
.
append
(
elt
[
"
zone
"
][
"
id
"
])
logger
.
info
(
"
Number of accepted zone for page {} :
{} ; skipped
{}
"
.
format
(
page_id
,
len
(
accepted_zones
)
,
skip_count
"
Number of accepted zone for page {} : {}
"
.
format
(
page_id
,
len
(
accepted_zones
)
)
)
return
accepted_zones
...
...
This diff is collapsed.
Click to expand it.
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