Skip to content

Commit

Permalink
fix(clip): do not trust predicted box sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
AmitMY committed Jan 31, 2024
1 parent 91fff8a commit 067555c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion signwriting_evaluation/metrics/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def signwriting_to_clip_image(signwriting: CLIPInput, size=224) -> Image:

if isinstance(signwriting, str):
try:
img = signwriting_to_image(signwriting)
img = signwriting_to_image(signwriting, trust_box=False)
except ValueError as value_error:
# This may happen when the M box maximum values are lower
# than the symbols minimum values
Expand Down
5 changes: 3 additions & 2 deletions signwriting_evaluation/metrics/test_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ def test_score_image(self):
self.assertIsInstance(score, float) # Check if the score is a float
self.assertAlmostEqual(score, 0.7759, places=2)

def test_bad_fsw_is_empty_image(self):
def test_bad_fsw_is_not_an_empty_image(self):
fsw = "M530x538S37602531x539"
image = signwriting_to_clip_image(fsw)
self.assertTrue(np.alltrue(np.array(image) == 255))
self.assertTrue(np.any(np.array(image) != 255))


if __name__ == '__main__':
unittest.main()

0 comments on commit 067555c

Please sign in to comment.