Skip to content

Instantly share code, notes, and snippets.

@AdroitAnandAI
Last active February 18, 2019 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdroitAnandAI/f3984de070a302caefc666200e2bae8f to your computer and use it in GitHub Desktop.
Save AdroitAnandAI/f3984de070a302caefc666200e2bae8f to your computer and use it in GitHub Desktop.
Dataset Parser
import numpy as np
import h5py
import scipy.misc
filePath = "comma-dataset/"
file="2016-03-29--10-50-20"
log = h5py.File(filePath+"log/"+file+".h5", "r")
cam = h5py.File(filePath+"camera/"+file+".h5", "r")
print(log.keys())
skip = 300
# skip to highway
for i in range(skip*100, log['times'].shape[0]):
# Parameter Values
img = cam['X'][log['cam1_ptr'][i]].swapaxes(0,2).swapaxes(0,1)
angle_steers = log['steering_angle'][i]
speed_ms = log['speed'][i]
brake = log['brake_user'][i]
accel = log['car_accel'][i]
scipy.misc.imsave(filePath+"pics/"+str(i)+".png", img[None, :, :, :].transpose(0, 3, 1, 2)[0][0])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment