{"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 numpy as np\nimport pandas as pd\n\nimport matplotlib.pyplot as plt\nfrom pathlib import Path\n\nimport os\nfrom tqdm.notebook import tqdm\nfrom pathlib import Path","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-07-20T06:59:37.166622Z","iopub.execute_input":"2023-07-20T06:59:37.166984Z","iopub.status.idle":"2023-07-20T06:59:37.173325Z","shell.execute_reply.started":"2023-07-20T06:59:37.166954Z","shell.execute_reply":"2023-07-20T06:59:37.171755Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"data_path = Path('/kaggle/input/google-research-identify-contrails-reduce-global-warming')\ndata_path\n","metadata":{"execution":{"iopub.status.busy":"2023-07-20T06:59:38.799973Z","iopub.execute_input":"2023-07-20T06:59:38.800373Z","iopub.status.idle":"2023-07-20T06:59:38.807986Z","shell.execute_reply.started":"2023-07-20T06:59:38.800341Z","shell.execute_reply":"2023-07-20T06:59:38.806439Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_recs = os.listdir(data_path / 'test')\nprint(test_recs)","metadata":{"execution":{"iopub.status.busy":"2023-07-20T06:59:39.501396Z","iopub.execute_input":"2023-07-20T06:59:39.502155Z","iopub.status.idle":"2023-07-20T06:59:39.511929Z","shell.execute_reply.started":"2023-07-20T06:59:39.502115Z","shell.execute_reply":"2023-07-20T06:59:39.51058Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"n = 1000\nband_08 = np.load(data_path / 'test' / test_recs[0] / 'band_08.npy').sum(axis=2)\npreds = np.unravel_index(np.argpartition(band_08.ravel(), -n)[-n:], band_08.shape)\nmask = np.zeros((256, 266))\nmask[preds[0], preds[1]] = 1\n\nplt.imshow(mask, cmap='Greys')\nplt.title(\"Obviously Not Contrails\", fontsize='16')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-07-20T06:59:40.268878Z","iopub.execute_input":"2023-07-20T06:59:40.270121Z","iopub.status.idle":"2023-07-20T06:59:40.496933Z","shell.execute_reply.started":"2023-07-20T06:59:40.270082Z","shell.execute_reply":"2023-07-20T06:59:40.495332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission = pd.read_csv(data_path / 'sample_submission.csv', index_col='record_id')","metadata":{"execution":{"iopub.status.busy":"2023-07-20T06:59:44.774701Z","iopub.execute_input":"2023-07-20T06:59:44.77511Z","iopub.status.idle":"2023-07-20T06:59:44.806516Z","shell.execute_reply.started":"2023-07-20T06:59:44.775078Z","shell.execute_reply":"2023-07-20T06:59:44.804855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"submission.head()","metadata":{"execution":{"iopub.status.busy":"2023-07-20T07:00:14.715945Z","iopub.execute_input":"2023-07-20T07:00:14.716376Z","iopub.status.idle":"2023-07-20T07:00:14.731671Z","shell.execute_reply.started":"2023-07-20T07:00:14.716345Z","shell.execute_reply":"2023-07-20T07:00:14.730649Z"},"trusted":true},"execution_count":null,"outputs":[]}]}