Experimental#
Some NRTK features are experimental: still under active development with APIs that can change or disappear without a deprecation warning. Experimental features are opt-in, so you cannot import them until you enable them.
Enabling Experimental Features#
To enable experimental features, import nrtk.experimental before importing
anything experimental:
import nrtk.experimental # enable in-development features
That single import will enable all experimental features. After opting into experimental features, experimental features can be imported from their usual/stable locations:
from nrtk.interfaces import SomeExperimentalInterface
from nrtk.impls.<subpackage> import SomeExperimentalImpl
If you try to use an experimental feature without this opt-in import, you will get an
ImportError, instructing you how to enable experimental features.
Note
Enabling experimental features does not install anything. If an experimental feature
needs an extra, you will still be required to install it (e.g. pip install nrtk[<extra>]),
the same as any other NRTK feature.
To summarize, up to two steps may be required to use an experimental feature:
Opt in to globally enable all of NRTK’s experimental features.
Install any extras that are required for the desired experimental feature.
Current Experimental Features#
Features under active development.
Interfaces#
- class nrtk.interfaces.PerturbVideo#
Algorithm that generates a perturbed video for given input video stimulus.
- get_config() dict[str, Any]#
Returns the current configuration of the PerturbVideo instance.
- Returns:
dict[str, Any]: Configuration dictionary with current settings.
- classmethod get_type_string() str#
Returns the fully qualified type string of the PerturbVideo class or its subclass.
- Returns:
A string representing the fully qualified type, in the format <module>.<class_name>. For example, “my_module.CustomPerturbVideo”.
- abstract perturb(*, frames: Iterator[VideoFrame], **additional_params: Any) Generator[VideoFrame, None, None]#
Generate a perturbed video for the given video stimulus.
Note perturbers that resize, rotate, or similarly affect the dimensions of an image may impact scoring if bounding boxes are not similarly transformed. No mutable objects passed in, such as the frame image, should be modified in place; only copies should be modified and returned.
- Parameters:
frames – Iterator of VideoFrame objects containing input frame data.
additional_params – A dictionary containing implementation-defined input parameter-value pairs applicable to the entire video.
- Returns:
A generator yielding VideoFrame objects, each containing perturbed data for one frame.
- class nrtk.interfaces.VideoFrame(*, image: ndarray[Any, Any], timestamp: float, boxes: Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None = None, additional_params: dict[str, Any] | None = None)#
Data structure representing one frame of video, for use with the PerturbVideo interface.
- Attributes:
- image (ndarray)
The frame image as a numpy array.
- timestamp (float)
The frame timestamp in seconds since the beginning of the video.
- boxes (Iterable[tuple[AxisAlignedBoundingBox, dict[Hashable, float]]] | None)
Bounding boxes of detections in the image.
- additional_params (dict[str, Any] | None)
Implementation-defined parameter-value pairs specific to this frame.
Implementations#
No current experimental implementations.
Interoperability#
No current experimental interoperability.