Skip to content

Commit

Permalink
mode switch in hf models
Browse files Browse the repository at this point in the history
  • Loading branch information
rabah-khalek committed Aug 8, 2024
1 parent 7ba35b6 commit 6c3ffc9
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions giskard_vision/image_classification/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,7 @@ def predict_image(self, image, mode=None) -> Types.label:
image (np.ndarray): input image
mode (str): mode of the image
"""
if len(image.shape) == 2:
mode = "L" # Grayscale - Needed to run the color robustness detector
probas = self.predict_probas(image, mode=mode)
return self.classification_labels[np.argmax(probas)]

0 comments on commit 6c3ffc9

Please sign in to comment.