preprocess code for mnist