Report module

This module contains classes for generating reports and visualizations.

class vot.report.DefaultStyle(number)

The default style for a plot.

line_style(opacity=1)

Returns the style for a line.

Parameters

opacity (float) – The opacity of the line.

point_style()

Returns the style for a point.

Parameters
  • color (str) – The color of the point.

  • opacity (float) – The opacity of the line.

region_style()

Returns the style for a region, used with DrawHandle.

class vot.report.Legend(style_factory=<class 'vot.report.DefaultStyle'>)

A legend for a plot.

figure(key)

Returns a figure for a key.

keys()

Returns the keys of the legend.

class vot.report.LinePlot(identifier: str, xlabel: str, ylabel: str, xlimits: Tuple[float, float], ylimits: Tuple[float, float], trait=None)

A line plot.

draw(key, data)

Draws the data on the plot.

class vot.report.ObjectVideo(identifier: str, frames: FrameList, fps=10, trait=None)
draw(frame, key, data)

Draws the data on the frame.

render(frame: int)

Renders the frame and returns it as an array.

class vot.report.Plot(identifier: str, xlabel: str, ylabel: str, xlimits: Tuple[float, float], ylimits: Tuple[float, float], trait=None)

Base class for all plots.

property axes: Axes

Returns the axes of the plot.

draw(key, data)

Draws the data on the plot.

property identifier

Returns the identifier of the plot.

save(output: str, fmt: str)

Saves the plot to a file.

Parameters
  • output (str) – The output file.

  • fmt (str) – The format of the output file.

class vot.report.PlotStyle

A style for a plot.

line_style(opacity=1)

Returns the style for a line.

point_style()

Returns the style for a point.

region_style()

Returns the style for a region, used with DrawHandle.

class vot.report.Report(*args, **kwargs)

A report generator for various reports.

Base class for all report generators.

class vot.report.ReportConfiguration(*args, **kwargs)

A configuration for reports.

class vot.report.ScatterPlot(identifier: str, xlabel: str, ylabel: str, xlimits: Tuple[float, float], ylimits: Tuple[float, float], trait=None)

A scatter plot.

draw(key, data)

Draws the data on the plot.

class vot.report.SeparableReport(*args, **kwargs)

A report generator that is separable across experiments.

Base class for all separable report generators.

class vot.report.StyleManager(**kwargs)

A manager for styles.

static default() StyleManager

Gets the default style manager.

legend(key) Legend

Gets the legend for a given key.

make_axes(figure, rect=None, trait=None) Axes

Makes the axes for a given figure.

make_figure(trait=None) Tuple[Figure, Axes]

Makes the figure for a given trait.

Parameters

trait (str) – The trait for which to make the figure.

Returns

A tuple containing the figure and the axes.

plot_style(key) PlotStyle

Gets the plot style for a given key.

class vot.report.Table(header, data, order)
data

Alias for field number 1

header

Alias for field number 0

order

Alias for field number 2

class vot.report.TrackerSorter(*args, **kwargs)

A sorter for trackers.

class vot.report.Video(identifier: str, frames: FrameList, fps: int = 30, trait=None)

Base class for all videos.

draw(frame: int, key, data)

Draws the data on the plot.

property identifier

Returns the identifier of the plot.

render(frame: int)

Renders the frame and returns it as a NumPy array.

vot.report.configure_axes(figure, rect=None, _=None)

Configures the axes of the plot.

vot.report.configure_figure(traits=None)

Configures the figure of the plot.

vot.report.generate_document(workspace: Workspace, trackers: List[Tracker], format: str, name: str, select_sequences: Optional[List[str]] = None, select_experiments: Optional[List[str]] = None)

Generate a report for a one or multiple trackers on an experiment stack and a set of sequences.

Parameters
  • workspace (Workspace) – The workspace to use for the report.

  • trackers – The trackers to include in the report.

  • format – The format of the report.

  • name – The name of the report.

vot.report.generate_serialized(trackers: List[Tracker], sequences: List[Sequence], results, storage: Storage, serializer: str, name: str)

Generates a serialized report of the results.

Common functions for document generation.

class vot.report.common.SequenceOverlapPlots(*args, **kwargs)

