{"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 cv2 \nimport os\nimport shutil\n\nTARGET_SHAPE = (256,256)\nINTERPOLATION = cv2.INTER_AREA\nINPUT_DIR = \"../input/h-and-m-personalized-fashion-recommendations/images/\"\nTARGET_DIR = \"images_256_256/\"\n\nfolders = os.listdir(INPUT_DIR)\nfor folder in folders:\n    images = os.listdir(str(INPUT_DIR + folder))\n    os.makedirs(str(TARGET_DIR  + folder) , exist_ok=True)\n    for image in images:\n        loaded_image = cv2.imread(str(INPUT_DIR + folder + \"/\" +  image))\n        resized_image = cv2.resize(loaded_image, TARGET_SHAPE , interpolation =INTERPOLATION)\n        cv2.imwrite(str(TARGET_DIR+ folder + \"/\" +  image) , resized_image)\n    print(\"FOLDER DONE - \", folder)\nprint(\"!CHECK! RESIZED IMAGE SHAPE - \",resized_image.shape)\n\nsource = [\n    \"../input/h-and-m-personalized-fashion-recommendations/articles.csv\",\n    \"../input/h-and-m-personalized-fashion-recommendations/customers.csv\",\n    \"../input/h-and-m-personalized-fashion-recommendations/sample_submission.csv\",\n    \"../input/h-and-m-personalized-fashion-recommendations/transactions_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","trusted":true},"execution_count":null,"outputs":[]}]}