{"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 shutil\nimport pandas as pd","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-09-07T01:14:38.644861Z","iopub.execute_input":"2022-09-07T01:14:38.645729Z","iopub.status.idle":"2022-09-07T01:14:38.651671Z","shell.execute_reply.started":"2022-09-07T01:14:38.645673Z","shell.execute_reply":"2022-09-07T01:14:38.650225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/mayo-clinic-strip-ai/train.csv')\ndf","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:14:40.763293Z","iopub.execute_input":"2022-09-07T01:14:40.764083Z","iopub.status.idle":"2022-09-07T01:14:40.815731Z","shell.execute_reply.started":"2022-09-07T01:14:40.764015Z","shell.execute_reply":"2022-09-07T01:14:40.8143Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!mkdir CE\n!mkdir LAA","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:14:41.22858Z","iopub.execute_input":"2022-09-07T01:14:41.229178Z","iopub.status.idle":"2022-09-07T01:14:43.662218Z","shell.execute_reply.started":"2022-09-07T01:14:41.229123Z","shell.execute_reply":"2022-09-07T01:14:43.660606Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"route = '../input/eda-mayo-ver1/Dataset-mayo/train'\nfor image_id in os.listdir(route):\n    image_path = route + '/' + image_id\n    cl = df[df['image_id']==image_id]['label'].values[0]\n    for img in os.listdir(image_path):\n        from_img = image_path + '/' + img\n        to_img = f'./{cl}/{img}'\n        shutil.copy(from_img, to_img)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:14:46.435961Z","iopub.execute_input":"2022-09-07T01:14:46.436541Z","iopub.status.idle":"2022-09-07T01:14:49.321619Z","shell.execute_reply.started":"2022-09-07T01:14:46.43649Z","shell.execute_reply":"2022-09-07T01:14:49.320122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"route = '../input/hellomayo/Dataset-mayo/train'\nfor image_id in os.listdir(route):\n    image_path = route + '/' + image_id\n    cl = df[df['image_id']==image_id]['label'].values[0]\n    for img in os.listdir(image_path):\n        from_img = image_path + '/' + img\n        to_img = f'./{cl}/{img}'\n        shutil.copy(from_img, to_img)","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:14:51.595322Z","iopub.execute_input":"2022-09-07T01:14:51.595795Z","iopub.status.idle":"2022-09-07T01:14:54.339199Z","shell.execute_reply.started":"2022-09-07T01:14:51.595755Z","shell.execute_reply":"2022-09-07T01:14:54.337717Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ls","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:17:16.622517Z","iopub.execute_input":"2022-09-07T01:17:16.623003Z","iopub.status.idle":"2022-09-07T01:17:17.772823Z","shell.execute_reply.started":"2022-09-07T01:17:16.622965Z","shell.execute_reply":"2022-09-07T01:17:17.771426Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def make_archive(source, destination):\n        base = os.path.basename(destination)\n        name = base.split('.')[0]\n        format = base.split('.')[1]\n        archive_from = os.path.dirname(source)\n        archive_to = os.path.basename(source.strip(os.sep))\n        shutil.make_archive(name, format, archive_from, archive_to)\n        shutil.move('%s.%s'%(name,format), destination)\n\nmake_archive('/kaggle/working', '/kaggle/working/dataset.zip')","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:16:33.262614Z","iopub.execute_input":"2022-09-07T01:16:33.264101Z","iopub.status.idle":"2022-09-07T01:16:34.068072Z","shell.execute_reply.started":"2022-09-07T01:16:33.264041Z","shell.execute_reply":"2022-09-07T01:16:34.066838Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"shutil.rmtree('/kaggle/working/CE')\nshutil.rmtree('/kaggle/working/LAA')","metadata":{"execution":{"iopub.status.busy":"2022-09-07T01:17:23.626819Z","iopub.execute_input":"2022-09-07T01:17:23.627302Z","iopub.status.idle":"2022-09-07T01:17:23.646193Z","shell.execute_reply.started":"2022-09-07T01:17:23.627261Z","shell.execute_reply":"2022-09-07T01:17:23.645225Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}