in orrb/remote_renderer.py [0:0]
def _convert_render_batch_response(response, config, batch_size):
h, w = config.image_height, config.image_width
batch_dataset = dict()
for stream in response.streams:
stream_rgb_dataset = []
stream_depth_dataset = []
stream_normals_dataset = []
stream_segmentation_dataset = []
for entry in stream.entries:
if entry.image_data:
image = read_rgba_image(entry.image_data, w, h)
stream_rgb_dataset.append(image)
if entry.depth_data:
image = read_depth_image(entry.depth_data, w, h)
stream_depth_dataset.append(image)
if entry.normals_data:
image = read_normals_image(entry.normals_data, w, h)
stream_normals_dataset.append(image)
if entry.segmentation_data:
image = read_segmentation_image(entry.segmentation_data, w, h)
stream_segmentation_dataset.append(image)
batch_dataset[stream.name] = np.array(stream_rgb_dataset)
if stream_depth_dataset:
batch_dataset['%s_depth' % stream.name] = np.array(stream_depth_dataset)
if stream_normals_dataset:
batch_dataset['%s_normals' % stream.name] = np.array(stream_normals_dataset)
if stream_segmentation_dataset:
batch_dataset['%s_segmentation' % stream.name] = np.array(stream_segmentation_dataset)
for float_stream in response.auxiliary_float_streams:
_add_auxiliary_stream(batch_dataset, batch_size, float_stream, float)
for int_stream in response.auxiliary_int_streams:
_add_auxiliary_stream(batch_dataset, batch_size, int_stream, int)
for bool_stream in response.auxiliary_bool_streams:
_add_auxiliary_stream(batch_dataset, batch_size, bool_stream, bool)
return batch_dataset