Skip to content

Video key-frames extractor

This model implements two types of modules: a video frames encoder and the key-frames module. These models are an implementation of a TorchModel.

Pre-trained models

mozuma.models.keyframes.pretrained.torch_keyframes_resnet_imagenet

KeyFrames selector with PyTorch's ResNet pre-trained on ImageNet

Parameters:

Name Type Description Default
resnet_arch ResNetArchs

Identifier for the ResNet architecture to load. Must be one of:

  • resnet18
  • resnet34
  • resnet50
  • resnet101
  • resnet152
  • resnext50_32x4d
  • resnext101_32x8d
  • wide_resnet50_2
  • wide_resnet101_2
required
fps float

The number of frames per seconds to extract from the video. Defaults to 1.

1
device torch.device

Torch device to initialise the model weights

device(type='cpu')

Returns:

Type Description
KeyFrameSelector

Keyframes model with ResNet pre-trained on ImageNet encoder

mozuma.models.keyframes.pretrained.torch_keyframes_densenet_imagenet

KeyFrames selector with PyTorch DenseNet model pretrained on ImageNet

Parameters:

Name Type Description Default
densenet_arch DenseNetArch

Identifier for the DenseNet architecture. Must be one of:

- densenet121
- densenet161
- densenet169
- densenet201
required
fps float

The number of frames per seconds to extract from the video. Defaults to 1.

1
device torch.device

Torch device to initialise the model weights

device(type='cpu')

Returns:

Type Description
KeyFrameSelector

Keyframes model with DenseNet pre-trained on ImageNet encoder

mozuma.models.keyframes.pretrained.torch_keyframes_densenet_places365

KeyFrames selector with PyTorch DenseNet model pretrained on Places365.

See places365 documentation for more info.

Parameters:

Name Type Description Default
device torch.device

Torch device to initialise the model weights

device(type='cpu')

Returns:

Type Description
KeyFrameSelector

Keyframes model with DenseNet model pretrained on Places365

Base key-frames selector model

These models allow to extract key-frames from a video.

mozuma.models.keyframes.selectors.KeyFrameSelector

Video key-frames selector

Attributes:

Name Type Description
image_encoder TorchModel[torch.Tensor, torch.Tensor]

The PyTorch module to encode frames.

fps float

The number of frames per seconds to extract from the video. Defaults to 1.

device torch.device

The PyTorch device to initialise the model weights. Defaults to torch.device("cpu").

Base video frames encoder model

mozuma.models.keyframes.encoders.VideoFramesEncoder

Video frames encoder

This module will extract and encode frames of a video using an image_encoder.

Attributes:

Name Type Description
image_encoder TorchModel[torch.Tensor]

The PyTorch module to encode frames

fps float

The number of frames per seconds to extract from the video. Defaults to 1.

device torch.device

The PyTorch device to initialise the model weights. Defaults to torch.device("cpu").