Package: anatools
Rendered.ai's SDK: anatoolsanatoolsis an SDK for connecting to the Rendered.ai Platform.
Withanatoolsyou can generate and access synthetic datasets, and much more!>>>importanatools>>>ana=anatools.client()'Enter your credentials for the Rendered.ai Platform.''email:'example@rendered.ai'password:'***************>>>channels=ana.get_channels()>>>graphs=ana.get_staged_graphs()>>>datasets=ana.get_datasets()Install theanatoolsPackage(Optional) Create a new Conda EnvironmentInstall conda for your operating system:https://www.anaconda.com/products/individual.Create a new conda environment and activate it.Install anatools from the Python Package Index.$condacreate-nrenderedaipython=3.7
$condaactivaterenderedaiInstall AnaTools to the Python EnvironmentInstall AnaTools from the Python Package Index.$pipinstallanatoolsDependenciesThe anatools package requires python 3.6 or higher and has dependencies on the following packages:PackageDescriptiondockerA python library for the Docker Engine API.numpyA python library used for array-based processing.pillowA fork of the Python Image Library.pyyamlA python YAML parser and emitter.requestsA simple HTTP python library.If you have any questions or comments, contact Rendered.AI atinfo@rendered.ai.Multiple ways to loginLogin with emailExecute the python command line, create a client and login to Rendered.ai.
In this example we are instantiating a client with no workspace or environment variables, so it is setting our default workspace.
To access the tool, you will need to use your email and password forhttps://deckard.rendered.ai.>>>importanatools>>>ana=anatools.client()'Enter your credentials for the Rendered.ai Platform.''email:'example@rendered.ai'password:'***************API KeysYou can generate as many API keys as you desire with custom expiration dates in order to bypass the email login. Create keys via your email login. To do this, run create_api_key and save the resulting output that is your new API Key. This will only be shown once.ana.create_api_key(name='name',expires='mm-dd-yyyy',organizationId='OrgId')​'apikey-12345...'This API Key can be used for future logins as demonstrated in the following two examples.API Key Param>>>importanatools>>>ana=anatools.client(APIKey='API KEY')UsingprovidedAPIKeytologin....Environment VariableexportRENDEREDAI_API_KEY=API_KEYpython>>>importanatools>>>ana=anatools.client()UsingenvironmentRENDEREDAI_API_KEYkeytologin....Quickstart GuideWhat is the Rendered.ai Platform?The Rendered.ai Platform is a synthetic dataset generation tool where graphs describe what and how synthetic datasets are generated.TermsDefinitionsworkspaceA workspace is a collection of data used for a particular use-case, for example workspaces can be used to organize data for different projects.datasetA dataset is a collection of data, for many use-cases these are images with text-based annotation files.graphA graph is defined by nodes and links, it describes the what and the how a dataset is generated.nodeA node can be described as an executable block of code, it has inputs and runs some algorithm to generate outputs.linkA link is used to transfer data from the output of one node, to the input of other nodes.channelA channel is a collection of nodes, it is used to limit the scope of what is possible to generate in a dataset (like content from a tv channel).How do you use the SDK?The Rendered.ai Platform creates synthetic datasets by processing a graph, so we will need to create the client to connect to the Platform API, create a graph, then create a dataset.Login using email or API KeyCreate a graph file calledgraph.ymlwith the code below.
We are defining a simplistic graph for this example with multiple children's toys dropped into a container.
WhileYAMLfiles are used in channel development and for this example, the Platform SDK and API only supportJSON. Ensure that theYAMLfile is valid in order for the SDK to convertYAMLtoJSONfor you. Otherwise,  provide a graph inJSONformat.version:2nodes:Rubik's Cube:nodeClass:"Rubik'sCube"Mix Cube:nodeClass:Mix CubeBubbles:nodeClass:BubblesYoyo:nodeClass:Yo-yoSkateboard:nodeClass:SkateboardMouldingClay:nodeClass:PlaydoughColorToys:nodeClass:ColorVariationvalues:{Color:"<random>"}links:Generators:-{sourceNode:Bubbles,outputPort:Bubbles Bottle Generator}-{sourceNode:Yoyo,outputPort:Yoyo Generator}-{sourceNode:MouldingClay,outputPort:Play Dough Generator}-{sourceNode:Skateboard,outputPort:Skateboard Generator}ObjectPlacement:nodeClass:RandomPlacementvalues:{Number of Objects:20}links:Object Generators:-{sourceNode:ColorToys,outputPort:Generator}-{sourceNode:"Rubik'sCube",outputPort:"Rubik'sCubeGenerator"}-{sourceNode:Mix Cube,outputPort:Mixed Cube Generator}Container:nodeClass:Containervalues:{Container Type:"LightWoodenBox"}Floor:nodeClass:Floorvalues:{Floor Type:"Granite"}DropObjects:nodeClass:DropObjectsNodelinks:Objects:-{sourceNode:ObjectPlacement,outputPort:Objects}Container Generator:-{sourceNode:Container,outputPort:Container Generator}Floor Generator:-{sourceNode:Floor,outputPort:Floor Generator}Render:nodeClass:RenderNodelinks:Objects of Interest:-{sourceNode:DropObjects,outputPort:Objects of Interest}Create a graph using the client.
To create a new graph, we load the graph defined above into a python dictionary using the yaml python package.
Then we create a graph using the client. This graph is being namedtestgraphand is using theexamplechannel. We will first find thechannelIdmatching to theexamplechannel and use that in thecreate_staged_graphcall.
The client will return agraphIdso we can reference this graph later.>>>importyaml>>>withopen('graph.yml')asgraphfile:>>>graph=yaml.safe_load(graphfile)>>>channels=ana.get_channels()>>>channelId=list(filter(lambdachannel:channel['name']=='example',channels))[0]['channelId']>>>graphId=ana.create_staged_graph(name='testgraph',channelId=channelId,graph=graph)>>>print(graphId)'010f9362-daa8-4c10-a3e8-1e81e0f2e4f4'Create a dataset using the client.
Using thegraphId, we can create a new job to generate a dataset. The job takes some time to run.The client will return adatasetIdthat can be used for reference later. You can use thisdatasetIdto check the job status and, once the job is complete, download the dataset. You have now generated Synthetic Data!>>>datasetId=ana.create_dataset(name='testdataset',graphId=graphId,interpretations='10',priority='1',seed='1',description='A simple dataset with cubes in a container.')>>>datasetId'ce66e81c-23a6-11eb-adc1-0242ac120002'