{"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 time\nimport numpy as np \nimport matplotlib.pyplot as plt\nfrom IPython import display","metadata":{"execution":{"iopub.status.busy":"2023-05-28T15:27:21.662387Z","iopub.execute_input":"2023-05-28T15:27:21.663343Z","iopub.status.idle":"2023-05-28T15:27:21.66922Z","shell.execute_reply.started":"2023-05-28T15:27:21.66331Z","shell.execute_reply":"2023-05-28T15:27:21.668406Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Visualization","metadata":{}},{"cell_type":"code","source":"def get_ids(tar_path):\n    ids = []\n    for img_id in os.listdir(tar_path):\n        ids.append(img_id)\n    print(f\"{len(ids)} samples in {tar_path}\")\n    return ids\n\ntar_path = \"/kaggle/input/google-research-identify-contrails-reduce-global-warming/train\"\nids = get_ids(tar_path)","metadata":{"execution":{"iopub.status.busy":"2023-05-28T15:27:21.67133Z","iopub.execute_input":"2023-05-28T15:27:21.673576Z","iopub.status.idle":"2023-05-28T15:27:21.6995Z","shell.execute_reply.started":"2023-05-28T15:27:21.673537Z","shell.execute_reply":"2023-05-28T15:27:21.698659Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for img_id in ids[:500]:\n    sample_path = f\"{tar_path}/{img_id}\"\n    gt = np.load(f\"{sample_path}/human_pixel_masks.npy\")\n    if np.all(gt == 0):\n        continue\n    print(img_id)\n    label = np.load(f\"{sample_path}/human_individual_masks.npy\")\n    k = label.shape[-1]\n    label = np.sum(label, axis=-1)\n    label = label / k\n    plt.figure(figsize=(6, 3))\n    ax = plt.subplot(1, 2, 1)\n    ax.imshow(gt, interpolation='none')\n    ax.set_title('GT')\n    ax = plt.subplot(1, 2, 2)\n    ax.imshow(label, interpolation='none')\n    ax.set_title('Lables')\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-28T15:27:21.768153Z","iopub.execute_input":"2023-05-28T15:27:21.768908Z"},"trusted":true},"execution_count":null,"outputs":[]}]}