Running HAMS-ALT Video Segmentation module#
[ ]:
import os
from ipywidgets import FileUpload
from omegaconf import OmegaConf
from mapping_cli.segment import segment
from mapping_cli.config.config import Config
[ ]:
from ipywidgets import FileUpload
from IPython.display import display, Video
upload = FileUpload(accept='.mp4', multiple=False)
display(upload)
Upload a track-facing video to segment it into its respective maneuvers
[ ]:
with open("back_video.mp4", "wb") as f:
f.write(upload.value[0].content)
Modify the config variables depending on the need.
[ ]:
config = {}
Now, save the config to site.yaml
, create a directory to store the outputs named output
and run the segmentation module
[ ]:
with open('seatbelt.yaml', 'w') as f:
OmegaConf.save(OmegaConf.create(config), f)
os.makedirs('output', exist_ok=True)
[ ]:
segment(None, os.path.abspath('back_video.mp4'), 'output', Config('site.yaml'))
Segmentation Results#
[ ]:
videos = [path for path in os.listdir('output') if '.mp4' in path]
for video in videos:
display(Video(video))