diff --git a/art/attacks/evasion/sign_opt.py b/art/attacks/evasion/sign_opt.py index 59f54ad5d7..3d621e3409 100644 --- a/art/attacks/evasion/sign_opt.py +++ b/art/attacks/evasion/sign_opt.py @@ -306,14 +306,14 @@ def _fine_grained_binary_search_local( lbd = initial_lbd # For targeted: we want to expand(x1.01) boundary away from targeted dataset # For untargeted, we want to slim(x0.99) the boundary toward the original dataset - if (not self._is_label(x_0 + lbd * theta, target) and self.targeted) or ( - self._is_label(x_0 + lbd * theta, y_0) and not self.targeted + if (self.targeted and not self._is_label(x_0 + lbd * theta, target)) or ( + not self.targeted and self._is_label(x_0 + lbd * theta, y_0) ): lbd_lo = lbd lbd_hi = lbd * 1.01 nquery += 1 - while (not self._is_label(x_0 + lbd_hi * theta, target) and self.targeted) or ( - self._is_label(x_0 + lbd_hi * theta, y_0) and not self.targeted + while (self.targeted and not self._is_label(x_0 + lbd_hi * theta, target)) or ( + not self.targeted and self._is_label(x_0 + lbd_hi * theta, y_0) ): lbd_hi = lbd_hi * 1.01 nquery += 1 @@ -323,8 +323,8 @@ def _fine_grained_binary_search_local( lbd_hi = lbd lbd_lo = lbd * 0.99 nquery += 1 - while (self._is_label(x_0 + lbd_lo * theta, target) and self.targeted) or ( - not self._is_label(x_0 + lbd_lo * theta, y_0) and not self.targeted + while (self.targeted and self._is_label(x_0 + lbd_lo * theta, target)) or ( + not self.targeted and not self._is_label(x_0 + lbd_lo * theta, y_0) ): lbd_lo = lbd_lo * 0.99 nquery += 1 @@ -332,8 +332,8 @@ def _fine_grained_binary_search_local( while (lbd_hi - lbd_lo) > tol: lbd_mid = (lbd_lo + lbd_hi) / 2.0 nquery += 1 - if (self._is_label(x_0 + lbd_mid * theta, target) and self.targeted) or ( - not self._is_label(x_0 + lbd_mid * theta, y_0) and not self.targeted + if (self.targeted and self._is_label(x_0 + lbd_mid * theta, target)) or ( + not self.targeted and not self._is_label(x_0 + lbd_mid * theta, y_0) ): lbd_hi = lbd_mid else: diff --git a/requirements_test.txt b/requirements_test.txt index ebd63181f5..89499a50d0 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -5,7 +5,7 @@ scipy==1.10.1 matplotlib==3.7.1 scikit-learn>=0.22.2,<1.2.0 six==1.16.0 -Pillow==9.4.0 +Pillow==9.5.0 tqdm==4.65.0 statsmodels==0.13.5 pydub==0.25.1