{"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 pandas as pd\nimport os","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-10-10T09:12:43.461041Z","iopub.execute_input":"2023-10-10T09:12:43.461544Z","iopub.status.idle":"2023-10-10T09:12:43.891355Z","shell.execute_reply.started":"2023-10-10T09:12:43.461373Z","shell.execute_reply":"2023-10-10T09:12:43.890533Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"/kaggle/input/UBC-OCEAN/train.csv\")","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-10T09:14:54.054069Z","iopub.execute_input":"2023-10-10T09:14:54.055383Z","iopub.status.idle":"2023-10-10T09:14:54.074261Z","shell.execute_reply.started":"2023-10-10T09:14:54.055338Z","shell.execute_reply":"2023-10-10T09:14:54.073549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def get_image_path(image_id:int):\n    if 4 <= image_id <= 15188:\n        path = \"/kaggle/input/ucbo-tiles-256-1\"\n    elif 15209 <= image_id <= 30515:\n        path = \"/kaggle/input/ucbo-tiles-256-2\"\n    elif 30539 <= image_id <= 38687:\n        path = \"/kaggle/input/ucbo-tiles-256-3\"\n    elif 38849 <= image_id <= 65300:\n        path = \"/kaggle/input/ucbo-tiles-256-4\"\n    elif 65371 <= image_id <= 65533:\n        path = \"/kaggle/input/ucbo-tiles-256-5\"\n    return os.path.join(path, \"256_\"+str(image_id))","metadata":{"execution":{"iopub.status.busy":"2023-10-10T09:20:30.995531Z","iopub.execute_input":"2023-10-10T09:20:30.995891Z","iopub.status.idle":"2023-10-10T09:20:31.002999Z","shell.execute_reply.started":"2023-10-10T09:20:30.995866Z","shell.execute_reply":"2023-10-10T09:20:31.00169Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['tile_path'] = train['image_id'].apply(lambda x: get_image_path(x))\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-10T09:21:51.952186Z","iopub.execute_input":"2023-10-10T09:21:51.952572Z","iopub.status.idle":"2023-10-10T09:21:51.966591Z","shell.execute_reply.started":"2023-10-10T09:21:51.952543Z","shell.execute_reply":"2023-10-10T09:21:51.965477Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train['total_tiles'] = train['tile_path'].apply(lambda x: len(os.listdir(x)))\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2023-10-10T09:22:51.416922Z","iopub.execute_input":"2023-10-10T09:22:51.417283Z","iopub.status.idle":"2023-10-10T09:24:13.159179Z","shell.execute_reply.started":"2023-10-10T09:22:51.417255Z","shell.execute_reply":"2023-10-10T09:24:13.15847Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nfrom PIL import Image\nimg = Image.open(\"/kaggle/input/ucbo-tiles-256-1/256_10077/10077_10240_15360.png\")\nplt.imshow(img)","metadata":{"execution":{"iopub.status.busy":"2023-10-10T09:26:05.52664Z","iopub.execute_input":"2023-10-10T09:26:05.527015Z","iopub.status.idle":"2023-10-10T09:26:05.905576Z","shell.execute_reply.started":"2023-10-10T09:26:05.526987Z","shell.execute_reply":"2023-10-10T09:26:05.904713Z"},"trusted":true},"execution_count":null,"outputs":[]}]}