Skip to content

Commit 63f2278

Browse files
authored
Merge branch 'main' into add-ruff
2 parents dcc2bc5 + a4afd27 commit 63f2278

2 files changed

Lines changed: 1 addition & 6 deletions

File tree

pyvisim/_base_classes.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import numpy as np
66

7-
from ._utils import is_numpy_image
87

98

109
class SimilarityMetric(abc.ABC):
@@ -51,7 +50,6 @@ def __call__(self, image: np.ndarray):
5150
:param image: Input image (NumPy array).
5251
:return: Feature descriptors (NumPy array).
5352
"""
54-
is_numpy_image(image, 0)
5553
pass
5654

5755
@property

pyvisim/encoders/vlad.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ def encode(self, images: Iterable[np.ndarray] | np.ndarray) -> np.ndarray:
101101
descriptors = self.pca.transform(descriptors.astype(np.float32))
102102

103103
if descriptors is None or descriptors.shape[0] == 0:
104-
return np.zeros(
105-
len(self.clustering_model.cluster_centers_) * descriptors.shape[1],
106-
dtype=np.float32,
107-
)
104+
raise ValueError("No descriptors found in the image. Cannot compute VLAD encoding.")
108105

109106
labels = self.clustering_model.predict(descriptors.astype(np.float32))
110107
centroids = self.clustering_model.cluster_centers_

0 commit comments

Comments
 (0)