Skip to content

Commit

Permalink
bug fix for robustness not being able to work with non-image dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
imda-kelvinkok committed Nov 22, 2023
1 parent 8b90df7 commit b059af5
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,16 @@ def _get_initial_adversarial_samples(
)

else:
if (
self._serializer_instance.get_serializer_plugin_type()
is SerializerPluginType.IMAGE
):
processed_pertubed_input = [perturbed_input]
else:
processed_pertubed_input = [[perturbed_input]]
adversarial_prediction = self._model.predict(
self._transform_to_df(
[perturbed_input], image_shapes, subfolder_name="adv_pred"
processed_pertubed_input, image_shapes, subfolder_name="adv_pred"
),
self._data_labels,
)
Expand Down Expand Up @@ -840,6 +847,12 @@ def _get_final_adversarial_samples(
final_adversarial_samples_to_predict = self._transform_to_df(
final_adversarial_samples, image_shapes, subfolder_name="adv_prediction"
)
if (
self._serializer_instance.get_serializer_plugin_type()
is not SerializerPluginType.IMAGE
):
final_adversarial_samples_to_predict = [final_adversarial_samples_to_predict]

adversarial_prediction = self._model.predict(
final_adversarial_samples_to_predict, self._data_labels
)
Expand Down

0 comments on commit b059af5

Please sign in to comment.