Skip to content

Commit cc6f6e9

Browse files
Irina NicolaeIrina Nicolae
authored andcommitted
Fix values normalization in feature squeezing (close #16)
(cherry picked from commit 857ab12)
1 parent ba76240 commit cc6f6e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

art/defences/feature_squeezing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def __call__(self, x, y=None, bit_depth=None, clip_values=(0, 1)):
5757

5858
x_ = x - clip_values[0]
5959
if clip_values[1] != 0:
60-
x_ = x_ / clip_values[1]
60+
x_ = x_ / (clip_values[1] - clip_values[0])
6161

6262
max_value = np.rint(2 ** self.bit_depth - 1)
6363
res = (np.rint(x_ * max_value) / max_value) * (clip_values[1] - clip_values[0]) + clip_values[0]

0 commit comments

Comments
 (0)