MUltiple VIdeos LABelling tool
No Data
MUltiple VIdeos LABelling tool is a manual annotation tool to help you labelling videos for computer vision, machine learning, deep learning and AI applications. With MuViLab you can annotate hours of videos in just a few minutes!
Once you annotate your videos, you can use any stardard library like Tensorflow to train your algorithm.
Immagine you've got days or months of video recording from some source (e.g. video surveillance, health monitoring, weather webcam...) and you're interested in an algorithm that classifies a specific event (e.g. a red car crosses the street, a thunder in the sky...). With standard annotation tools, you have to watch the entire video to observe and label the event. Sometimes, the event you're annotating is so quick that you cannot even speed up your videos, requiring you to watch them at normal speed.
With MuViLab, you can split your long video into short clips of 3-4 seconds, which are shown simultaneously in loop on screen. With a single glance, you'll be able to identify your event in ~100 clips, speeding up your job by almost 100 times!
After annotating your videos, you can use the review function to check and modify your labels:
Simply install the following required pagackes:
$ pip install opencv-python numpy pytube tqdm matplotlib
and run the demo:
$ python examples/example_youtube_olympics.py
The
pytubepackage is only needed to download a youtube video to run the demo.
To start MuViLab, simply import the class
Annotatorinto your script and set up the labels and the folder containing the video clips. Labels must be a list of dictionaries in the form of
{'name': 'My_Label', 'color': (255, 255, 255)}, where
'name'is your custom name for each annotation and
'color'is a BGR colour triplet in the interval
[0, 255]. The method
.video_to_clips()allows you to convert a long video into several short clips. If you already have several clips to annotate, skip this step and simply run
main():
from annotator import Annotator # Define the labels labels = [{'name': 'text_of_label_1', 'color': (0, 255, 0)}, {'name': 'text_of_label_2', 'color': (0, 0, 255)}, {'name': 'text_of_label_3', 'color': (0, 255, 255)}] # Initialise MuViLab clips_folder = './clips' annotator = Annotator(labels, clips_folder, annotation_file='my_labels.json') # Split the main video into clips annotator.video_to_clips('long_video.mp4', clips_folder, clip_length=90, overlap=0, resize=0.5) # Run the GUI annotator.main()
The video clips are shown in a vertical order from the top left to the bottom right corner:
While running, the following keyboard commands will be accepted by the GUI:
Labels will be automatically saved when changing page or quitting the program.
A status file will also be saved including the last video that was labelled. Future runs of the application will start from the last annotated page.
Additional parameters can be set when initialising
Annotator:
'labels.json'
'status.json'
['.mp4', '.avi']
True, the video files in each folder will be sorted alphabetically, otherwise they will be shown according to the default order of the file system. Default value:
True.
N_show_approx=8and the window is square, a total 9 clips will be shown instead. Default value:
100
N_show_approx. Default value:
16/9
]0, inf[to resize the video clips when showing them on screen. The size of the clips will scaled by this factor. Example:
resize=0.5will reduce the size by 50%,
resize=1.5will increase the size by 50%. Default value:
1
None, the duration of the loop will be automatically deduced by the frame-rate of each clip. Default value:
None
MuViLab is designed to work with several short-length clips. You can use the method
.video_to_clips()to convert a single long video into several custom-length clips. The method takes the following arguments as input:
]0, inf[to resize the video clips. The size of the clips will be the size of the target video scaled by this factor. Example:
resize=0.5will reduce the size by 50%,
resize=1.5will increase the size by 50%. Default value:
1
[0, 1[to generate overlapping clips. Example: if
overlap=0.5the clips will overlap by 50%, producing clip 1 with frames (1,2,3,4,5,6), clip 2 with frames (4,5,6,7,8,9), clip 3 with frames (7,8,9,10,11,12) and so on. Default value:
0
loop_durationwhen initialising
Annotator. Default value:
90
Once video clips are generated, every next usage of MuViLab does not need to call
.video_to_clips()again.
MuViLab was developed while working for the SPHERE IRC project. MuViLab is freely available for free non-commercial use, and may be redistributed under these conditions. For commercial queries, please contact me.