Skip to content

Instantly share code, notes, and snippets.

url = "https://huggingface.co/datasets/OneOverZero/Calvin__task_ABC_D_h5__training_s224_h"
dataset_parent = "/"
clone_command = f"""
cd {dataset_parent}
git lfs install
git clone {url}
""" # sh
dataset_folder = path_join(dataset_parent, get_folder_name(url))
if not folder_exists(dataset_folder):
r._run_sys_command(clone_command)
def film_strip(video, length=None, height=None, width=None, vertical=False):
"""
Create a film strip effect from a video sequence.
Args:
video: List of video frames/images
length: Optional number of frames to use (defaults to all frames)
height: Height to resize frames to (default: 480)
width: Width to resize frames to (default: 720)
#CYCLESORT!!!
def swap(a,i,j):
a[i],a[j]=a[j],a[i]
class Counted:
def __repr__(self):
return 'X'
X=Counted()
a=shuffled([3,1,7,8,8,3,3,3,2,4,5,5,0])
from rp.git.Figures.film_strip.film_strip import film_strip
video = "/Users/ryan/CleanCode/Projects/Google2025_Paper/OverleafGit/figures_src/windmill_chase.mp4"
video = load_video(video, use_cache=True)
video = as_float_images(video)
# video=mean(video[:-3],video[1:-2],video[2:-1],video[3:])
before, after = split_tensor_into_regions(video, 1, 1, 2)
frames = [0, 5, 10]
from rp.git.Figures.film_strip.film_strip import film_strip
video='/Users/ryan/CleanCode/Projects/Google2025_Paper/OverleafGit/figures_src/CatFish.mp4'
video=load_video(video, use_cache=True)
for vert in [True,False]:
before=video[:,80:,:720]
after=video[:,80:,-720:]
#display_video(after)
frames=[0,25,46]
from rp.git.Figures.film_strip.film_strip import film_strip
video='/Users/ryan/CleanCode/Projects/Google2025_Paper/OverleafGit/figures_src/CatFish.mp4'
video=load_video(video, use_cache=True)
before=video[:,80:,:720]
after=video[:,80:,-720:]
display_video(after)
frames=[0,25,44]
vert=True
from rp.git.Figures.film_strip.film_strip import film_strip
video='/Users/ryan/CleanCode/Projects/Google2025_Paper/OverleafGit/figures_src/download - 2025-07-02T172224.702.mp4'
video=load_video(video,use_cache=True)
before=video[:,65:-40,:720]
after=video[:,65:-40,-720:]
frames=[0,30,44]
vert=True
before=film_strip(before[frames],vertical=vert)
https://gist.github.com/SqrtRyan/1d0a88afcb761021c21e0c7093ff7638
from rp.git.Figures.film_strip.film_strip import film_strip
video='/Users/ryan/CleanCode/Projects/Google2025_Paper/OverleafGit/figures_src/download - 2025-07-02T172224.702.mp4'
video=load_video(video,use_cache=True)
before=video[:,65:-40,:720]
after=video[:,65:-40,-720:]
frames=3
vert=False
before=film_strip(before,frames,vertical=vert)
NUM_COLS=5
ans = load_image_from_clipboard()
ans = split_tensor_into_regions(ans, 1, NUM_COLS)
ans = [crop_image_zeros(x,mask=x<250) for x in ans]
spacing_ratio=1/50
spacing=round(spacing_ratio*get_image_width(ans[0]))
ans = horizontally_concatenated_images(join_with_separator(ans,spacing))
ans=as_byte_image(ans)
mask=255-255*(as_grayscale_image(ans)==255)