Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[carla] In carla example, save all images and measurements to local disk #1350

Merged
merged 9 commits into from
Dec 21, 2017

Conversation

ericl
Copy link
Contributor

@ericl ericl commented Dec 20, 2017

What do these changes do?

Saves all images (in 400x300) to local disk, along with measurements, action, controls, and reward. The directory structure is as follows:

CARLA_OUT/
   CameraRGB/
      <episode_id>_<step>.jpg
      ...
   CameraDepth/
      <episode_id>_<step>.jpg
      ...
    measurements_<episode_id>.json
    ...

data = cv2.resize(
data, (self.config["x_res"], self.config["y_res"]),
interpolation=cv2.INTER_AREA)
data = (data.astype(np.float32) - 128) / 128
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested both out by using scipy.imsave on the results, and they appear correct.

return image.data.reshape(
self.config["x_res"], self.config["y_res"], 3)
data = image.data.reshape(
self.config["render_y_res"], self.config["render_x_res"], 3)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: (y, x)

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2858/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2859/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2862/
Test PASSed.

@danielsuo
Copy link
Contributor

Awesome work! Quick question: presumably, we're interested in saving the data to local disk for later batch processing? If so, we may care less about real-time performance and more about resolution.

In the [private] BDD repo, we were able to get 1920x1080 by dumping to a sequential binary file (i.e., no processing) at ~12 fps on Titan X Maxwell (close to the max others reported). Of course, we need some post-processing to convert that into whatever usable format after the fact.

@ericl
Copy link
Contributor Author

ericl commented Dec 20, 2017

Yeah, the motivation here is two fold: off policy RL algorithms can be bootstrapped off of existing data, and also dumping makes it easier to debug training progress.

I chose 400x300 to save on disk space -- in your binary format, what's the space usage like? If the code can be shared it might make sense to also save in that format as well for more flexibility in the future.

@danielsuo
Copy link
Contributor

danielsuo commented Dec 20, 2017

I see, makes sense. I've been advised by @fyu that higher resolution is important, but I'll fully admit that I don't know all the factors to consider.

I don't know that we're allowed to share the code publicly, but the format for images is really simple: one big file with 4 bytes for each element in the width x height x channels x sensors x time array. We have some code to process this into human-viewable images (e.g., RGB image for scene; log-scale grayscale depth), but reading in the single binary file during replay / training is also much faster than opening a ton of small files.

I hesitate to say whether ray should also do this because large binary files aren't usually the way of distributed systems, but it seems perhaps a more reasonable choice in this case since we're effectively using this large file as a log.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2871/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2870/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2877/
Test PASSed.

@AmplabJenkins
Copy link

Merged build finished. Test PASSed.

@AmplabJenkins
Copy link

Test PASSed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/Ray-PRB/2884/
Test PASSed.

@pcmoritz pcmoritz merged commit 0ae660c into ray-project:master Dec 21, 2017
@pcmoritz pcmoritz deleted the carla-2 branch December 21, 2017 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants