Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Flatland
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yoogottamk
Flatland
Commits
ad9d154c
Commit
ad9d154c
authored
5 years ago
by
spmohanty
Browse files
Options
Downloads
Patches
Plain Diff
Enable video generation only for a list of hand selected envs from the test set
parent
b40368a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flatland/evaluators/service.py
+33
-8
33 additions, 8 deletions
flatland/evaluators/service.py
with
33 additions
and
8 deletions
flatland/evaluators/service.py
+
33
−
8
View file @
ad9d154c
...
...
@@ -53,12 +53,16 @@ class FlatlandRemoteEvaluationService:
remote_db
=
0
,
remote_password
=
None
,
visualize
=
False
,
video_generation_envs
=
[],
report
=
None
,
verbose
=
False
):
# Test Env folder Paths
self
.
test_env_folder
=
test_env_folder
self
.
video_generation_envs
=
video_generation_envs
self
.
video_generation_indices
=
[]
self
.
env_file_paths
=
self
.
get_env_filepaths
()
print
(
self
.
video_generation_indices
)
# Logging and Reporting related vars
self
.
verbose
=
verbose
...
...
@@ -141,6 +145,21 @@ class FlatlandRemoteEvaluationService:
env_paths
.
append
(
os
.
path
.
join
(
root
,
file
)
)
env_paths
=
sorted
(
env_paths
)
print
(
self
.
video_generation_envs
)
for
_idx
,
env_path
in
enumerate
(
env_paths
):
"""
Here we collect the indices of the environments for which
we need to generate the videos
We increment the simulation count on env_create
so the 1st simulation has an index of 1, when comparing in
env_step
"""
for
vg_env
in
self
.
video_generation_envs
:
print
(
vg_env
,
env_path
)
if
vg_env
in
env_path
:
self
.
video_generation_indices
.
append
(
_idx
+
1
)
return
sorted
(
env_paths
)
def
instantiate_redis_connection_pool
(
self
):
...
...
@@ -367,13 +386,18 @@ class FlatlandRemoteEvaluationService:
# Record Frame
if
self
.
visualize
:
self
.
env_renderer
.
render_env
(
show
=
True
,
show_observations
=
False
,
show_predictions
=
False
)
self
.
env_renderer
.
gl
.
save_image
(
os
.
path
.
join
(
self
.
vizualization_folder_name
,
"
flatland_frame_{:04d}.png
"
.
format
(
self
.
record_frame_step
)
))
self
.
record_frame_step
+=
1
self
.
env_renderer
.
render_env
(
show
=
False
,
show_observations
=
False
,
show_predictions
=
False
)
"""
Only save the frames for environments which are separately provided
in video_generation_indices param
"""
if
self
.
simulation_count
in
self
.
video_generation_indices
:
self
.
env_renderer
.
gl
.
save_image
(
os
.
path
.
join
(
self
.
vizualization_folder_name
,
"
flatland_frame_{:04d}.png
"
.
format
(
self
.
record_frame_step
)
))
self
.
record_frame_step
+=
1
# Build and send response
_command_response
=
{}
...
...
@@ -575,7 +599,8 @@ if __name__ == "__main__":
test_env_folder
=
test_folder
,
flatland_rl_service_id
=
args
.
service_id
,
verbose
=
True
,
visualize
=
True
visualize
=
True
,
video_generation_envs
=
[
"
Test_0/Level_1.pkl
"
]
)
result
=
grader
.
run
()
if
result
[
'
type
'
]
==
messages
.
FLATLAND_RL
.
ENV_SUBMIT_RESPONSE
:
...
...
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