Skip to content

Commit

Permalink
Changed calculation of similar image leakage to only take one similar…
Browse files Browse the repository at this point in the history
… image per test image (#1297)
  • Loading branch information
nirhutnik committed Apr 20, 2022
1 parent 718b7b9 commit 06fb730
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions deepchecks/vision/checks/methodology/similar_image_leakage.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ def compute(self, context: Context) -> CheckResult:
for i, h in enumerate(self._hashed_test_images):
is_similar = (train_hashes - h) < self.min_pixel_diff
if any(is_similar):
for j in np.argwhere(is_similar): # Return indices where True
similar_indices['train'].append(j[0]) # append only the first similar image in train
similar_indices['test'].append(i)
# For each test image with similarities, append the first similar image in train
similar_indices['train'].append(np.argwhere(is_similar)[0][0])
similar_indices['test'].append(i)

display_indices = random.sample(range(len(similar_indices['test'])),
min(self.n_top_show, len(similar_indices['test'])))
Expand Down

0 comments on commit 06fb730

Please sign in to comment.