panoMosaics is a Python library that allows users to create enhanced object detection visualizations that capture multiple timesteps using panoramic mosaics.
panoMosaics can be installed using the command
pip install git+https://github.com/egm68/panoramic-mosaics
You can easily visualize the output of an object detection model over several frames with just a few lines of code, as shown below:
import panoMosaics
#load video
main_frame_arr = panoMosaics.video_to_frame_arr('2023.03.29-17.39.21-main.avi')
#load object detection model output
with open('2023.03.29-17.39.21-detic:image.json', 'r') as j:
detic_dict = json.loads(j.read())
#stitch panorama using specified frames
comp_arr, frames_timestamps_arr, transf_index_dict, anchorX, anchorY = stitch_frames(main_frame_arr, detic_dict, [160, 169, 178, 187], 196)
#add object detection visualization
pano_with_bounding_boxes = panoMosaics.draw_all_bounding_boxes_for_given_indices([160, 196], frames_timestamps_arr,
detic_dict, comp_arr, transf_index_dict, 196,
anchorX, anchorY, ["#e41a1c","#377eb8","#d920f5","#ff7f00","#ffff33",
"#00ff00d9", "#17becf", "#2323d9", '#0e9620'], "object", 2,
"arrow", [])
Output:
Try our demo on Colab here.
Read our project report here and watch the accompanying presentation here.