Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Sciencebeam Gym
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sciencebeam
Sciencebeam Gym
Commits
a8106840
Commit
a8106840
authored
7 years ago
by
Daniel Ecer
Browse files
Options
Downloads
Patches
Plain Diff
map main paragraph to section paragraph
parent
fd8be022
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
color_map.conf
+9
-2
9 additions, 2 deletions
color_map.conf
color_map_selected.conf
+9
-3
9 additions, 3 deletions
color_map_selected.conf
sciencebeam_gym/trainer/preprocess.py
+8
-4
8 additions, 4 deletions
sciencebeam_gym/trainer/preprocess.py
with
26 additions
and
9 deletions
color_map.conf
+
9
−
2
View file @
a8106840
...
...
@@ -48,8 +48,15 @@
22
=(
220
,
20
,
60
)
#reference_list_title - #b8860b
23
=(
184
,
134
,
11
)
#main_paragraph - #ff1493
24
=(
255
,
20
,
147
)
#moved to alias
#24=(255,20,147)
[
color_alias
]
# aliases are processed within the preprocessing step
#main_paragraph - almost same as section_paragraph
24
=(
128
,
0
,
128
)
[
color_labels
]
1
=
abstract
...
...
@@ -75,5 +82,5 @@
21
=
acknowledgement
22
=
reference
23
=
reference_list_title
24
=
main_paragraph
#
24=main_paragraph
This diff is collapsed.
Click to expand it.
color_map_selected.conf
+
9
−
3
View file @
a8106840
...
...
@@ -48,8 +48,15 @@
#22=(220,20,60)
#reference_list_title - #b8860b
#23=(184,134,11)
#main_paragraph - #ff1493
24
=(
255
,
20
,
147
)
#moved to alias
#24=(255,20,147)
[
color_alias
]
# aliases are processed within the preprocessing step
#main_paragraph - almost same as section_paragraph
24
=(
128
,
0
,
128
)
[
color_labels
]
1
=
abstract
...
...
@@ -75,5 +82,4 @@
#21=acknowledgement
#22=reference
#23=reference_list_title
24
=
main_paragraph
#24=main_paragraph
This diff is collapsed.
Click to expand it.
sciencebeam_gym/trainer/preprocess.py
+
8
−
4
View file @
a8106840
...
...
@@ -43,7 +43,9 @@ slim = tf.contrib.slim
error_count
=
Metrics
.
counter
(
'
main
'
,
'
errorCount
'
)
def
parse_color_map
(
f
):
def
parse_color_map
(
f
,
section_names
=
None
):
if
section_names
is
None
:
section_names
=
[
'
color_map
'
]
color_map_config
=
ConfigParser
()
color_map_config
.
readfp
(
f
)
...
...
@@ -62,8 +64,10 @@ def parse_color_map(f):
raise
Exception
(
'
invalid color value: {}
'
.
format
(
s
))
color_map
=
dict
()
for
k
,
v
in
color_map_config
.
items
(
'
color_map
'
):
color_map
[
parse_color
(
k
)]
=
parse_color
(
v
)
for
section_name
in
section_names
:
if
color_map_config
.
has_section
(
section_name
):
for
k
,
v
in
color_map_config
.
items
(
section_name
):
color_map
[
parse_color
(
k
)]
=
parse_color
(
v
)
return
color_map
def
map_colors
(
img
,
color_map
):
...
...
@@ -198,7 +202,7 @@ def configure_pipeline(p, opt):
color_map
=
None
if
opt
.
color_map
:
with
file_io
.
FileIO
(
opt
.
color_map
,
'
r
'
)
as
config_f
:
color_map
=
parse_color_map
(
config_f
)
color_map
=
parse_color_map
(
config_f
,
section_names
=
[
'
color_alias
'
,
'
color_map
'
]
)
if
color_map
:
logger
.
info
(
'
read {} color mappings
'
.
format
(
len
(
color_map
)))
else
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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