Module for generating lists of frames using frame features, pca, kmeans, etc.

class str, item_group: Dict[, int] = NOTHING, group_data: Dict[int, dict] = NOTHING, groupset_data: Dict = NOTHING)[source]

Class for a set of groups of FrameItem objects.

Each item can have at most one group; each group is represented as an int.


Label for the method used to generate group set.


Dictionary which maps each item to its group.


Dictionary of any extra data for each group; keys are group ids, values are dictionaries of data.


Dictionary for any data about the entire set of groups.

property all_items

Gets list of all items.

append_to_group(group: int, item:[source]

Adds item to group.

extend_group_items(group: int, item_list: List[])[source]

Adds all items in list to group.


Returns group that contain item.

property groups

Iterate over groups, yielding group and list of items.

sample(per_group: int, unique_samples: bool = True)[source]

Returns new FrameGroupSet with groups sampled from current groups.

Note that the order of items in the new groups will not match order of items in the groups from which samples are drawn.

  • per_group – The number of samples to take from each group.

  • unique_samples – Whether to ensure that there are no shared items in the resulting groups.


New FrameGroupSet.

class, frame_idx: int)[source]

Just a simple wrapper for (video, frame_idx), plus method to get image.

class List = NOTHING, data: Optional[numpy.ndarray] = None, ownership: Optional[List[tuple]] = None, meta: List = NOTHING, group_sets: List[] = NOTHING)[source]

Container for items, each item can “own” one or more rows of data.


The list of items


An ndarray with rows of data corresponding to items.


List which specifies which rows of data correspond to which items.


List which stores metadata about each operation on stack.


List of GroupSets of items.

brisk_bag_of_features(brisk_threshold=40, vocab_size=20)[source]

Transform data using bag of features based on brisk features.

property current_groupset

Gets current (most recent) group set.

extend_ownership(ownership, row_count)[source]

Extends an ownership list with number of rows owned by next item.


Flattens each row of data to 1-d array.


Sets items for Stack to all items from current GroupSet.


Returns rows of data which belong to item.


Returns indexes of rows in data which belong to item.


Sets data to raw image for each FrameItem.

hog_bag_of_features(brisk_threshold=40, vocab_size=20)[source]

Transforms data into bag of features vector of hog descriptors.

kmeans(n_clusters: int)[source]

Adds GroupSet using k-means clustering on data.

make_sample_group(videos: List[], samples_per_video: int, sample_method: str = 'stride')[source]

Adds GroupSet by sampling frames from each video.

pca(n_components: int)[source]

Transforms data by applying PCA.

sample_groups(samples_per_group: int)[source]

Adds GroupSet by sampling items from current GroupSet.

class, videos_as_dicts: List[Dict])[source]

Enables easy per-video pipeline parallelization for feature suggestions.

Create a FeatureSuggestionPipeline with the desired parameters, and then call with the pipeline and the list of videos to process in parallel. This will take care of serializing the videos, running the pipelines in a process pool, and then deserializing the results back into a single list of SuggestionFrame objects.


Apply pipeline to single video by idx. Can be called in process.

classmethod make(pipeline, videos)[source]

Make class object from pipeline and list of videos.

classmethod run(pipeline, videos, parallel=True)[source]

Runs pipeline on all videos in parallel and returns suggestions.

classmethod tuples_to_suggestions(tuples, videos)[source]

Converts serialized data from processes back into SuggestionFrames.