A document that produces plots for all analyses configures in stack experiments.

class vot.report.common.StackAnalysesPlots(*args, **kwargs)

A document that produces plots for all analyses configures in stack experiments.

class vot.report.common.StackAnalysesTable(*args, **kwargs)

A document that produces plots for all analyses configures in stack experiments.

vot.report.common.extract_measures_table(trackers: List[Tracker], results) Table

Extracts a table of measures from the results. The table is a list of lists, where each list is a column. The first column is the tracker name, the second column is the measure name, and the rest of the columns are the values for each tracker.

Parameters
  • trackers (list) – List of trackers.

  • results (dict) – Dictionary of results. It is a dictionary of dictionaries, where the first key is the experiment, and the second key is the analysis. The value is a list of results for each tracker.

vot.report.common.extract_plots(trackers: List[Tracker], results, order=None)

Extracts a list of plots from the results. The list is a list of tuples, where each tuple is a pair of strings and a plot.

Parameters
  • trackers (list) – List of trackers.

  • results (dict) – Dictionary of results. It is a dictionary of dictionaries, where the first key is the experiment, and the second key is the analysis. The value is a list of results for each tracker.

Returns

List of plots.

Return type

list

vot.report.common.format_value(data)

Formats a value for display. If the value is a string, it is returned as is. If the value is an integer, it is returned as a string. If the value is a float, it is returned as a string with 3 decimal places. Otherwise, the value is converted to a string.

Parameters

data – Value to format.

Returns

Formatted value.

Return type

str

vot.report.common.merge_repeats(objects)

Merges repeated objects in a list into a list of tuples (object, count).

vot.report.common.per_tracker(a)

Returns true if the analysis is per-tracker.

vot.report.common.read_resource(name)

Reads a resource file from the package directory.

The file is read as a string.

Video report helpers and report element implementations.

class vot.report.video.PreviewVideos(*args, **kwargs)

A report that generates video previews for the tracker results.

compatible(experiment)

Restrict this report element to multi-run experiments.

async generate_video(experiment: Experiment, trackers: List[Tracker], sequence: Sequence, identifier: str = None)

Build one preview video for a sequence and a set of trackers.

async perexperiment(experiment: Experiment, trackers: List[Tracker], sequences: List[Sequence])

Generate per-sequence videos, optionally split per tracker.

class vot.report.video.VideoWriter(filename: str, fps: int = 30)

Abstract interface for writing a stream of rendered frames.

close()

Finalize and close underlying resources.

class vot.report.video.VideoWriterOpenCV(filename: str, fps: int = 30, codec: str = 'mp4v')

Video writer that uses OpenCV codecs (typically AVI/MP4).

close()

Release the OpenCV writer if it was initialized.

class vot.report.video.VideoWriterScikitH264(filename: str, fps: int = 30)

FFmpeg-backed H.264 writer implemented via scikit-video.

close()

Close the FFmpeg writer if it was initialized.

HTML report generation

This module contains classes for generating reports and visualizations.

class vot.report.DefaultStyle(number)

The default style for a plot.

line_style(opacity=1)

Returns the style for a line.

Parameters

opacity (float) – The opacity of the line.

point_style()

Returns the style for a point.

Parameters
  • color (str) – The color of the point.

  • opacity (float) – The opacity of the line.

region_style()

Returns the style for a region, used with DrawHandle.

class vot.report.Legend(style_factory=<class 'vot.report.DefaultStyle'>)

A legend for a plot.

figure(key)

Returns a figure for a key.

keys()

Returns the keys of the legend.

class vot.report.LinePlot(identifier: str, xlabel: str, ylabel: str, xlimits: Tuple[float, float], ylimits: Tuple[float, float], trait=None)

A line plot.

draw(key, data)

Draws the data on the plot.

class vot.report.ObjectVideo(identifier: str, frames: FrameList, fps=10, trait=None)
draw(frame, key, data)

Draws the data on the frame.

render(frame: int)

Renders the frame and returns it as an array.

class vot.report.Plot(identifier: str, xlabel: str, ylabel: str, xlimits: Tuple[float, float], ylimits: Tuple[float, float], trait=None)

