{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport cv2\nimport shutil\nfrom tqdm.notebook import trange\n\n\nTARGET_SHAPE = (512,512)\nINTERPOLATION = cv2.INTER_AREA\nTRAIN_DIR = \"../input/ultra-mnist/train/\"\nTEST_DIR = \"../input/ultra-mnist/test/\"\nTARGET_TRAIN = \"train/\"\nTARGET_TEST = \"test/\"\n\n\nos.makedirs(str(TARGET_TRAIN) , exist_ok=True)\nos.makedirs(str(TARGET_TEST) , exist_ok=True)\ntrain_images = os.listdir(TRAIN_DIR)\ntest_images = os.listdir(TEST_DIR)\n\n\nfor idx in trange(len(train_images)):\n    image = train_images[idx]\n    loaded_image = cv2.imread(str(TRAIN_DIR + image))\n    resized_image = cv2.resize(loaded_image, TARGET_SHAPE , interpolation =INTERPOLATION)\n    cv2.imwrite(str(TARGET_TRAIN  + image) , resized_image)\nprint(\"Train Images done!!! \")\n\n\nfor idx in trange(len(test_images)):\n    image = test_images[idx]\n    loaded_image = cv2.imread(str(TEST_DIR + image))\n    resized_image = cv2.resize(loaded_image, TARGET_SHAPE , interpolation =INTERPOLATION)\n    cv2.imwrite(str(TARGET_TEST  + image) , resized_image)\nprint(\"Test Images done!!! \")\n\n\nsource = [\n    \"../input/ultra-mnist/sample_submission.csv\",\n    \"../input/ultra-mnist/train.csv\",\n]\ndestination = \"./\"\nfor files in source:\n    shutil.copy2(files,destination)\nprint(\"DONE!!! \")","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-03-15T17:31:38.049844Z","iopub.execute_input":"2022-03-15T17:31:38.050198Z","iopub.status.idle":"2022-03-15T17:31:54.859711Z","shell.execute_reply.started":"2022-03-15T17:31:38.050108Z","shell.execute_reply":"2022-03-15T17:31:54.858467Z"},"trusted":true},"execution_count":null,"outputs":[]}]}