concepts.vision.fm_match.diff3f.extractor_dino.get_dino_features#

get_dino_features(device, dino_model, img, grid, normalize=True)[source]#

Get the DINO features for a given image and grid.

This function will always resize the image to (518, 518) and then compute its DINO features. This will result in a feature map of (37, 37). Then, we will “project” the feature map to the grid using bilinear interpolation.

Parameters:
  • device (str) – the device to use.

  • dino_model (Module) – the DINO model.

  • img (Image | ndarray) – the image to extract features from.

  • grid (Tensor) – the grid to project the features to.

  • normalize (bool) – whether to normalize the features.

Returns:

the grid-projected DINO features.

Return type:

Tensor