Base class for all plots.

property axes: Axes

Returns the axes of the plot.

draw(key, data)

Draws the data on the plot.

property identifier

Returns the identifier of the plot.

save(output: str, fmt: str)

Saves the plot to a file.

Parameters
  • output (str) – The output file.

  • fmt (str) – The format of the output file.

class vot.report.PlotStyle

A style for a plot.

line_style(opacity=1)

Returns the style for a line.

point_style()

Returns the style for a point.

region_style()

Returns the style for a region, used with DrawHandle.

class vot.report.Report(*args, **kwargs)

A report generator for various reports.

Base class for all report generators.

class vot.report.ReportConfiguration(*args, **kwargs)

A configuration for reports.

class vot.report.ScatterPlot(identifier: str, xlabel: str, ylabel: str, xlimits: Tuple[float, float], ylimits: Tuple[float, float], trait=None)

A scatter plot.

draw(key, data)

Draws the data on the plot.

class vot.report.SeparableReport(*args, **kwargs)

A report generator that is separable across experiments.

Base class for all separable report generators.

class vot.report.StyleManager(**kwargs)

A manager for styles.

static default() StyleManager

Gets the default style manager.

legend(key) Legend

Gets the legend for a given key.

make_axes(figure, rect=None, trait=None) Axes

Makes the axes for a given figure.

make_figure(trait=None) Tuple[Figure, Axes]

Makes the figure for a given trait.

Parameters

trait (str) – The trait for which to make the figure.

Returns

A tuple containing the figure and the axes.

plot_style(key) PlotStyle

Gets the plot style for a given key.

class vot.report.Table(header, data, order)
data

Alias for field number 1

header

Alias for field number 0

order

Alias for field number 2

class vot.report.TrackerSorter(*args, **kwargs)

A sorter for trackers.

class vot.report.Video(identifier: str, frames: FrameList, fps: int = 30, trait=None)

Base class for all videos.

draw(frame: int, key, data)

Draws the data on the plot.

property identifier

Returns the identifier of the plot.

render(frame: int)

Renders the frame and returns it as a NumPy array.

vot.report.configure_axes(figure, rect=None, _=None)

Configures the axes of the plot.

vot.report.configure_figure(traits=None)

Configures the figure of the plot.

vot.report.generate_document(workspace: Workspace, trackers: List[Tracker], format: str, name: str, select_sequences: Optional[List[str]] = None, select_experiments: Optional[List[str]] = None)

Generate a report for a one or multiple trackers on an experiment stack and a set of sequences.

Parameters
  • workspace (Workspace) – The workspace to use for the report.

  • trackers – The trackers to include in the report.

  • format – The format of the report.

  • name – The name of the report.

vot.report.generate_serialized(trackers: List[Tracker], sequences: List[Sequence], results, storage: Storage, serializer: str, name: str)

Generates a serialized report of the results.

LaTeX report generation

This module contains functions for generating LaTeX documents with results.

class vot.report.latex.Chunk(*, data=None)

A container that does not add a newline after the content.

dumps()

Returns the LaTeX representation of the container.

vot.report.latex.generate_latex_document(trackers: List[Tracker], sequences: List[Sequence], reports, storage: Storage, multipart=True, metadata: dict = None) str

Generates a LaTeX document with the results. The document is returned as a string. If build is True, the document is compiled and the PDF is returned.

Parameters
  • trackers (list) – List of trackers.

  • sequences (list) – List of sequences.

  • reports (list) – List of results tuples.

  • storage (Storage) – Storage object.

  • multipart (bool) – If True, the document is split into multiple files.

  • metadata (dict) – Metadata dictionary.

vot.report.latex.generate_symbols(container, trackers)

Generates a LaTeX command for each tracker.

The command is named after the tracker reference and contains the tracker symbol.

vot.report.latex.insert_figure(figure)

Inserts a figure into a LaTeX document.

vot.report.latex.insert_mplfigure(figure, wrapper=True)

Inserts a matplotlib figure into a LaTeX document.

vot.report.latex.strip_comments(src, wrapper=True)

Strips comments from a LaTeX source file.