The platform supports several microservices: Analytics, Annotations, Domain Adaptation and Preview. These microservices add additional metrics and processing for outputs of the Rendered.ai engine.
All of the microservices documented here can be accessed through the Rendered.ai SDK, ‘anatools’. For a complete list of the SDK functionality, see the SDK Developer Guide, and for a general overview see the developer guide https://dadoes.atlassian.net/wiki/spaces/DG/pages/1575550987/Getting+Started+with+the+SDK+API.
The Analytics microservice is used to generate different types of statistical analytics about datasets. Call this microservice to learn more about objects in datasets and images properties.
The types of analytics provided by the microservice include:
properties- high level metrics of the job, such as the distribution of image sizes and formats
objectMetrics- metrics of object classes, such as distributions and bounding box sizes
The analytics microservice is accessible through the following SDK methods. The following python code demonstrates using the SDK to get analytics for a dataset.
import anatools, time anaClient = anatools.AnaClient() datasets = anaClient.get_datasets() datasetId = datasets['datasetId'] analyticsId = anaClient.create_analytics(datasetId, type='properties') analytics = anaClient.get_analytics(datasetId, analyticsId=analyticsId) while analytics['status'] != 'complete': time.sleep(5) analytics = anaClient.get_analytics(datasetId, analyticsId=analyticsId) print(analytics['status']) properties = json.loads(analytics['result'])
The annotation microservice is used to convert the Ana annotations produced for each dataset by the Rendered.ai engine into common formats that are used in machine learning pipelines. The current formats supported are:
Below is an image of a dataset which has a COCO annotation generated and ready to download. Pressing the button marked “+” next to “Annotations” in the bottom right will provide a prompt to create a new annotation of a chosen format.
The annotations microservice is accessible through the SDK as demonstrated below.
import anatools, time anaClient = anatools.AnaClient() datasets = anaClient.get_datasets() datasetId = datasets['datasetId'] annotationId = anaClient.create_annotation(datasetId, format='COCO', map='default') annotation_info = anaClient.get_annotations(datasetId=datasetId, annotationId=annotationId) while annotation_info['status'] != 'complete': time.sleep(5) annotation_info = anaClient.get_annotations(datasetId=datasetId, annotationId=annotationId) print(annotation_info['status']) annotation_zipfilename = anaClient.download_annotation(datasetId=datasetId, annotationId=annnotationId)
The download_annotations() function downloads a zip file containing the annotations in the local directory python is launched from.
The Domain Adaptation microservice is used to modify images of a dataset using a CycleGAN. This can lead to better results in machine learning pipelines by better matching real and synthetic data. For more information about CycleGAN, see here.
The domain adaptation microservice is accessible the SDK. In the following example, a custom CylceGAN model is used to inference a specific synthetic dataset. The dataset is named ‘Basic Graph’ in a workspace named ‘Main Example Channel’. The local GAN model is named ‘rendered_target.pth’.
import anatools, time anaClient = anatools.AnaClient() # Upload the model modelId = anaClient.upload_gan_model('rendered_target.pth', 'RAI Example to Target', '256x256 from web scrape', organizationId=anaClient.organization) models = anaClient.get_gan_models() # Get the dataset workspaceData = [ws for ws in anaClient.get_workspaces() if ws['name']=='Main Example Channel'] anaClient.workspace=workspaceData['workspaceId'] datasets = anaClient.get_datasets() datasetData = [ds for ds in datasets if ds['name']=='BasicGraph'] datasetId = datasetData['datasetId'] ganStatusId = anaClient.create_gan_dataset(datasetId, modelId) gan_info = anaClient.get_gan_dataset(ganStatusId) while gan_info['status'] != 'complete': time.sleep(5) gan_info = anaClient.get_gan_dataset(ganStatusId) print(gan_info['status']) gandataset_zipfilename = anaClient.download_dataset(gan_info['datasetId'])
The location of the model file for upload is relative to where the python runtime is started from, as seen by os.getcwd(). The download_dataset() function downloads a zip file containing the dataset in the local directory as well.
The Preview microservice is used to create an example instance of an output image that a graph may generate. Preview images may not be exact representations of output from the channel, especially if the preview is using any techniques to reduce rendering time which would not be used in the production output imagery.
The Preview microservice can be accessed through the Rendered.ai web interface in the top right of the graph editor by pressing “Preview” (see image below.) The preview will then generate with a status message shown in the bottom left. After a few moments the preview image will appear on the page. The preview image will then be used as a thumbnail for the associated graph.
Running the Preview Microservice in the Rendered.ai web interface