Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def download():
vol = hub.load(name='imagenet/image:val')[400:600]
a = (vol.mean(axis=(1,2,3)) == 0).sum()
print(vol.mean(axis=(1,2,3)) == 0)
def test_public_access_no_creds():
x = hub.load('imagenet')
assert x[0].mean() == 1
def upload_tfrecord(dataset_type, filepath, version, start_frame):
storage = S3(bucket='waymo-dataset-upload')
str_lasers_range_image = 'edward/{}-lasers-range-image:{}'.format(dataset_type, version)
str_lasers_range_image_first = 'edward/{}-lasers-range-image-first:{}'.format(dataset_type, version)
str_lasers_camera_proj = 'edward/{}-lasers-camera-proj:{}'.format(dataset_type, version)
str_lasers_camera_proj_first = 'edward/{}-lasers-camera-proj-first:{}'.format(dataset_type, version)
hub_lasers_range_image = hub.load(name=str_lasers_range_image, storage=storage)
hub_lasers_camera_proj = hub.load(name=str_lasers_camera_proj, storage = storage)
hub_lasers_range_image_first = hub.load(name=str_lasers_range_image_first, storage=storage)
hub_lasers_camera_proj_first = hub.load(name=str_lasers_camera_proj_first, storage=storage)
dataset = tf.data.TFRecordDataset(filepath)
for batch in dataset.batch(1):
def get_arr_image(range_image_compressed):
data = zlib.decompress(range_image_compressed)
mt = open_dataset.MatrixFloat()
mt.ParseFromString(data)
arr = np.reshape(np.array(mt.data), tuple(mt.shape.dims), order='C')
return arr
def get_arr_proj(camera_projection_compressed):
data = zlib.decompress(camera_projection_compressed)
mt = open_dataset.MatrixInt32()
mt.ParseFromString(data)
arr = np.reshape(np.array(mt.data), tuple(mt.shape.dims), order='C')
def upload_tfrecord(dataset_type, filepath, version, start_frame):
storage = S3(bucket='waymo-dataset-upload')
str_lasers_range_image = 'edward/{}-lasers-range-image:{}'.format(dataset_type, version)
str_lasers_range_image_first = 'edward/{}-lasers-range-image-first:{}'.format(dataset_type, version)
str_lasers_camera_proj = 'edward/{}-lasers-camera-proj:{}'.format(dataset_type, version)
str_lasers_camera_proj_first = 'edward/{}-lasers-camera-proj-first:{}'.format(dataset_type, version)
hub_lasers_range_image = hub.load(name=str_lasers_range_image, storage=storage)
hub_lasers_camera_proj = hub.load(name=str_lasers_camera_proj, storage = storage)
hub_lasers_range_image_first = hub.load(name=str_lasers_range_image_first, storage=storage)
hub_lasers_camera_proj_first = hub.load(name=str_lasers_camera_proj_first, storage=storage)
dataset = tf.data.TFRecordDataset(filepath)
for batch in dataset.batch(1):
def get_arr_image(range_image_compressed):
data = zlib.decompress(range_image_compressed)
mt = open_dataset.MatrixFloat()
mt.ParseFromString(data)
arr = np.reshape(np.array(mt.data), tuple(mt.shape.dims), order='C')
return arr
def get_arr_proj(camera_projection_compressed):
data = zlib.decompress(camera_projection_compressed)
mt = open_dataset.MatrixInt32()
def upload_tfrecord(dataset_type, filepath, version, start_frame):
storage = S3(bucket='waymo-dataset-upload')
label_name = 'edward/{}-labels:{}'.format(dataset_type, version)
image_name = 'edward/{}-camera-images:{}'.format(dataset_type, version)
# print('{} {}'.format(label_name, image_name))
images_arr = hub.load(name=image_name, storage=storage)
labels_arr = hub.load(name=label_name, storage=storage)
frame_count = start_frame
dataset = tf.data.TFRecordDataset(filepath)
# print('Yeah {}'.format(frame_count))
for batch in dataset.batch(16):
# print('Cycle')
t1 = clock()
l = batch.shape[0]
arr = np.zeros(shape=(l, 6, 1280, 1920, 3), dtype='uint8')
lab = np.zeros(shape=(l, 2, 6, 30, 7), dtype='float64')
for i in range(0, l):
# print('Cycle2')
data = batch[i]
frame = open_dataset.Frame()
frame.ParseFromString(bytearray(data.numpy()))
for image in frame.images:
def upload_tfrecord(dataset_type, filepath, version, start_frame):
storage = S3(bucket='waymo-dataset-upload')
label_name = 'edward/{}-labels:{}'.format(dataset_type, version)
image_name = 'edward/{}-camera-images:{}'.format(dataset_type, version)
# print('{} {}'.format(label_name, image_name))
images_arr = hub.load(name=image_name, storage=storage)
labels_arr = hub.load(name=label_name, storage=storage)
frame_count = start_frame
dataset = tf.data.TFRecordDataset(filepath)
# print('Yeah {}'.format(frame_count))
for batch in dataset.batch(16):
# print('Cycle')
t1 = clock()
l = batch.shape[0]
arr = np.zeros(shape=(l, 6, 1280, 1920, 3), dtype='uint8')
lab = np.zeros(shape=(l, 2, 6, 30, 7), dtype='float64')
for i in range(0, l):
# print('Cycle2')
data = batch[i]
frame = open_dataset.Frame()
frame.ParseFromString(bytearray(data.numpy()))
for image in frame.images:
# print('Cycle3')
def upload_tfrecord(dataset_type, filepath, version, start_frame):
storage = S3(bucket='waymo-dataset-upload')
str_lasers_range_image = 'edward/{}-lasers-range-image:{}'.format(dataset_type, version)
str_lasers_range_image_first = 'edward/{}-lasers-range-image-first:{}'.format(dataset_type, version)
str_lasers_camera_proj = 'edward/{}-lasers-camera-proj:{}'.format(dataset_type, version)
str_lasers_camera_proj_first = 'edward/{}-lasers-camera-proj-first:{}'.format(dataset_type, version)
hub_lasers_range_image = hub.load(name=str_lasers_range_image, storage=storage)
hub_lasers_camera_proj = hub.load(name=str_lasers_camera_proj, storage = storage)
hub_lasers_range_image_first = hub.load(name=str_lasers_range_image_first, storage=storage)
hub_lasers_camera_proj_first = hub.load(name=str_lasers_camera_proj_first, storage=storage)
dataset = tf.data.TFRecordDataset(filepath)
for batch in dataset.batch(1):
def get_arr_image(range_image_compressed):
data = zlib.decompress(range_image_compressed)
mt = open_dataset.MatrixFloat()
mt.ParseFromString(data)
arr = np.reshape(np.array(mt.data), tuple(mt.shape.dims), order='C')
return arr
def get_arr_proj(camera_projection_compressed):
data = zlib.decompress(camera_projection_compressed)
mt = open_dataset.MatrixInt32()
mt.ParseFromString(data)