qualitylib.feature_extractor.FeatureExtractor

class FeatureExtractor(use_cache=True, sample_rate=None)[source]

Bases: object

Class defining a feature extractor.

Parameters:
  • use_cache (bool) – Flag denoting whether to save/load results to/from cache. Defaults to True.

  • sample_rate (Optional[int]) – Framerate at which features are to be extracted. Defaults to None, i.e., extracting from all frames.

Methods

run

Extract features from asset.

Attributes

NAME

Unique name of feature extractor.

VERSION

Unique version of feature extractor.

feat_names

Optional array of feature names.

name_version

'<name>_V<version>' formatted string

NAME = 'DefaultFex'[source]

Unique name of feature extractor.

VERSION = '1.0'[source]

Unique version of feature extractor.

__call__(*args, **kwargs)[source]

Wrapper around run to make FeatureExtractor object callable.

Parameters:
  • args (List[Any]) – Positional arguments passed to run

  • kwargs (Dict[str, Any]) – Keyword arguments passed to run

Return type:

Result

Returns:

Result containing extracted features and asset data.

feat_names = array([], dtype='<U1')[source]

Optional array of feature names.

property name_version: str[source]

‘<name>_V<version>’ formatted string

run(asset_dict, return_results=True, feat_names=None)[source]

Extract features from asset.

Parameters:
  • asset_dict (Dict[str, Any]) – Input asset

  • return_results (bool) – Flag denoting whether Result is to be returned. Defaults to True.

  • feat_names (Optional[ndarray]) – Names of features to be returned. Defaults to None - all features are returned.

Raises:

RuntimeError – When feature extraction encounters any errors.

Return type:

Result

Returns:

Result containing extracted features and asset data.