Fixing Visualization to display color images
Visualization for color/multi-channel images was not handled.
@@ -158,8 +158,8 @@ def mnist_tutorial_jsma(train_start=0, train_end=60000, test_start=0,
# Display the original and adversarial images side-by-side
if viz_enabled:
figure = pair_visual(
- np.reshape(sample, (img_rows, img_cols)),
- np.reshape(adv_x, (img_rows, img_cols)), figure)
+ np.reshape(sample, (img_rows, img_cols, channels)),
+ np.reshape(adv_x, (img_rows, img_cols, channels)), figure)
# Add our adversarial example to our grid data
grid_viz_data[target, current_class, :, :, :] = np.reshape(
