{"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":"!pip install nb-black","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:16.101514Z","iopub.execute_input":"2023-05-01T14:20:16.101957Z","iopub.status.idle":"2023-05-01T14:20:30.851574Z","shell.execute_reply.started":"2023-05-01T14:20:16.101915Z","shell.execute_reply":"2023-05-01T14:20:30.850060Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from typing import Dict\nfrom pathlib import Path\nfrom types import SimpleNamespace\nfrom multiprocessing import Pool\nfrom functools import partial\n\nimport polars as pl\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\nfrom IPython.core.display import Video\nfrom tqdm import tqdm\n\nplt.style.use(\"ggplot\")\n\ncfg = SimpleNamespace()\ncfg.INPUT = Path(\"/kaggle/input/asl-signs\")\ncfg.OUTPUT = Path(\"/kaggle/working/animation\")\ncfg.DEBUG = True\n\n%load_ext lab_black\n%load_ext autoreload\n%autoreload 2","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:30.854858Z","iopub.execute_input":"2023-05-01T14:20:30.855653Z","iopub.status.idle":"2023-05-01T14:20:31.273828Z","shell.execute_reply.started":"2023-05-01T14:20:30.855605Z","shell.execute_reply":"2023-05-01T14:20:31.272559Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"LOADING THE DATASET IN CSV FROM KAGGLE PLATFORM","metadata":{}},{"cell_type":"code","source":"train = pl.read_csv(cfg.INPUT / \"train.csv\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:31.276462Z","iopub.execute_input":"2023-05-01T14:20:31.276845Z","iopub.status.idle":"2023-05-01T14:20:31.460979Z","shell.execute_reply.started":"2023-05-01T14:20:31.276811Z","shell.execute_reply":"2023-05-01T14:20:31.459739Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"CALCULATING THE SUM OF COLUMNS FROM THE DATASET","metadata":{}},{"cell_type":"code","source":"print(f\" No of unique participants: {len(train['participant_id'].unique())}\")\nprint(f\"No of unique sequences id: {len(train['sequence_id'].unique()):,}\")\nprint(f\"No of unique signs: {len(train['sign'].unique()):,}\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:31.465335Z","iopub.execute_input":"2023-05-01T14:20:31.466600Z","iopub.status.idle":"2023-05-01T14:20:31.591135Z","shell.execute_reply.started":"2023-05-01T14:20:31.466544Z","shell.execute_reply":"2023-05-01T14:20:31.589903Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"GRAPH TO VISUALISE THE CONTRIBUTION OF THE 21 UNIQUE PARTICIPANTS","metadata":{}},{"cell_type":"code","source":"sequence_per_participant = (\n    train.groupby(\"participant_id\")\n    .agg(pl.col(\"sequence_id\").unique().count())\n    .with_columns(pl.col(\"participant_id\").cast(str))\n)\n\n_, ax = plt.subplots()\nax.barh(\n    y=sequence_per_participant[\"participant_id\"],\n    width=sequence_per_participant[\"sequence_id\"],\n)\nax.set(\n    xlabel=\"#sequences\", ylabel=\"participant_id\", title=\"sequences id per participant\"\n)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:29:29.576037Z","iopub.execute_input":"2023-05-01T14:29:29.576494Z","iopub.status.idle":"2023-05-01T14:29:29.947747Z","shell.execute_reply.started":"2023-05-01T14:29:29.576449Z","shell.execute_reply":"2023-05-01T14:29:29.946461Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"DISTRIBUTION OF SIGNS AND THEIR COUNT","metadata":{}},{"cell_type":"code","source":"sequence_per_sign = (\n    train.groupby(\"sign\").agg(pl.col(\"sequence_id\").count()).sort(\"sequence_id\")\n)\n_, ax = plt.subplots()\nax.hist(sequence_per_sign[\"sequence_id\"], bins=20)\nax.set(xlabel=\"sign\", ylabel=\"count\", title=\"sequences per sign\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:32.024410Z","iopub.execute_input":"2023-05-01T14:20:32.024756Z","iopub.status.idle":"2023-05-01T14:20:32.344653Z","shell.execute_reply.started":"2023-05-01T14:20:32.024725Z","shell.execute_reply":"2023-05-01T14:20:32.343405Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"DEPLOYING PART OF CNN USING MATRIXES WITH PIXELS OF 0-20 TO FOCUS ON THE ANGLES OF THE HAND EACH PIXEL TELLS THE INTENSITY AT A POINT","metadata":{}},{"cell_type":"code","source":"edges = {\n    \"left_hand\": [\n        (0, 1),\n        (1, 2),\n        (2, 3),\n        (3, 4),\n        (0, 5),\n        (0, 17),\n        (5, 6),\n        (6, 7),\n        (7, 8),\n        (5, 9),\n        (9, 10),\n        (10, 11),\n        (11, 12),\n        (9, 13),\n        (13, 14),\n        (14, 15),\n        (15, 16),\n        (13, 17),\n        (17, 18),\n        (18, 19),\n        (19, 20),\n    ],\n    \"right_hand\": [\n        (0, 1),\n        (1, 2),\n        (2, 3),\n        (3, 4),\n        (0, 5),\n        (0, 17),\n        (5, 6),\n        (6, 7),\n        (7, 8),\n        (5, 9),\n        (9, 10),\n        (10, 11),\n        (11, 12),\n        (9, 13),\n        (13, 14),\n        (14, 15),\n        (15, 16),\n        (13, 17),\n        (17, 18),\n        (18, 19),\n        (19, 20),\n    ],\n    \"pose\": [\n        (8, 6),\n        (6, 5),\n        (6, 4),\n        (4, 0),\n        (0, 1),\n        (1, 2),\n        (2, 3),\n        (3, 7),\n        (10, 9),\n        (11, 12),\n        (11, 13),\n        (11, 23),\n        (13, 15),\n        (15, 21),\n        (15, 17),\n        (15, 19),\n        (17, 19),\n        (12, 14),\n        (12, 24),\n        (14, 16),\n        (16, 22),\n        (16, 20),\n        (16, 18),\n        (18, 20),\n        (23, 24),\n    ],\n}","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:32.346052Z","iopub.execute_input":"2023-05-01T14:20:32.346417Z","iopub.status.idle":"2023-05-01T14:20:32.442648Z","shell.execute_reply.started":"2023-05-01T14:20:32.346357Z","shell.execute_reply":"2023-05-01T14:20:32.441549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"CNN USES MATRICE PIXELS TO CREATE AN IMAGE THAT USES THE EDGES TO BUILD & RECOGNISE WHAT CLASS CAN IT BE BELOW IT THE CODE THAT OUTPUT THE VISUALS ","metadata":{"execution":{"iopub.status.busy":"2023-03-31T17:58:09.194822Z","iopub.execute_input":"2023-03-31T17:58:09.195134Z","iopub.status.idle":"2023-03-31T17:58:09.234111Z","shell.execute_reply.started":"2023-03-31T17:58:09.195103Z","shell.execute_reply":"2023-03-31T17:58:09.231134Z"}}},{"cell_type":"code","source":"lm_data = {k: v for k, v in zip(train.columns, train.row(0))}\n\ndf_landmark = pl.read_parquet(cfg.INPUT / lm_data[\"path\"])\nlm_first_frame = df_landmark.partition_by(\"frame\")[0]\nlms = lm_first_frame.partition_by(\"type\")\n\n_, axes = plt.subplots(2, 2, figsize=(8, 8))\naxes = axes.ravel()\n\nfor lm, ax in zip(lms, axes):\n    lm = lm.filter((pl.col(\"type\") != \"pose\") | (pl.col(\"landmark_index\") < 25))\n    lm_type = lm.row(0)[2]\n    ax.scatter(lm[\"x\"], 1 - lm[\"y\"])\n    if lm_type != \"face\":\n        for row in lm.iter_rows():\n            dt = {k: v for k, v in zip(lm.columns, row)}\n            x, y, idx = dt[\"x\"], dt[\"y\"], dt[\"landmark_index\"]\n\n            if (x is not None) & (y is not None):\n                ax.text(x, 1 - y, idx)\n    if lm_type in [\"left_hand\", \"right_hand\", \"pose\"]:\n        for edge in edges[lm_type]:\n            i, j = edge\n            x1, x2, y1, y2 = lm[\"x\"][i], lm[\"x\"][j], lm[\"y\"][i], lm[\"y\"][j]\n            if not ((x1 is None) | (x2 is None) | (y1 is None) | (y2 is None)):\n                ax.plot((x1, x2), (1 - y1, 1 - y2), color=\"gray\")\n    ax.set(title=f\"{lm_type}\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:32.444102Z","iopub.execute_input":"2023-05-01T14:20:32.444584Z","iopub.status.idle":"2023-05-01T14:20:33.548993Z","shell.execute_reply.started":"2023-05-01T14:20:32.444536Z","shell.execute_reply":"2023-05-01T14:20:33.547833Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"CREATE A FUNCTION CALLED ANIMATING \nTHAT creates motion graphics on a single-frame basis using the video sign from train landmarks","metadata":{"execution":{"iopub.status.busy":"2023-03-31T17:59:26.239792Z","iopub.execute_input":"2023-03-31T17:59:26.240117Z","iopub.status.idle":"2023-03-31T17:59:26.281035Z","shell.execute_reply.started":"2023-03-31T17:59:26.240085Z","shell.execute_reply":"2023-03-31T17:59:26.277968Z"}}},{"cell_type":"code","source":"def animating(row, columns, fps: int = 10):\n    data = {k: v for k, v in zip(columns, row)}\n    sign, participant_id, sequence_id = (\n        data[\"sign\"],\n        data[\"participant_id\"],\n        data[\"sequence_id\"],\n    )\n\n    df_landmark = pl.read_parquet(cfg.INPUT / data[\"path\"])\n    use_cols = [\"x\", \"y\", \"z\"]\n    df_landmark = df_landmark.sort([\"frame\", \"type\", \"landmark_index\"]).with_columns(\n        [pl.col(col).interpolate().over([\"type\", \"landmark_index\"]) for col in use_cols]\n    )\n\n    fig, axes = plt.subplots(2, 2, figsize=(8, 8))\n    axes = axes.ravel()\n\n    lms_all = df_landmark.partition_by(\"frame\")\n\n    def draw_frame(frame):\n        lms = lms_all[frame].partition_by(\"type\")\n\n        for lm, ax in zip(lms, axes):\n            lm = lm.filter((pl.col(\"type\") != \"pose\") | (pl.col(\"landmark_index\") < 25))\n            ax.cla()\n            lm_type = lm.row(0)[2]\n            frame = lm.row(0)[0]\n\n            ax.scatter(lm[\"x\"], 1 - lm[\"y\"])\n            if lm_type != \"face\":\n                for row in lm.iter_rows():\n                    dt = {k: v for k, v in zip(lm.columns, row)}\n                    if (dt[\"x\"] is not None) & (dt[\"y\"] is not None):\n                        ax.text(dt[\"x\"], 1 - dt[\"y\"], dt[\"landmark_index\"])\n            if lm_type in [\"left_hand\", \"right_hand\", \"pose\"]:\n                for edge in edges[lm_type]:\n                    i, j = edge\n                    x1, x2, y1, y2 = lm[\"x\"][i], lm[\"x\"][j], lm[\"y\"][i], lm[\"y\"][j]\n                    if not ((x1 is None) | (x2 is None) | (y1 is None) | (y2 is None)):\n                        ax.plot((x1, x2), (1 - y1, 1 - y2), color=\"gray\")\n            ax.set(title=f\"{lm_type}\")\n        plt.suptitle(f'sign: \"{sign}\" [frame={frame}]')\n\n    ani = animation.FuncAnimation(\n        fig, draw_frame, frames=range(len(lms_all)), interval=1000 / fps\n    )\n\n    if not (cfg.OUTPUT / sign).exists():\n        (cfg.OUTPUT / sign).mkdir()\n    ani.save(\n        cfg.OUTPUT / sign / f\"{participant_id}_{sequence_id}.mp4\",\n        writer=\"ffmpeg\",\n        fps=fps,\n        codec=\"h264\",\n    )\n    plt.close(fig)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:33.550702Z","iopub.execute_input":"2023-05-01T14:20:33.551050Z","iopub.status.idle":"2023-05-01T14:20:33.653766Z","shell.execute_reply.started":"2023-05-01T14:20:33.551018Z","shell.execute_reply":"2023-05-01T14:20:33.652294Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"For accuracy purpose we use 5 videos to train a sign","metadata":{}},{"cell_type":"code","source":"train_unique_signs = train.filter(\n    (pl.arange(0, pl.count())).shuffle(seed=42).over(\"sign\") < 5\n)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:33.655347Z","iopub.execute_input":"2023-05-01T14:20:33.655743Z","iopub.status.idle":"2023-05-01T14:20:33.741054Z","shell.execute_reply.started":"2023-05-01T14:20:33.655711Z","shell.execute_reply":"2023-05-01T14:20:33.739921Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_unique_signs.groupby(\"sign\").agg(pl.count()).head()","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:33.742769Z","iopub.execute_input":"2023-05-01T14:20:33.743115Z","iopub.status.idle":"2023-05-01T14:20:33.817534Z","shell.execute_reply.started":"2023-05-01T14:20:33.743084Z","shell.execute_reply":"2023-05-01T14:20:33.816042Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Setting directories of the first 10 signs that we gonna visualise","metadata":{"execution":{"iopub.status.busy":"2023-03-31T18:00:28.635712Z","iopub.status.idle":"2023-03-31T18:00:28.636715Z","shell.execute_reply.started":"2023-03-31T18:00:28.636389Z","shell.execute_reply":"2023-03-31T18:00:28.636424Z"}}},{"cell_type":"code","source":"if not cfg.OUTPUT.exists():\n    cfg.OUTPUT.mkdir()\n\nif cfg.DEBUG:\n    df = train_unique_signs.head(10)\nelse:\n    df = train_unique_signs\n\nfor row in tqdm(df.iter_rows(), total=len(df)):\n    animating(row, df.columns)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:20:33.818941Z","iopub.execute_input":"2023-05-01T14:20:33.819261Z","iopub.status.idle":"2023-05-01T14:23:54.117641Z","shell.execute_reply.started":"2023-05-01T14:20:33.819231Z","shell.execute_reply":"2023-05-01T14:23:54.116369Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"du in full disk usage,we empoly it to estimate file space usage\nthus track the files and directories","metadata":{}},{"cell_type":"code","source":"!du -sh animation","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:23:54.119453Z","iopub.execute_input":"2023-05-01T14:23:54.120534Z","iopub.status.idle":"2023-05-01T14:23:55.235123Z","shell.execute_reply.started":"2023-05-01T14:23:54.120490Z","shell.execute_reply":"2023-05-01T14:23:55.233944Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!tree animation | head","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:23:55.241694Z","iopub.execute_input":"2023-05-01T14:23:55.242193Z","iopub.status.idle":"2023-05-01T14:23:56.369685Z","shell.execute_reply.started":"2023-05-01T14:23:55.242152Z","shell.execute_reply":"2023-05-01T14:23:56.368445Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"cp stands for copy. This command is used to copy files or group of files or directory. \nIt creates an exact image of a file on a disk with different file name","metadata":{}},{"cell_type":"code","source":"!cp animation/all/26734_1247514751.mp4 sample005.mp4\n!cp animation/bug/61333_1268993802.mp4 sample007.mp4\n!cp animation/lion/29302_1271911796.mp4 sample008.mp4\n!cp animation/TV/28656_125816896.mp4 sample009.mp4","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:23:56.371264Z","iopub.execute_input":"2023-05-01T14:23:56.371660Z","iopub.status.idle":"2023-05-01T14:24:00.631827Z","shell.execute_reply.started":"2023-05-01T14:23:56.371620Z","shell.execute_reply":"2023-05-01T14:24:00.630130Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"VISUALISING A CERTAIN SIGN WITH A POP UP WORD","metadata":{"execution":{"iopub.status.busy":"2023-03-31T18:00:28.647944Z","iopub.status.idle":"2023-03-31T18:00:28.648688Z","shell.execute_reply.started":"2023-03-31T18:00:28.648490Z","shell.execute_reply":"2023-03-31T18:00:28.648513Z"}}},{"cell_type":"code","source":"Video(\"sample005.mp4\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:00.633792Z","iopub.execute_input":"2023-05-01T14:24:00.634225Z","iopub.status.idle":"2023-05-01T14:24:00.719615Z","shell.execute_reply.started":"2023-05-01T14:24:00.634178Z","shell.execute_reply":"2023-05-01T14:24:00.718284Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Video(\"sample007.mp4\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:00.721228Z","iopub.execute_input":"2023-05-01T14:24:00.721699Z","iopub.status.idle":"2023-05-01T14:24:00.793001Z","shell.execute_reply.started":"2023-05-01T14:24:00.721652Z","shell.execute_reply":"2023-05-01T14:24:00.791484Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Video(\"sample008.mp4\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:00.794344Z","iopub.execute_input":"2023-05-01T14:24:00.794822Z","iopub.status.idle":"2023-05-01T14:24:00.866327Z","shell.execute_reply.started":"2023-05-01T14:24:00.794786Z","shell.execute_reply":"2023-05-01T14:24:00.865148Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"STORING THE ANIMATION VIDEOS AS A ZIP FILE","metadata":{"execution":{"iopub.status.busy":"2023-03-31T18:00:28.659028Z","iopub.status.idle":"2023-03-31T18:00:28.659588Z","shell.execute_reply.started":"2023-03-31T18:00:28.659295Z","shell.execute_reply":"2023-03-31T18:00:28.659325Z"}}},{"cell_type":"code","source":"!zip -r animation.zip {cfg.OUTPUT.relative_to(\"/kaggle/working\")} && rm -rf {cfg.OUTPUT}","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:00.867747Z","iopub.execute_input":"2023-05-01T14:24:00.868060Z","iopub.status.idle":"2023-05-01T14:24:02.113501Z","shell.execute_reply.started":"2023-05-01T14:24:00.868030Z","shell.execute_reply":"2023-05-01T14:24:02.111930Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"MODEL DEFINITION","metadata":{}},{"cell_type":"code","source":"import tensorflow as tf\nimport keras\nfrom keras.layers import *\nfrom keras.models import *\nfrom keras import backend as K","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:02.116833Z","iopub.execute_input":"2023-05-01T14:24:02.118341Z","iopub.status.idle":"2023-05-01T14:24:02.206009Z","shell.execute_reply.started":"2023-05-01T14:24:02.118278Z","shell.execute_reply":"2023-05-01T14:24:02.204845Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"inputs = Input(shape=(243, 243, 3))\nconv1 = Conv2D(32, kernel_size=(3, 3), activation=\"relu\")(inputs)\nconv2 = Conv2D(64, kernel_size=(3, 3), activation=\"relu\")(conv1)\npool1 = MaxPooling2D(pool_size=(2, 2))(conv2)\nconv3 = Conv2D(128, kernel_size=(3, 3), activation=\"relu\")(pool1)\npool2 = MaxPooling2D(pool_size=(2, 2))(conv3)\nx = Dropout(0.25)(pool2)\nflat = Flatten()(x)\n\ndropout = Dropout(0.5)\nsign_model = Dense(128, activation=\"relu\")(flat)\nsign_model = dropout(sign_model)\nsign_model = Dense(64, activation=\"relu\")(sign_model)\nsign_model = dropout(sign_model)\nsign_model = Dense(32, activation=\"relu\")(sign_model)\nsign_model = dropout(sign_model)\nsign_model = Dense(16, activation=\"relu\")(sign_model)\nsign_model = dropout(sign_model)\nsign_model = Dense(8, activation=\"relu\")(sign_model)\nsign_model = dropout(sign_model)\nsign_model = Dense(1, activation=\"relu\")(sign_model)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:02.210487Z","iopub.execute_input":"2023-05-01T14:24:02.210991Z","iopub.status.idle":"2023-05-01T14:24:02.838420Z","shell.execute_reply.started":"2023-05-01T14:24:02.210952Z","shell.execute_reply":"2023-05-01T14:24:02.837130Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = Model(inputs=inputs, outputs=[sign_model])\nmodel.compile(\n    optimizer=\"adam\", loss=[\"mse\", \"binary_crossentropy\"], metrics=[\"accuracy\"]\n)","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:02.839930Z","iopub.execute_input":"2023-05-01T14:24:02.840421Z","iopub.status.idle":"2023-05-01T14:24:02.926016Z","shell.execute_reply.started":"2023-05-01T14:24:02.840353Z","shell.execute_reply":"2023-05-01T14:24:02.924751Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model.summary()","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:02.930148Z","iopub.execute_input":"2023-05-01T14:24:02.930555Z","iopub.status.idle":"2023-05-01T14:24:03.056901Z","shell.execute_reply.started":"2023-05-01T14:24:02.930517Z","shell.execute_reply":"2023-05-01T14:24:03.055546Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import tensorflow as tf\nfrom IPython.display import Image","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:03.058688Z","iopub.execute_input":"2023-05-01T14:24:03.059250Z","iopub.status.idle":"2023-05-01T14:24:03.130111Z","shell.execute_reply.started":"2023-05-01T14:24:03.059200Z","shell.execute_reply":"2023-05-01T14:24:03.128969Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tf.keras.utils.plot_model(model, \"model.png\", show_shapes=True)\nImage(\"model.png\")","metadata":{"execution":{"iopub.status.busy":"2023-05-01T14:24:03.132144Z","iopub.execute_input":"2023-05-01T14:24:03.132647Z","iopub.status.idle":"2023-05-01T14:24:03.457969Z","shell.execute_reply.started":"2023-05-01T14:24:03.132598Z","shell.execute_reply":"2023-05-01T14:24:03.456490Z"},"trusted":true},"execution_count":null,"outputs":[]}]}