{"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":"# Just gets the shape pretty quick, nothing more!\n\nimport joblib\nimport os\nfrom skimage import io\nimport pandas as pd\nfrom joblib import Parallel, delayed","metadata":{"execution":{"iopub.status.busy":"2022-02-13T11:37:43.591871Z","iopub.execute_input":"2022-02-13T11:37:43.592570Z","iopub.status.idle":"2022-02-13T11:37:43.597281Z","shell.execute_reply.started":"2022-02-13T11:37:43.592517Z","shell.execute_reply":"2022-02-13T11:37:43.596433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npath = \"/kaggle/input/happy-whale-and-dolphin/\"\ndf = pd.read_csv(\"/kaggle/input/happy-whale-and-dolphin/train.csv\")\n\ndef process(i):\n    im = io.imread(path+'train_images/'+ df.iloc[i].image)\n    shape = list(im.shape)\n    return shape if len(shape) == 3 else shape+[1]\n    \ndf['shape'] = Parallel(n_jobs=4)(delayed(process)(i) for i in range(len(df)))\ndf[['d0','d1','d2']] = pd.DataFrame(df['shape'].to_list())\ndf.drop(columns='shape', inplace=True)\ndf.to_csv(\"/kaggle/working/train_extended.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2022-02-13T11:37:43.599037Z","iopub.execute_input":"2022-02-13T11:37:43.599511Z","iopub.status.idle":"2022-02-13T11:37:50.637379Z","shell.execute_reply.started":"2022-02-13T11:37:43.599476Z","shell.execute_reply":"2022-02-13T11:37:50.636536Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\npath = \"/kaggle/input/happy-whale-and-dolphin/\"\ndf = pd.read_csv(\"/kaggle/input/happy-whale-and-dolphin/sample_submission.csv\")\n\ndef process(i):\n    im = io.imread(path+'test_images/'+ df.iloc[i].image)\n    shape = list(im.shape)\n    return shape if len(shape) == 3 else shape+[1]\n    \ndf['shape'] = Parallel(n_jobs=4)(delayed(process)(i) for i in range(len(df)))\ndf[['d0','d1','d2']] = pd.DataFrame(df['shape'].to_list())\ndf.drop(columns='shape', inplace=True)\ndf.to_csv(\"/kaggle/working/sample_submission_extended.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2022-02-13T11:37:50.638824Z","iopub.execute_input":"2022-02-13T11:37:50.639269Z","iopub.status.idle":"2022-02-13T11:37:54.320681Z","shell.execute_reply.started":"2022-02-13T11:37:50.639234Z","shell.execute_reply":"2022-02-13T11:37:54.319611Z"},"trusted":true},"execution_count":null,"outputs":[]}]}