deep learning for computer vision following is the code to do this listing copying images rainingvalidationand est direct ories directory where you'll store your smaller dataset path to the directory where the original dataset was uncompressed import osshutil original_dataset_dir '/users/fchollet/downloads/kaggle_original_database_dir '/users/fchollet/downloads/cats_and_dogs_smallos mkdir(base_dirtrain_dir os path join(base_dir'train'os mkdir(train_dirvalidation_dir os path join(base_dir'validation'os mkdir(validation_dirtest_dir os path join(base_dir'test'os mkdir(test_dirdirectories for the trainingvalidationand test splits train_cats_dir os path join(train_dir'cats'os mkdir(train_cats_dirdirectory with training cat pictures train_dogs_dir os path join(train_dir'dogs'os mkdir(train_dogs_dirdirectory with training dog pictures validation_cats_dir os path join(validation_dir'cats'os mkdir(validation_cats_dirdirectory with validation cat pictures validation_dogs_dir os path join(validation_dir'dogs'os mkdir(validation_dogs_dirdirectory with validation dog pictures test_cats_dir os path join(test_dir'cats'os mkdir(test_cats_dirdirectory with test cat pictures test_dogs_dir os path join(test_dir'dogs'os mkdir(test_dogs_dirdirectory with test dog pictures fnames ['cat {jpgformat(ifor in range( )for fname in fnamessrc os path join(original_dataset_dirfnamedst os path join(train_cats_dirfnameshutil copyfile(srcdstcopies the first , cat images to train_cats_dir fnames ['cat {jpgformat(ifor in range( )for fname in fnamessrc os path join(original_dataset_dirfnamedst os path join(validation_cats_dirfnameshutil copyfile(srcdstcopies the next cat images to validation_cats_dir fnames ['cat {jpgformat(ifor in range( )for fname in fnamessrc os path join(original_dataset_dirfnamedst os path join(test_cats_dirfnameshutil copyfile(srcdstcopies the next cat images to test_cats_dir licensed to