{"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":"nvidiaTeslaT4","dataSources":[{"sourceId":45867,"databundleVersionId":6924515,"sourceType":"competition"},{"sourceId":154841691,"sourceType":"kernelVersion"}],"dockerImageVersionId":30627,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import os\n\nimport pandas as pd\nimport numpy as np\n\nimport seaborn as sns\nimport pickle\n\nimport matplotlib.pyplot as plt\n\n\nfrom keras.utils import set_random_seed\n\nimport tensorflow as tf\nimport keras_core as keras\nimport datetime","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","ExecuteTime":{"end_time":"2023-12-15T16:42:27.227043Z","start_time":"2023-12-15T16:42:27.222532700Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:27.960331Z","iopub.execute_input":"2024-02-04T11:45:27.96075Z","iopub.status.idle":"2024-02-04T11:45:27.967204Z","shell.execute_reply.started":"2024-02-04T11:45:27.960717Z","shell.execute_reply":"2024-02-04T11:45:27.965743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Reproducibility","metadata":{}},{"cell_type":"markdown","source":"# configuration","metadata":{}},{"cell_type":"code","source":"def set_reproducibility(seed=42):\n    np.random.seed(seed)\n    set_random_seed(seed)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:27.528311700Z","start_time":"2023-12-15T16:42:27.227043Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:27.968831Z","iopub.execute_input":"2024-02-04T11:45:27.96914Z","iopub.status.idle":"2024-02-04T11:45:27.995851Z","shell.execute_reply.started":"2024-02-04T11:45:27.969114Z","shell.execute_reply":"2024-02-04T11:45:27.994951Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"    \nSEED = 42\n\n#PATH\n#local    \n#ds_src = \"/mnt/f/kaggle/input/UBC-OCEAN/\"\n#dst_path = \"output/\"\n\n#kaggle\nds_src = \"/kaggle/input/UBC-OCEAN/\"\ndst_path = \"\"\n\n    \n# Training\ntrain_csv_path =        f\"{ds_src}train.csv\"\ntrain_thumbnail_paths = f\"{ds_src}train_thumbnails\"\ntrain_dir =             f\"{ds_src}train_images\"\nbatch_size = 20\nepochs = 35\n    \n# Test\ntest_csv_path =        f\"{ds_src}test.csv\"\ntest_thumbnail_paths = f\"{ds_src}test_thumbnails\"\ntest_dir =             f\"{ds_src}test_images\"\n    \n# Experiment\nexperiment_name = \"experiment_1\"\nexp_id = \"id1\"\nactivation_function = keras.activations.softmax\nloss_func = keras.losses.categorical_crossentropy\nmomentum = 0.9\nlr = 0.001\nimage_size = 400\n\ndate_str = datetime.datetime.now().strftime(\"%Y%m%d-%H%M%S\")\nlog_dir = f\"./logdir/{date_str}{experiment_name}_{str(exp_id)}\"\n\n# dictionnary \nid_to_name_dst = f\"{dst_path}id_to_name.pkl\"\n# model\nmodel_name = \"thumbnail-weighted_basic\"\nmodel_path = f\"{dst_path}{model_name}.weights.h5\"\n","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:27.759619300Z","start_time":"2023-12-15T16:42:27.530309900Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:27.997317Z","iopub.execute_input":"2024-02-04T11:45:27.99805Z","iopub.status.idle":"2024-02-04T11:45:28.006623Z","shell.execute_reply.started":"2024-02-04T11:45:27.998013Z","shell.execute_reply":"2024-02-04T11:45:28.005756Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\nset_reproducibility(SEED)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.062747700Z","start_time":"2023-12-15T16:42:27.761621300Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.009441Z","iopub.execute_input":"2024-02-04T11:45:28.010443Z","iopub.status.idle":"2024-02-04T11:45:28.020439Z","shell.execute_reply.started":"2024-02-04T11:45:28.010408Z","shell.execute_reply":"2024-02-04T11:45:28.019464Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# loading train data","metadata":{}},{"cell_type":"code","source":"train = pd.read_csv(train_csv_path)\ntrain.head()","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.295595400Z","start_time":"2023-12-15T16:42:28.066257800Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.022502Z","iopub.execute_input":"2024-02-04T11:45:28.022841Z","iopub.status.idle":"2024-02-04T11:45:28.041445Z","shell.execute_reply.started":"2024-02-04T11:45:28.022795Z","shell.execute_reply":"2024-02-04T11:45:28.040636Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# dataset pre processing\n","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv(train_csv_path)\n\n# Create the thumbnail df where is_tma == False\ndf = df[df[\"is_tma\"] == False]\n\n# Get basic statistics about the dataset\nnum_rows = df.shape[0]\nnum_unique_images = df['image_id'].nunique()\nnum_unique_labels = df['label'].nunique()\nunique_labels = df['label'].unique()\n\nprint(f\"{num_rows=}\")\nprint(f\"{num_unique_images=}\")\nprint(f\"{num_unique_labels=}\")\nprint(f\"{unique_labels=}\")\n\n# Plot the distribution of the target classes\nplt.figure(figsize=(10, 6))\nsns.countplot(data=df, x='label', order=df['label'].value_counts().index)\nplt.title('Distribution of Target Classes')\nplt.xlabel('Label')\nplt.ylabel('Count')\nplt.show()","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.607168Z","start_time":"2023-12-15T16:42:28.295595400Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.042589Z","iopub.execute_input":"2024-02-04T11:45:28.042908Z","iopub.status.idle":"2024-02-04T11:45:28.251698Z","shell.execute_reply.started":"2024-02-04T11:45:28.042881Z","shell.execute_reply":"2024-02-04T11:45:28.25067Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# encoder (for training only)","metadata":{}},{"cell_type":"markdown","source":" ### Perform one-hot encoding of the 'label' column and explicitly convert to integer type","metadata":{}},{"cell_type":"code","source":"df_one_hot = pd.get_dummies(df[\"label\"], prefix=\"label\").astype(int)\ndf_one_hot.head()","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.634930600Z","start_time":"2023-12-15T16:42:28.607168Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.253163Z","iopub.execute_input":"2024-02-04T11:45:28.253471Z","iopub.status.idle":"2024-02-04T11:45:28.267275Z","shell.execute_reply.started":"2024-02-04T11:45:28.253444Z","shell.execute_reply":"2024-02-04T11:45:28.266093Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Concatenate the original DataFrame with the one-hot encoded labels\n","metadata":{}},{"cell_type":"code","source":"train_df = pd.concat([df[\"image_id\"], df_one_hot], axis=1)\ntrain_df.head()    ","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.713104900Z","start_time":"2023-12-15T16:42:28.633426700Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.268429Z","iopub.execute_input":"2024-02-04T11:45:28.26875Z","iopub.status.idle":"2024-02-04T11:45:28.281317Z","shell.execute_reply.started":"2024-02-04T11:45:28.268725Z","shell.execute_reply":"2024-02-04T11:45:28.280259Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Get the thumbnail image paths","metadata":{}},{"cell_type":"code","source":"train_df[\"image_thumbnail_path\"] = train_df[\"image_id\"].apply(lambda x: f\"{train_thumbnail_paths}/{x}_thumbnail.png\")\ntrain_df.head()","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.713104900Z","start_time":"2023-12-15T16:42:28.652205900Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.282806Z","iopub.execute_input":"2024-02-04T11:45:28.283246Z","iopub.status.idle":"2024-02-04T11:45:28.299758Z","shell.execute_reply.started":"2024-02-04T11:45:28.2832Z","shell.execute_reply":"2024-02-04T11:45:28.298784Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### make a list with all png thumbnail path","metadata":{}},{"cell_type":"code","source":"image_thumbnail_paths = train_df[\"image_thumbnail_path\"].values\nprint(image_thumbnail_paths[:5])","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.713104900Z","start_time":"2023-12-15T16:42:28.672872100Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.303717Z","iopub.execute_input":"2024-02-04T11:45:28.304296Z","iopub.status.idle":"2024-02-04T11:45:28.3101Z","shell.execute_reply.started":"2024-02-04T11:45:28.304267Z","shell.execute_reply":"2024-02-04T11:45:28.309033Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"labels = train_df[[col for col in train_df.columns if col.startswith(\"label_\")]].values\nprint(labels[:5])","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.730794400Z","start_time":"2023-12-15T16:42:28.706597300Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.311259Z","iopub.execute_input":"2024-02-04T11:45:28.3116Z","iopub.status.idle":"2024-02-04T11:45:28.323702Z","shell.execute_reply.started":"2024-02-04T11:45:28.311572Z","shell.execute_reply":"2024-02-04T11:45:28.322855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"label_names = [col for col in train_df.columns if col.startswith(\"label_\")]\nprint(label_names)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.782430500Z","start_time":"2023-12-15T16:42:28.711106900Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.324783Z","iopub.execute_input":"2024-02-04T11:45:28.325074Z","iopub.status.idle":"2024-02-04T11:45:28.334348Z","shell.execute_reply.started":"2024-02-04T11:45:28.325051Z","shell.execute_reply":"2024-02-04T11:45:28.333192Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"name_to_id = {key.replace(\"label_\", \"\"):value for value,key in enumerate(label_names)}\nprint(name_to_id)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.784933400Z","start_time":"2023-12-15T16:42:28.727795100Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.335447Z","iopub.execute_input":"2024-02-04T11:45:28.33572Z","iopub.status.idle":"2024-02-04T11:45:28.34408Z","shell.execute_reply.started":"2024-02-04T11:45:28.335696Z","shell.execute_reply":"2024-02-04T11:45:28.343048Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"id_to_name = {key:value for value, key in name_to_id.items()}\nprint(id_to_name)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.827119400Z","start_time":"2023-12-15T16:42:28.756884100Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.345134Z","iopub.execute_input":"2024-02-04T11:45:28.3455Z","iopub.status.idle":"2024-02-04T11:45:28.354275Z","shell.execute_reply.started":"2024-02-04T11:45:28.345473Z","shell.execute_reply":"2024-02-04T11:45:28.352619Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"     # Save to dictionary to disk\nwith open(id_to_name_dst, \"wb\") as f:\n    pickle.dump(id_to_name, f)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.829114200Z","start_time":"2023-12-15T16:42:28.760887400Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.355687Z","iopub.execute_input":"2024-02-04T11:45:28.35615Z","iopub.status.idle":"2024-02-04T11:45:28.362578Z","shell.execute_reply.started":"2024-02-04T11:45:28.356121Z","shell.execute_reply":"2024-02-04T11:45:28.361532Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Création des poids d'apprentissage","metadata":{}},{"cell_type":"code","source":"class_weights = np.sum(labels) - np.sum(labels, axis=0)\nclass_weights = class_weights / np.sum(class_weights) # Normalize the weights\n\nclass_weights = {idx:weight for idx, weight in enumerate(class_weights)}\n\nfor idx, weight in class_weights.items():\n    print(f\"{id_to_name[idx]}: {weight:0.2f}\")","metadata":{"collapsed":false,"ExecuteTime":{"end_time":"2023-12-15T16:42:28.903336300Z","start_time":"2023-12-15T16:42:28.784933400Z"},"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.363801Z","iopub.execute_input":"2024-02-04T11:45:28.364145Z","iopub.status.idle":"2024-02-04T11:45:28.373152Z","shell.execute_reply.started":"2024-02-04T11:45:28.364115Z","shell.execute_reply":"2024-02-04T11:45:28.372008Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"    # dataset pipeline","metadata":{}},{"cell_type":"code","source":"def read_image(path):\n    file = tf.io.read_file(path)\n    image = tf.io.decode_png(file, 3)\n    image = tf.image.resize(image, (image_size, image_size))\n    image = tf.image.per_image_standardization(image)\n    return image","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.903336300Z","start_time":"2023-12-15T16:42:28.827119400Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.37443Z","iopub.execute_input":"2024-02-04T11:45:28.374705Z","iopub.status.idle":"2024-02-04T11:45:28.381857Z","shell.execute_reply.started":"2024-02-04T11:45:28.374681Z","shell.execute_reply":"2024-02-04T11:45:28.380796Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"x = (\n    tf.data.Dataset.from_tensor_slices(image_thumbnail_paths)\n    .map(read_image, num_parallel_calls=tf.data.AUTOTUNE)\n)\ny = tf.data.Dataset.from_tensor_slices(labels)\n\n# Zip the x and y together\nds = tf.data.Dataset.zip((x, y))\n\n# Create the training and validation splits\nval_ds = (\n    ds\n    .take(50)\n    .batch(batch_size)\n    .prefetch(tf.data.AUTOTUNE)\n)\ntrain_ds = (\n    ds\n    .skip(50)\n    .shuffle(batch_size * 10)\n    .batch(batch_size)\n    .prefetch(tf.data.AUTOTUNE)\n)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.994888600Z","start_time":"2023-12-15T16:42:28.830115700Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.383106Z","iopub.execute_input":"2024-02-04T11:45:28.383471Z","iopub.status.idle":"2024-02-04T11:45:28.504942Z","shell.execute_reply.started":"2024-02-04T11:45:28.383443Z","shell.execute_reply":"2024-02-04T11:45:28.504021Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(train_ds.enumerate)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:28.994888600Z","start_time":"2023-12-15T16:42:28.900334500Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.506221Z","iopub.execute_input":"2024-02-04T11:45:28.506555Z","iopub.status.idle":"2024-02-04T11:45:28.512308Z","shell.execute_reply.started":"2024-02-04T11:45:28.506527Z","shell.execute_reply":"2024-02-04T11:45:28.511215Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# build the model","metadata":{}},{"cell_type":"code","source":"def create_model():\n    input_layer = keras.layers.Input(shape=(image_size, image_size, 3))\n\n    #input_tensor = keras.layers.RandomFlip(\"horizontal\")(input_tensor)\n    #augmented_input = keras.layers.RandomRotation(0.15)(augmented_input)\n    \n       \n    last_tensor = keras.layers.Conv2D(64, (7, 7), strides=(2, 2), padding='same',\n                                      activation=keras.activations.relu)(input_layer)\n\n    last_tensor = keras.layers.MaxPooling2D()(last_tensor)\n\n    for _ in range(3):\n        hidden_tensor_1 = keras.layers.Conv2D(64, (3, 3), padding='same',\n                                              activation=keras.activations.relu)(last_tensor)\n        hidden_tensor_1 = keras.layers.Conv2D(64, (3, 3), padding='same',\n                                              activation=keras.activations.relu)(hidden_tensor_1)\n        last_tensor = keras.layers.Add()([last_tensor, hidden_tensor_1])\n\n    for i in range(4):\n        hidden_tensor_1 = keras.layers.Conv2D(128, (3, 3), padding='same',\n                                              strides=((2, 2) if i == 0 else (1, 1)),\n                                              activation=keras.activations.relu)(last_tensor)\n        hidden_tensor_1 = keras.layers.Conv2D(128, (3, 3), padding='same',\n                                              activation=keras.activations.relu)(hidden_tensor_1)\n\n        if i == 0:\n            last_tensor = keras.layers.MaxPooling2D()(last_tensor)\n            last_tensor = keras.layers.Dense(128, activation=keras.activations.linear)(last_tensor)\n\n        last_tensor = keras.layers.Add()([last_tensor, hidden_tensor_1])\n\n    for i in range(6):\n        hidden_tensor_1 = keras.layers.Conv2D(256, (3, 3), padding='same',\n                                              strides=((2, 2) if i == 0 else (1, 1)),\n                                              activation=keras.activations.relu)(last_tensor)\n        hidden_tensor_1 = keras.layers.Conv2D(256, (3, 3), padding='same',\n                                              activation=keras.activations.relu)(hidden_tensor_1)\n\n        if i == 0:\n            last_tensor = keras.layers.MaxPooling2D()(last_tensor)\n            last_tensor = keras.layers.Dense(256, activation=keras.activations.linear)(last_tensor)\n\n        last_tensor = keras.layers.Add()([last_tensor, hidden_tensor_1])\n\n    for i in range(3):\n        hidden_tensor_1 = keras.layers.Conv2D(512, (3, 3), padding='valid' if i == 0 else \"same\",\n                                              strides=((2, 2) if i == 0 else (1, 1)),\n                                              activation=keras.activations.relu)(last_tensor)\n\n        hidden_tensor_1 = keras.layers.Conv2D(512, (3, 3), padding='same',\n                                              activation=keras.activations.relu)(hidden_tensor_1)\n\n        if i == 0:\n            last_tensor = keras.layers.MaxPooling2D()(last_tensor)\n            last_tensor = keras.layers.Dense(512, activation=keras.activations.linear)(last_tensor)\n\n        last_tensor = keras.layers.Add()([last_tensor, hidden_tensor_1])\n    \n    flattened_input_tensor = keras.layers.Flatten()(last_tensor)\n    output_tensor = keras.layers.Dense(5, activation=keras.activations.softmax)(flattened_input_tensor)\n    \n    model = keras.models.Model(inputs=[input_layer], outputs=[output_tensor])\n    \n    model.compile(\n        loss=loss_func,\n        optimizer= 'adam',\n        metrics=['accuracy'],\n        )\n    return model","metadata":{"execution":{"iopub.status.busy":"2024-02-04T11:45:28.51389Z","iopub.execute_input":"2024-02-04T11:45:28.514267Z","iopub.status.idle":"2024-02-04T11:45:28.536678Z","shell.execute_reply.started":"2024-02-04T11:45:28.514238Z","shell.execute_reply":"2024-02-04T11:45:28.535591Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = create_model()\n","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:29.003328Z","start_time":"2023-12-15T16:42:28.904839900Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.538133Z","iopub.execute_input":"2024-02-04T11:45:28.538487Z","iopub.status.idle":"2024-02-04T11:45:28.826828Z","shell.execute_reply.started":"2024-02-04T11:45:28.538455Z","shell.execute_reply":"2024-02-04T11:45:28.825877Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# training\n","metadata":{}},{"cell_type":"markdown","source":"model.summary()","metadata":{"execution":{"iopub.status.busy":"2023-12-11T11:49:05.61252Z","iopub.execute_input":"2023-12-11T11:49:05.613373Z","iopub.status.idle":"2023-12-11T11:49:05.64239Z","shell.execute_reply.started":"2023-12-11T11:49:05.613325Z","shell.execute_reply":"2023-12-11T11:49:05.641292Z"}}},{"cell_type":"code","source":"model.summary()","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:29.003328Z","start_time":"2023-12-15T16:42:28.953741300Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.828218Z","iopub.execute_input":"2024-02-04T11:45:28.82857Z","iopub.status.idle":"2024-02-04T11:45:28.934567Z","shell.execute_reply.started":"2024-02-04T11:45:28.82854Z","shell.execute_reply":"2024-02-04T11:45:28.933537Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:42:31.341274Z","start_time":"2023-12-15T16:42:28.968769400Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### callbacks","metadata":{}},{"cell_type":"code","source":"\n","metadata":{"collapsed":false,"ExecuteTime":{"end_time":"2023-12-15T16:42:31.346297200Z","start_time":"2023-12-15T16:42:31.340273600Z"},"jupyter":{"outputs_hidden":false},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.fit(\n    train_ds,\n    epochs=epochs,\n    validation_data=val_ds,\n    class_weight= class_weights\n)\n\nmodel.save_weights(model_path)","metadata":{"ExecuteTime":{"end_time":"2023-12-15T16:43:14.740803300Z","start_time":"2023-12-15T16:42:31.345292100Z"},"execution":{"iopub.status.busy":"2024-02-04T11:45:28.935785Z","iopub.execute_input":"2024-02-04T11:45:28.93614Z","iopub.status.idle":"2024-02-04T12:05:18.569248Z","shell.execute_reply.started":"2024-02-04T11:45:28.936113Z","shell.execute_reply":"2024-02-04T12:05:18.568291Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(\"end\")","metadata":{"execution":{"iopub.status.busy":"2024-02-04T12:05:18.57087Z","iopub.execute_input":"2024-02-04T12:05:18.5713Z","iopub.status.idle":"2024-02-04T12:05:18.577481Z","shell.execute_reply.started":"2024-02-04T12:05:18.57125Z","shell.execute_reply":"2024-02-04T12:05:18.576219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}