diff options
-rw-r--r-- | notebooks/03-look-at-iam-paragraphs.ipynb | 119 |
1 files changed, 107 insertions, 12 deletions
diff --git a/notebooks/03-look-at-iam-paragraphs.ipynb b/notebooks/03-look-at-iam-paragraphs.ipynb index b74d68f..0f805f6 100644 --- a/notebooks/03-look-at-iam-paragraphs.ipynb +++ b/notebooks/03-look-at-iam-paragraphs.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "6ce2519f", "metadata": {}, "outputs": [], @@ -15,6 +15,7 @@ "import matplotlib.pyplot as plt\n", "\n", "import numpy as np\n", + "import torch\n", "\n", "%load_ext autoreload\n", "%autoreload 2\n", @@ -60,16 +61,6 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "3ffde4df-2c15-4f6f-ab24-b09e8e3a20c4", - "metadata": {}, - "outputs": [], - "source": [ - "import torch" - ] - }, - { - "cell_type": "code", "execution_count": 5, "id": "e9386367-2b49-4633-9936-57081132e59e", "metadata": {}, @@ -475,9 +466,113 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, + "id": "8e667fb0-3ff4-45c7-9de3-8f712407d12f", + "metadata": {}, + "outputs": [], + "source": [ + "import torch" + ] + }, + { + "cell_type": "code", + "execution_count": 23, "id": "c4b7e5c5-62a9-4415-954d-65d59ddd82c4", "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "torch.Size([2, 92160])" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "torch.randn(2, 256, 18, 20).flatten(start_dim=1).shape" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "bf820d79-2ce1-4c15-b006-6cb4407ccbba", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "[autoreload of text_recognizer.networks.barlow_twins.projector failed: Traceback (most recent call last):\n", + " File \"/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 245, in check\n", + " superreload(m, reload, self.old_objects)\n", + " File \"/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 410, in superreload\n", + " update_generic(old_obj, new_obj)\n", + " File \"/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 347, in update_generic\n", + " update(a, b)\n", + " File \"/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 302, in update_class\n", + " if update_generic(old_obj, new_obj): continue\n", + " File \"/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 347, in update_generic\n", + " update(a, b)\n", + " File \"/home/aktersnurra/.cache/pypoetry/virtualenvs/text-recognizer-ejNaVa9M-py3.9/lib/python3.9/site-packages/IPython/extensions/autoreload.py\", line 266, in update_function\n", + " setattr(old, name, getattr(new, name))\n", + "ValueError: __init__() requires a code object with 0 free vars, not 1\n", + "]\n" + ] + } + ], + "source": [ + "from text_recognizer.networks.barlow_twins.projector import Projector" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "cda38d24-b69a-4033-b07c-2e7558889cf7", + "metadata": {}, + "outputs": [], + "source": [ + "net = Projector([92160, 4096, 256])" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "ed706880-8556-418d-85a6-616ac16a3334", + "metadata": {}, + "outputs": [], + "source": [ + "z = torch.randn(2, 256, 18, 20).flatten(start_dim=1)\n" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "58e6fddc-81be-44c1-bbe8-05401aa05287", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "torch.Size([2, 256])" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "net(z).shape" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "6f53950a-6858-40b6-ad4a-2857227d9d59", + "metadata": {}, "outputs": [], "source": [] } |