Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
ocr4all-pixel-classifier-frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ocr4all-page-segmentation
ocr4all-pixel-classifier-frontend
Commits
a4c6de4a
Commit
a4c6de4a
authored
Oct 05, 2020
by
Alexander Gehrke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up and fix weak warnings
parent
067e7e61
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
9 deletions
+8
-9
ocr4all_pixel_classifier_frontend/create_dataset_file.py
ocr4all_pixel_classifier_frontend/create_dataset_file.py
+5
-5
ocr4all_pixel_classifier_frontend/inspect_color_map.py
ocr4all_pixel_classifier_frontend/inspect_color_map.py
+1
-2
ocr4all_pixel_classifier_frontend/scripts/__init__.py
ocr4all_pixel_classifier_frontend/scripts/__init__.py
+0
-0
ocr4all_pixel_classifier_frontend/train.py
ocr4all_pixel_classifier_frontend/train.py
+2
-2
No files found.
ocr4all_pixel_classifier_frontend/create_dataset_file.py
View file @
a4c6de4a
import
argparse
from
ocr4all_pixel_classifier.lib.dataset
import
list_dataset
,
single_split
,
create_splits
from
random
import
seed
import
json
...
...
@@ -49,6 +48,7 @@ def main():
args
=
parser
.
parse_args
()
from
random
import
seed
seed
(
args
.
seed
)
data_files
=
list_dataset
(
args
.
dataset_path
,
args
.
xheight
,
...
...
@@ -64,17 +64,17 @@ def main():
train
,
test
=
split
write_json
(
args
.
output_file
.
format
(
i
),
args
.
dataset_path
,
args
.
seed
,
train
,
test
,
[])
else
:
train
,
test
,
eval
=
single_split
(
args
.
n_train
,
args
.
n_test
,
args
.
n_eval
,
data_files
)
write_json
(
args
.
output_file
,
args
.
dataset_path
,
args
.
seed
,
train
,
test
,
eval
)
train
,
test
,
eval
uation
=
single_split
(
args
.
n_train
,
args
.
n_test
,
args
.
n_eval
,
data_files
)
write_json
(
args
.
output_file
,
args
.
dataset_path
,
args
.
seed
,
train
,
test
,
eval
uation
)
def
write_json
(
output_file
,
dataset_path
,
seed
,
train
,
test
,
eval
):
def
write_json
(
output_file
,
dataset_path
,
seed
,
train
,
test
,
eval
uation
):
content
=
json
.
dumps
({
"seed"
:
seed
,
"dataset_path"
:
dataset_path
,
"train"
:
train
,
"test"
:
test
,
"eval"
:
eval
,
"eval"
:
eval
uation
,
},
indent
=
4
)
with
open
(
output_file
,
"w"
)
as
f
:
f
.
write
(
content
)
...
...
ocr4all_pixel_classifier_frontend/inspect_color_map.py
View file @
a4c6de4a
...
...
@@ -12,8 +12,7 @@ def main():
args
=
parser
.
parse_args
()
for
imap
in
args
.
vars
:
map
=
ColorMap
.
load
(
imap
)
for
k
,
v
in
map
.
mapping
.
items
():
for
k
,
v
in
ColorMap
.
load
(
imap
).
mapping
.
items
():
print
(
f
"
\x1b
[48;2;
{
k
[
0
]
}
;
{
k
[
1
]
}
;
{
k
[
2
]
}
m
\x1b
[0m
\x1b
[38;2;
{
k
[
0
]
}
;
{
k
[
1
]
}
;
{
k
[
2
]
}
m
{
v
}
\x1b
[0m
\n
"
)
...
...
ocr4all_pixel_classifier_frontend/scripts/__init__.py
deleted
100644 → 0
View file @
067e7e61
ocr4all_pixel_classifier_frontend/train.py
View file @
a4c6de4a
...
...
@@ -67,9 +67,9 @@ def main():
def
relpaths
(
basedir
:
str
,
files
:
List
[
str
])
->
List
[
str
]:
return
[
x
if
x
[
0
]
==
"/"
else
path
.
join
(
basedir
,
x
)
for
x
in
files
]
def
is_valid_splitfile
(
json
):
def
is_valid_splitfile
(
json
data
):
for
category
in
[
"train"
,
"test"
,
"eval"
]:
if
type
(
json
[
category
])
==
list
and
len
(
json
[
category
])
>
0
and
type
(
json
[
category
][
0
])
!=
str
:
if
type
(
json
data
[
category
])
==
list
and
len
(
jsondata
[
category
])
>
0
and
type
(
jsondata
[
category
][
0
])
!=
str
:
return
False
return
True
...
...
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