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>',})
errors
mediapy.show_video(frames, fps=25.0)