Redesign and improve rendering through c_render with ffmpeg/xvfb#313
Open
daphne-cornelisse wants to merge 17 commits into2.0from
Open
Redesign and improve rendering through c_render with ffmpeg/xvfb#313daphne-cornelisse wants to merge 17 commits into2.0from
c_render with ffmpeg/xvfb#313daphne-cornelisse wants to merge 17 commits into2.0from
Conversation
…e clearly visible.
…ble logging of vids to wandb.
… them; shade of green otherwise.
c_render with ffmpegc_render with ffmpeg
c_render with ffmpegc_render with ffmpeg/xvfb
c_render with ffmpeg/xvfbc_render with ffmpeg/xvfb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Headless rendering is an important feature since many GPUs - such as those on training clusters - have no display. While headless support already existed in
visualize.cvia ffmpeg, it depended ondrivenet.h, a C reimplementation of the torch network. This created a maintenance burden and a source of bugs, particularly when experimenting with different architectures. The rendering code had also grown bloated and difficult to follow.Proposed solution
This PR removes the dependency on
drivenet.centirely, moving inference to the Python-side torch policy instead. Rendering is now driven from Python, withc_rendercalled directly in the eval loop alongsidevecenv.step.The rendering code is also simplified. The key observation is that the
Clientstruct can be initialized in two modes: a standard pop-up window mode, and a headless mode that forks an ffmpeg process and pipes raw RGBA frames to it for encoding. Window dimensions in headless mode are derived from the actual map bounds, and the orthographic camera is centered on the map's bounding box. The video is finalized cleanly whenvecenv.close()closes the client. There is no difference in SPS compared to the previous implementation.Usage
Render with pre-trained cpt / just once
render_modein.iniThis essentially just runs
env.render()a couple of times, then closes it.View mode
The rendering view can be configured through the view mode in Python (snapshot from
drive.py):During training
Check out the settings under
[eval]insidedrive.iniSummary of improvements
HumanReplayEvaluatorinto a more general-purposeEvaluatorclass with visual eval (rendering) supported. This class can be easily extended to support other functionalities, such as rendering scenarios with high collision scores.c_render())Sharp edges
New look
1dd47642-c547-4e2a-b96c-902d074f31a3.mp4
59e55c55-25f0-427d-8616-5a72d8ad1d9f.mp4