NVIDIA Clara Train 3.1

Bring your own Writer

Writers in AIAA is the last stage, it will write the result and send it back to the client. You can bring your own writer just make sure it implements this method: __call__(self, output_file, data) and put the code in <workspace>/lib.


You need to write the result in the path specified by “output_file” and return it.

Below is an example of custom writer:


import logging import cv2 class OpenCVWriter(): def __init__(self, image_in='model'): self.key_image_in = image_in def __call__(self, output_file, data): logger = logging.getLogger(self.__class__.__name__) image = data[self.key_image_in] logger.debug('Saving Image{}to:{}'.format(image.shape, output_file)) cv2.imwrite(output_file, image) return output_file


Although AIAA supports only one writer, you can still return multiple results by packing them together using custom writer and unpack on the client side.

© Copyright 2020, NVIDIA. Last updated on Feb 2, 2023.