Attack on Traffic Signs Recognition System

Experiment 1

  • Randomly select samples from test set and produce adversarial samples
  • Print out on paper
  • Take photo of the printed signs at varying distance and angles

Experiment 2

  • Find real target signs, take photos at varying distances and angles
  • Produce adversarial samples, print out
  • Take photo and test

In [1]:
import numpy as np
import os, os.path
from scipy import misc

In [ ]:
# Read input images into numpy array
def read_image(im_name):
    im = misc.imread(im_name, flatten=False, mode='RGB')
return im

# Read all image files in a directory and resize them to 32 x 32 pixels
# Chosen interpolation algorithm may affect the result
def read_images(path):
    imgs = []
    valid_images = [".jpg", ".gif", ".png", ".tga"]
    for f in os.listdir(path):
        ext = os.path.splitext(f)[1]
        if ext.lower() not in valid_images:
            continue
        im = read_image(os.path.join(path, f))    
        im = misc.imresize(im, (32, 32))
        imgs.append(im)
    return np.array(imgs)

In [ ]: