Synthetic data engineering on the Rendered.ai platform begins with creating a channel. Below are the steps to recreate the Rendered.ai example channel to introduce new developers to the components of channel building and deployment. Following these steps will result in a duplicate of the Rendered.ai example channel code base in a development environment as well as its runtime accessible through the Rendered.ai web interface, which can be accessed at https://deckard.rendered.ai.

The are three steps in creating a new version of the Rendered.ai example channel:

1) duplicate the channel code,

2) build and deploy the channel container, and

3) upload a default graph.

The following tutorial will be in the context of developing in the Rendered.ai dev container as described in Setting Up the Development Environment. Alternatively, a local install of the blender environment will require some changes to the commands; e.g the ana code will be in a local directory not /workspaces.

Duplicate the Rendered.ai Example Channel

The Ana code has a script to creates a directory hierarchy for the source code of a new channel, duplicatechannel.py. The script duplicates the Rendered.ai example channel code so the new channel will have a catalog of items based on nodes from the common and example packages.

This tutorial uses ‘custom_channel’ as the new channel name. Please replace this with a name that describes the channel you are creating.

custom_name=custom_channel;
cd /workspaces/ana/ana/scripts; 
./duplicatechannel.sh -c $custom_name
BASH

Success at this step will result in a code base for your custom channel.

Copy of Rendered.ai Example Channel

If developing in a native Windows environment, bash scripts need to have a different End-Of-Line (EOL) characters. You can use Notepad++ or a similar program to change the EOL characters for these files.

Run the Custom Channel

When you run a channel, you execute the ana.py script which calls the ana interpreter on the given graph. The resulting image or video is stored with annotation data and metadata in a specified output directory. As described in the Ana code README, this can be done directly from the command line.

cd /workspaces/ana/ana; blender --background --python ana.py -- --seed 0 \
--channel $custom_name --data data --graph example_test.yml \
--output /workspaces/ana/data/output 
BASH

Running the above command should result in a single image dataset in the data/output directory as seen in the following screenshot.

A Generated Image of the New Channel

Coverage Tests

The Rendered.ai engine supports coverage tests for channel nodes, which are automatically run when the channel is deployed. As usual with pytest scripts, call_pytest runs all the tests in the given directory channels/$custom_name/tests/register. One of the tests calls blender on the 'example_test.yml' graph, so edits made to this graph effect the test results. In summary, when adding content to a channel, adding nodes to this graph will enhance coverage testing, saving time by exposing errors before going live. To run the coverage tests…

export ANA_ROOT=/workspaces/ana; \
export DATA_ROOT=/workspaces/ana/ana/data; \
cd /workspaces/ana/ana; \
blender --background --python channels/$custom_name/tests/register/call_pytest.py -- \
--pytest "-x channels/$custom_name/tests/register"
BASH

Success at this step will show the tests all pass

Pytest Results

Deploy the Channel

As described in Deploying a Channel to the Platform, the SDK can be used to publish the channel on the Rendered.ai platform. The channel image needs to be built. When working in the dev container, run this in the terminal:

cd /workspaces/ana/ana/scripts; ./buildchannel.sh -d -c $custom_name
BASH

When to rebuild the dev container: Sometimes returning to a stale container causes the above command can throw an error indicating you don' t have permission to run docker.

Once the channel image is built, the following python code can be used to create and deploy the custom channel using a python console.

Make sure to replace ‘custom_channel’ with your channel name.

import anatools
anaclient = anatools.AnaClient()
channelId = anaclient.create_managed_channel('custom_channel')
deploymentId = anaclient.deploy_managed_channel(channelId)
deployment_status = anaclient.get_deployment_status(deploymentId, stream=True)
PY

Note the output step..

Deployment Complete

You will get an email verifying the final state of the deployment process, including the coverage test results.

Now workspaces on the platform can use the new channel.

Edit the Workspace

Add the New Channel to a Workspace

Create a New Graph Using the New Channel

Make a Graph the Default Graph

For managed channels on the platform it is helpful for the users to have graph to start from. To use the SDK to set the default graph, set up an initial graph in the GUI and upload a graph file. The graph file must be in json format so the easiest way is to first download a graph from the example channel.

Download a Graph in JSON Format

Create a New Graph with the Custom Channel; Upload JSON Graph File

Copy Graph Id from URL

# Use SDK to set default graph for channel
import anatools
anaClient = anatools.AnaClient()
# get your channelId from anaclient.channels; get graphId from URL to run ...
anaclient.set_default_graph(channelId=channelId, workspaceId=anaclient.workspace, graphId=)
PY

Congratulations

Now that you have a development environment populated with a working channel you can begin to create your custom channel. With a channel design in mind, take a look at getting the channel updated:

Adding Content to a Channel

Volumes and Package Data