cvml

A library of common tools needed for machine learning with a focus on action recognition.

cvml.plot

cvml.plot.plot_confusion_matrix(cnf_matrix, classes, normalize=True, title='Confusion matrix', ylabel='True class', xlabel='Predicted class', cmap='Blues', colorbar=True, colorbar_aspect_ratio=None, classes_per_inch=5, **kwargs)[source]

Plot a confusion matrix. Normalization can be applied by setting normalize=True.

kwargs are parsed on to the plt.imshow function.

Source: http://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py

cvml.video

cvml.video.stitch_frames(frame_dir: pathlib.Path, output_file: pathlib.Path, start_idx: int, stop_idx: int, step=1, fps=59.94, overwrite=False, frame_pattern=re.compile('.*jpg', re.IGNORECASE))[source]

Stitch a directory containing sequentially numbered frames into a video using FFMpeg

Parameters:
  • frame_dir – directory whose children are all frames
  • output_file – path to video file composed from stitching all the frames in frame_dir
  • start_idx – index of the first frame to stitch after listing and sorting all frames with list.sort()
  • stop_idx – index of the last frame to stitch after listing and sorting all frames with list.sort(), use -1 to calculate the last frame based on the start_idx and step
  • step – step size between adjacent frames (use 1 for stitching all frames, 2 for skipping every other frame, -1 for reversing the video)
  • fps – frames per second for the resulting video
  • overwrite – overwrite the output_file if it already exists?
  • frame_pattern – python regex pattern for selecting a subset of files, defaults to selecting everything
Returns:

None

Indices and tables