{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"gpu","dataSources":[{"sourceId":45867,"databundleVersionId":6924515,"sourceType":"competition"}],"dockerImageVersionId":30558,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n        break","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-11-28T09:18:57.968603Z","iopub.execute_input":"2023-11-28T09:18:57.969581Z","iopub.status.idle":"2023-11-28T09:18:57.980138Z","shell.execute_reply.started":"2023-11-28T09:18:57.96954Z","shell.execute_reply":"2023-11-28T09:18:57.97906Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import os\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport seaborn as sns\nfrom sklearn.metrics import classification_report , confusion_matrix , accuracy_score , auc\nfrom sklearn.model_selection import train_test_split\n\nimport cv2\n#from google.colab.patches import cv2_imshow\nfrom PIL import Image \nimport tensorflow as tf\nfrom tensorflow import keras\nfrom keras import Sequential\nfrom keras.layers import Input, Dense,Conv2D , MaxPooling2D, Flatten,BatchNormalization,Dropout\nfrom tensorflow.keras.preprocessing import image_dataset_from_directory\nimport tensorflow_hub as hub ","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:57.982287Z","iopub.execute_input":"2023-11-28T09:18:57.982931Z","iopub.status.idle":"2023-11-28T09:18:57.992232Z","shell.execute_reply.started":"2023-11-28T09:18:57.98288Z","shell.execute_reply":"2023-11-28T09:18:57.991232Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df = pd.read_csv(\"/kaggle/input/UBC-OCEAN/train.csv\")\ntrain_df","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:57.993377Z","iopub.execute_input":"2023-11-28T09:18:57.993651Z","iopub.status.idle":"2023-11-28T09:18:58.018774Z","shell.execute_reply.started":"2023-11-28T09:18:57.993627Z","shell.execute_reply":"2023-11-28T09:18:58.018054Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.nunique()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.019692Z","iopub.execute_input":"2023-11-28T09:18:58.019941Z","iopub.status.idle":"2023-11-28T09:18:58.027954Z","shell.execute_reply.started":"2023-11-28T09:18:58.019918Z","shell.execute_reply":"2023-11-28T09:18:58.026986Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df['label'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.03067Z","iopub.execute_input":"2023-11-28T09:18:58.031165Z","iopub.status.idle":"2023-11-28T09:18:58.040132Z","shell.execute_reply.started":"2023-11-28T09:18:58.031139Z","shell.execute_reply":"2023-11-28T09:18:58.039373Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(data=train_df, x=\"label\")\nplt.title(\"Ovarian Cancer Types Distributions\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.041228Z","iopub.execute_input":"2023-11-28T09:18:58.041514Z","iopub.status.idle":"2023-11-28T09:18:58.273393Z","shell.execute_reply.started":"2023-11-28T09:18:58.041465Z","shell.execute_reply":"2023-11-28T09:18:58.272479Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.head()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.274529Z","iopub.execute_input":"2023-11-28T09:18:58.274801Z","iopub.status.idle":"2023-11-28T09:18:58.285212Z","shell.execute_reply.started":"2023-11-28T09:18:58.274777Z","shell.execute_reply":"2023-11-28T09:18:58.284201Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.info()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.286549Z","iopub.execute_input":"2023-11-28T09:18:58.286863Z","iopub.status.idle":"2023-11-28T09:18:58.301168Z","shell.execute_reply.started":"2023-11-28T09:18:58.286838Z","shell.execute_reply":"2023-11-28T09:18:58.300331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.subplot(1,2,1)\ntrain_df[['image_width']].boxplot()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.302156Z","iopub.execute_input":"2023-11-28T09:18:58.302412Z","iopub.status.idle":"2023-11-28T09:18:58.443535Z","shell.execute_reply.started":"2023-11-28T09:18:58.302388Z","shell.execute_reply":"2023-11-28T09:18:58.442549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_train = \"/kaggle/input/UBC-OCEAN/train_images\"\npath_test = \"/kaggle/input/UBC-OCEAN/test_images\"\ntrain_folder = os.listdir(path_train)\ntest_folder = os.listdir(path_test)\n\nprint(len(train_folder))\nprint(len(test_folder))","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.444621Z","iopub.execute_input":"2023-11-28T09:18:58.445598Z","iopub.status.idle":"2023-11-28T09:18:58.45239Z","shell.execute_reply.started":"2023-11-28T09:18:58.445562Z","shell.execute_reply":"2023-11-28T09:18:58.451521Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_folder[:5]","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.456445Z","iopub.execute_input":"2023-11-28T09:18:58.45673Z","iopub.status.idle":"2023-11-28T09:18:58.462856Z","shell.execute_reply.started":"2023-11-28T09:18:58.456707Z","shell.execute_reply":"2023-11-28T09:18:58.462018Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_folder","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.464143Z","iopub.execute_input":"2023-11-28T09:18:58.464642Z","iopub.status.idle":"2023-11-28T09:18:58.474239Z","shell.execute_reply.started":"2023-11-28T09:18:58.464609Z","shell.execute_reply":"2023-11-28T09:18:58.473446Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Images in small size\npath_train_copy = \"/kaggle/input/UBC-OCEAN/train_thumbnails\"\npath_test_copy = \"/kaggle/input/UBC-OCEAN/test_thumbnails\"\ntrain_folder_copy = os.listdir(path_train_copy)\ntest_folder_copy = os.listdir(path_test_copy)\n\nprint(len(train_folder_copy))\nprint(len(test_folder_copy))","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.475271Z","iopub.execute_input":"2023-11-28T09:18:58.476202Z","iopub.status.idle":"2023-11-28T09:18:58.484849Z","shell.execute_reply.started":"2023-11-28T09:18:58.476169Z","shell.execute_reply":"2023-11-28T09:18:58.483971Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.486Z","iopub.execute_input":"2023-11-28T09:18:58.486307Z","iopub.status.idle":"2023-11-28T09:18:58.501937Z","shell.execute_reply.started":"2023-11-28T09:18:58.486257Z","shell.execute_reply":"2023-11-28T09:18:58.501099Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df.describe()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.502962Z","iopub.execute_input":"2023-11-28T09:18:58.503272Z","iopub.status.idle":"2023-11-28T09:18:58.525181Z","shell.execute_reply.started":"2023-11-28T09:18:58.503248Z","shell.execute_reply":"2023-11-28T09:18:58.524312Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Image id >> Tissue Microarray\ntrain_df_tma = train_df[train_df['is_tma']==True]\ntrain_df_tma","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.526202Z","iopub.execute_input":"2023-11-28T09:18:58.52648Z","iopub.status.idle":"2023-11-28T09:18:58.539438Z","shell.execute_reply.started":"2023-11-28T09:18:58.526455Z","shell.execute_reply":"2023-11-28T09:18:58.538538Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df_no_tma = train_df[train_df['is_tma']==False]\ntrain_df_no_tma","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.540534Z","iopub.execute_input":"2023-11-28T09:18:58.541022Z","iopub.status.idle":"2023-11-28T09:18:58.556921Z","shell.execute_reply.started":"2023-11-28T09:18:58.540991Z","shell.execute_reply":"2023-11-28T09:18:58.556042Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df_no_tma['image_id_path'] = [f\"{i}_thumbnail.png\" for i in train_df_no_tma['image_id']]","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.558134Z","iopub.execute_input":"2023-11-28T09:18:58.558648Z","iopub.status.idle":"2023-11-28T09:18:58.566525Z","shell.execute_reply.started":"2023-11-28T09:18:58.558613Z","shell.execute_reply":"2023-11-28T09:18:58.565678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df_no_tma","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.567597Z","iopub.execute_input":"2023-11-28T09:18:58.568259Z","iopub.status.idle":"2023-11-28T09:18:58.584436Z","shell.execute_reply.started":"2023-11-28T09:18:58.568225Z","shell.execute_reply":"2023-11-28T09:18:58.583543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df_tma['image_id_path'] = [f\"{i}.png\" for i in train_df_tma['image_id']]","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.585547Z","iopub.execute_input":"2023-11-28T09:18:58.585828Z","iopub.status.idle":"2023-11-28T09:18:58.593766Z","shell.execute_reply.started":"2023-11-28T09:18:58.585804Z","shell.execute_reply":"2023-11-28T09:18:58.59304Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_df_tma","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.594776Z","iopub.execute_input":"2023-11-28T09:18:58.595051Z","iopub.status.idle":"2023-11-28T09:18:58.611929Z","shell.execute_reply.started":"2023-11-28T09:18:58.595022Z","shell.execute_reply":"2023-11-28T09:18:58.611072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"## Train Images data Preprocessing","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.613029Z","iopub.execute_input":"2023-11-28T09:18:58.613306Z","iopub.status.idle":"2023-11-28T09:18:58.620467Z","shell.execute_reply.started":"2023-11-28T09:18:58.613281Z","shell.execute_reply":"2023-11-28T09:18:58.619704Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_folder[:5] ","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.621486Z","iopub.execute_input":"2023-11-28T09:18:58.62177Z","iopub.status.idle":"2023-11-28T09:18:58.632582Z","shell.execute_reply.started":"2023-11-28T09:18:58.621747Z","shell.execute_reply":"2023-11-28T09:18:58.631732Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(16,24))\npath = \"/kaggle/input/UBC-OCEAN/train_thumbnails\"\nj=1\nfor img, lb in zip(train_df_no_tma['image_id_path'][:24],train_df_no_tma['label'][:24]):\n    plt.subplot(6,4,j)\n    path = os.path.join(\"/kaggle/input/UBC-OCEAN/train_thumbnails/\",img)\n    image = plt.imread(path)\n    image = plt.imshow(image)\n    plt.title(f\"Label:{lb}\")\n    j+=1","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:18:58.633674Z","iopub.execute_input":"2023-11-28T09:18:58.633908Z","iopub.status.idle":"2023-11-28T09:19:40.23611Z","shell.execute_reply.started":"2023-11-28T09:18:58.633887Z","shell.execute_reply":"2023-11-28T09:19:40.235014Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train_df['image_width'].min())\nprint(train_df['image_width'].max())\nprint(train_df['image_width'].mean())\nprint()\nprint(train_df['image_height'].min())\nprint(train_df['image_height'].max())\nprint(train_df['image_height'].mean())","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:19:40.237534Z","iopub.execute_input":"2023-11-28T09:19:40.237864Z","iopub.status.idle":"2023-11-28T09:19:40.246446Z","shell.execute_reply.started":"2023-11-28T09:19:40.237834Z","shell.execute_reply":"2023-11-28T09:19:40.245135Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_data = []\nimage_label = []\npath = \"/kaggle/input/UBC-OCEAN/train_thumbnails\"\npath1=\"/kaggle/input/UBC-OCEAN/train_images/\"\nfor img , label in zip(train_df_no_tma['image_id_path'],train_df_no_tma['label']):\n    image = Image.open(\"/kaggle/input/UBC-OCEAN/train_thumbnails/\"+img)\n    image = image.resize((224,224))\n    image = image.convert(\"RGB\")\n    image = np.array(image)\n    image_data.append(image)\n    image_label.append(label)\n\nfor img , label in zip(train_df_tma['image_id_path'],train_df_tma['label']):\n    image = Image.open(\"/kaggle/input/UBC-OCEAN/train_images/\"+img)\n    image = image.resize((224,224))\n    image = image.convert(\"RGB\")\n    image = np.array(image)\n    image_data.append(image)\n    image_label.append(label)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:19:40.247908Z","iopub.execute_input":"2023-11-28T09:19:40.248227Z","iopub.status.idle":"2023-11-28T09:21:41.524161Z","shell.execute_reply.started":"2023-11-28T09:19:40.248196Z","shell.execute_reply":"2023-11-28T09:21:41.523299Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(len(image_data))\nprint(len(image_label))","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.529707Z","iopub.execute_input":"2023-11-28T09:21:41.53021Z","iopub.status.idle":"2023-11-28T09:21:41.534725Z","shell.execute_reply.started":"2023-11-28T09:21:41.530181Z","shell.execute_reply":"2023-11-28T09:21:41.533854Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"set(image_label)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.536018Z","iopub.execute_input":"2023-11-28T09:21:41.536444Z","iopub.status.idle":"2023-11-28T09:21:41.548206Z","shell.execute_reply.started":"2023-11-28T09:21:41.536409Z","shell.execute_reply":"2023-11-28T09:21:41.547303Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_label_1 = []\nfor i in image_label:\n    if i==\"CC\":\n        image_label_1.append(0)\n    elif i==\"EC\":\n        image_label_1.append(1)\n    elif i==\"HGSC\":\n        image_label_1.append(2)\n    elif i==\"LGSC\":\n        image_label_1.append(3)\n    elif i==\"MC\":\n        image_label_1.append(4)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.549588Z","iopub.execute_input":"2023-11-28T09:21:41.549851Z","iopub.status.idle":"2023-11-28T09:21:41.558582Z","shell.execute_reply.started":"2023-11-28T09:21:41.549826Z","shell.execute_reply":"2023-11-28T09:21:41.557863Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(image_label_1)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.559554Z","iopub.execute_input":"2023-11-28T09:21:41.559829Z","iopub.status.idle":"2023-11-28T09:21:41.570372Z","shell.execute_reply.started":"2023-11-28T09:21:41.559805Z","shell.execute_reply":"2023-11-28T09:21:41.569541Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"image_label_1[:5]","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.571582Z","iopub.execute_input":"2023-11-28T09:21:41.571982Z","iopub.status.idle":"2023-11-28T09:21:41.581843Z","shell.execute_reply.started":"2023-11-28T09:21:41.571947Z","shell.execute_reply":"2023-11-28T09:21:41.581067Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x = np.array(image_data)\ny = np.array(image_label_1)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.582901Z","iopub.execute_input":"2023-11-28T09:21:41.583159Z","iopub.status.idle":"2023-11-28T09:21:41.61811Z","shell.execute_reply.started":"2023-11-28T09:21:41.583136Z","shell.execute_reply":"2023-11-28T09:21:41.617115Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train , x_test, y_train, y_test = train_test_split(x,y,test_size=0.15,shuffle=True)\nprint(x_train.shape)\nprint(x_test.shape)\nprint(y_train.shape)\nprint(y_test.shape)\n(457, 224, 224, 3)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.619281Z","iopub.execute_input":"2023-11-28T09:21:41.619608Z","iopub.status.idle":"2023-11-28T09:21:41.651425Z","shell.execute_reply.started":"2023-11-28T09:21:41.619581Z","shell.execute_reply":"2023-11-28T09:21:41.650535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,16))\nclass_labels = ['CC', 'EC', 'HGSC', 'LGSC', 'MC']\nfor i in range(12):\n    plt.subplot(4,3,i+1)\n    plt.imshow(x_train[i])\n    plt.title(f\"Label:{class_labels[y_train[i]]}\")","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:41.652644Z","iopub.execute_input":"2023-11-28T09:21:41.652925Z","iopub.status.idle":"2023-11-28T09:21:44.699145Z","shell.execute_reply.started":"2023-11-28T09:21:41.6529Z","shell.execute_reply":"2023-11-28T09:21:44.698381Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x_train_scaled = x_train/255\nx_test_scaled = x_test/255","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:44.700586Z","iopub.execute_input":"2023-11-28T09:21:44.700916Z","iopub.status.idle":"2023-11-28T09:21:44.906568Z","shell.execute_reply.started":"2023-11-28T09:21:44.700886Z","shell.execute_reply":"2023-11-28T09:21:44.905721Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = Sequential()\nmodel.add(Conv2D(filters=120,kernel_size=(3,3),strides=(1,1),activation='relu',input_shape=(224,224,3)))\nmodel.add(MaxPooling2D(pool_size=(2,2)))\n\nmodel.add(Conv2D(filters=100,kernel_size=(3,3),strides=(1,1),activation='relu'))\nmodel.add(MaxPooling2D(pool_size=(2,2)))\n\nmodel.add(Conv2D(filters=80,kernel_size=(3,3),strides=(1,1),activation='relu'))\nmodel.add(MaxPooling2D(pool_size=(2,2)))\n\nmodel.add(Conv2D(filters=64,kernel_size=(3,3),strides=(1,1),activation='relu',input_shape=(224,224,3)))\nmodel.add(MaxPooling2D(pool_size=(2,2)))\n\nmodel.add(Flatten())\nmodel.add(Dense(units=600,activation='relu'))\nmodel.add(Dropout(0.2))\nmodel.add(Dense(units=600,activation='relu'))\nmodel.add(Dropout(0.2))\nmodel.add(Dense(units=5,activation='softmax'))\n\nmodel.compile(optimizer=\"adam\",loss=\"sparse_categorical_crossentropy\",\n             metrics=[\"accuracy\"])\n\nmodel.summary()","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:44.90769Z","iopub.execute_input":"2023-11-28T09:21:44.907966Z","iopub.status.idle":"2023-11-28T09:21:45.058633Z","shell.execute_reply.started":"2023-11-28T09:21:44.90794Z","shell.execute_reply":"2023-11-28T09:21:45.057753Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"history = model.fit(x_train_scaled,y_train,epochs=1,\n         batch_size=1,validation_data=(x_test_scaled,y_test))","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:45.059871Z","iopub.execute_input":"2023-11-28T09:21:45.06014Z","iopub.status.idle":"2023-11-28T09:21:50.593417Z","shell.execute_reply.started":"2023-11-28T09:21:45.060115Z","shell.execute_reply":"2023-11-28T09:21:50.592442Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\n\n# Load the CSV file into a DataFrame\ntrain_df_tma = pd.read_csv(\"/kaggle/input/UBC-OCEAN/train.csv\")\n\n# Specify the file path where you want to write the selected columns\noutput_file = 'submission.csv'\n\n# Select the desired columns\nselected_columns = train_df_tma[['image_id', 'label']]\n\n# Write the selected columns to a CSV file\nselected_columns.to_csv(output_file, index=False)","metadata":{"execution":{"iopub.status.busy":"2023-11-28T09:21:50.596291Z","iopub.execute_input":"2023-11-28T09:21:50.596986Z","iopub.status.idle":"2023-11-28T09:21:50.607976Z","shell.execute_reply.started":"2023-11-28T09:21:50.596957Z","shell.execute_reply":"2023-11-28T09:21:50.607232Z"},"trusted":true},"execution_count":null,"outputs":[]}]}