Note

This example is available as a jupyter notebook here.

And on Google Colab here

Setup the environment if this is executed on Google Colab.

Make sure to change the runtime type to GPU. To do this go to Runtime -> Change runtime type -> GPU

Otherwise, rendering won't work in Google Colab.

import os

try:
    import google.colab
    IN_COLAB = True
except:
    IN_COLAB = False

if IN_COLAB:
    os.system("pip install --quiet 'ring @ git+https://github.com/SimiPixel/ring'")

import ring
# automatically detects colab or not
ring.utils.setup_colab_env()

import mediapy
import jax.numpy as jnp
import tree_utils
import ring
from diodem import benchmark
imtp = benchmark.IMTP(["seg2", "seg3", "seg4"], sparse=True, joint_axes=True, dt=False)
exp_id = 1
motion = "fast_slow_fast"
ringnet = ring.RING(lam=[-1, 0, 1], Ts=0.01)
errors, X, y, yhat, xs, xs_noimu = benchmark.benchmark(imtp, exp_id, motion, ringnet, warmup=5.0)
sys = imtp.sys(exp_id)
frames = sys.render_prediction(xs, yhat, render_every_nth=4, transparent_segment_to_root=False, width=640, height=480, camera="c", 
                         add_cameras={-1: '<camera mode="targetbody" name="c" pos=".5 -.5 1.25" target="3"></camera>',})
Rendering frames..: 100%|██████████| 875/875 [00:09<00:00, 93.81it/s] 

errors
{'seg2': {'mae': 2.7917402, 'std': 1.5290443},
 'seg3': {'mae': 6.0479784, 'std': 3.081823},
 'seg4': {'mae': 5.7122917, 'std': 2.900498}}
mediapy.show_video(frames, fps=25.0)