Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot reproduce literature results #15

Open
ivdorelian opened this issue Sep 12, 2020 · 1 comment
Open

Cannot reproduce literature results #15

ivdorelian opened this issue Sep 12, 2020 · 1 comment

Comments

@ivdorelian
Copy link

The best I can get this to is 94.2% accuracy on the test set. I've done this with this implementation of the described augmentation method in the original paper:

def crop_mirror(image):

    pad = 4
    im_shape = image.shape
    new_image = np.zeros((im_shape[0] + 2*pad, im_shape[1] + 2*pad, 3))
    for c in range(im_shape[-1]):
        new_image[:, :, c] = np.pad(image[:, :, c], 4, mode='reflect')
    rand_row_start = np.random.randint(0, 8)
    rand_col_start = np.random.randint(0, 8)

    row_end = rand_row_start + im_shape[0]
    col_end = rand_col_start + im_shape[1]
    return new_image[rand_row_start:row_end, rand_col_start:col_end, :]

datagen = ImageDataGenerator(
    horizontal_flip=True,  # randomly flip images
    preprocessing_function=crop_mirror)

And std normalization:

(X_train, y_train), (X_test, y_test) = tf.keras.datasets.cifar10.load_data()
X_train = (X_train - X_train.mean(axis=0)) / (X_train.std(axis=0))
X_test = (X_test - X_test.mean(axis=0)) / (X_test.std(axis=0))

And I've also had to use 3 augmentation rounds to get there.

Any other idea about what might be the problem with reproducing the results in the paper using TF?

@asmith26
Copy link
Owner

Hi @ivdorelian,

Thanks for your information and code regarding cropping/augmentation. The best I have achieved is test accuracy 0.93%, but I haven't tried experimenting with the full paper implementations as I noted in the README

If you do manage to improve/reproduce the results in the paper, contributions are very welcome :)
Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants