{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.11.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":117682,"databundleVersionId":15062069,"sourceType":"competition"}],"dockerImageVersionId":31239,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\nimport numpy as np\nfrom PIL import Image","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2025-12-24T01:03:49.030951Z","iopub.execute_input":"2025-12-24T01:03:49.031266Z","iopub.status.idle":"2025-12-24T01:03:49.036851Z","shell.execute_reply.started":"2025-12-24T01:03:49.031244Z","shell.execute_reply":"2025-12-24T01:03:49.035656Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"TRAIN_LABEL_PREFIX = '/kaggle/input/vesuvius-challenge-surface-detection/train_labels/'\nDEPRECATED_TRAIN_LABEL_PREFIX = '/kaggle/input/vesuvius-challenge-surface-detection/deprecated_train_labels/'\n\ndef get_image_paths(prefix):\n    return [prefix + file for file in os.listdir(prefix)]\n    \ndef get_image_array(path):\n    img = Image.open(path)\n    return np.asarray(img)\n\ndef is_labeled(path):\n    img_array = get_image_array(path)\n    label_values = np.unique(img_array)\n    if len(label_values)==1 and label_values[0]==2:\n        # If there is only 1 unique value and that value is 2, the image is \"not labeled\"\n        return False\n    return True\n\ndef get_suffix(path):\n    # We don't want to print the full paths, just the last part - the file name\n    return path.split('/')[-1]\n\ndef find_labels(prefix):\n    paths = get_image_paths(prefix)\n    return [get_suffix(path) for path in paths if is_labeled(path)]","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-24T01:00:23.730431Z","iopub.execute_input":"2025-12-24T01:00:23.730834Z","iopub.status.idle":"2025-12-24T01:00:23.739107Z","shell.execute_reply.started":"2025-12-24T01:00:23.730797Z","shell.execute_reply":"2025-12-24T01:00:23.738016Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"find_labels(TRAIN_LABEL_PREFIX)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-24T01:00:27.912201Z","iopub.execute_input":"2025-12-24T01:00:27.912603Z","iopub.status.idle":"2025-12-24T01:00:30.753900Z","shell.execute_reply.started":"2025-12-24T01:00:27.912563Z","shell.execute_reply":"2025-12-24T01:00:30.752943Z"}},"outputs":[],"execution_count":null},{"cell_type":"code","source":"find_labels(DEPRECATED_TRAIN_LABEL_PREFIX)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2025-12-24T01:00:59.612421Z","iopub.execute_input":"2025-12-24T01:00:59.613142Z","iopub.status.idle":"2025-12-24T01:00:59.705485Z","shell.execute_reply.started":"2025-12-24T01:00:59.613115Z","shell.execute_reply":"2025-12-24T01:00:59.704523Z"}},"outputs":[],"execution_count":null}]}