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 imt-ring")
import ring
# automatically detects colab or not
from ring.extras.colab import setup_colab_env
setup_colab_env()
import mediapy
import ring
from benchmark import benchmark as benchmark_fn
from benchmark import IMTP
imtp = IMTP(["seg2", "seg3", "seg4"], sparse=True, joint_axes_1d=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_fn(imtp, exp_id, motion, ringnet, warmup=5.0, y_rootfull_child_to_parent=False)
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)