summaryrefslogtreecommitdiff
path: root/src/notebooks/03a-line-prediction.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'src/notebooks/03a-line-prediction.ipynb')
-rw-r--r--src/notebooks/03a-line-prediction.ipynb41
1 files changed, 27 insertions, 14 deletions
diff --git a/src/notebooks/03a-line-prediction.ipynb b/src/notebooks/03a-line-prediction.ipynb
index 539fb6e..13f4ff1 100644
--- a/src/notebooks/03a-line-prediction.ipynb
+++ b/src/notebooks/03a-line-prediction.ipynb
@@ -32,34 +32,35 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
- "from text_recognizer.models import LineCTCModel\n",
- "from text_recognizer.networks import LineRecurrentNetwork"
+ "from text_recognizer.models import CRNNModel\n",
+ "from text_recognizer.networks import ConvolutionalRecurrentNetwork"
]
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
- "2020-09-09 20:38:27.854 | DEBUG | text_recognizer.datasets.emnist_lines_dataset:_load_data:164 - EmnistLinesDataset loading data from HDF5...\n"
+ "2021-01-04 21:35:35.605 | DEBUG | text_recognizer.datasets.emnist_lines_dataset:_load_data:152 - EmnistLinesDataset loading data from HDF5...\n"
]
}
],
"source": [
- "emnist_lines = EmnistLinesDataset(train=False)"
+ "emnist_lines = EmnistLinesDataset(train=False)\n",
+ "emnist_lines.load_or_generate_data()"
]
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
@@ -69,7 +70,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
@@ -78,7 +79,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 11,
"metadata": {},
"outputs": [
{
@@ -87,7 +88,7 @@
"torch.Size([34])"
]
},
- "execution_count": 7,
+ "execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
@@ -98,14 +99,26 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 16,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
- "2020-09-01 23:37:30.291 | DEBUG | text_recognizer.models.base:load_weights:405 - Loading network with pretrained weights.\n"
+ "2021-01-04 21:37:05.918 | DEBUG | text_recognizer.models.base:load_weights:432 - Loading network with pretrained weights.\n"
+ ]
+ },
+ {
+ "ename": "TypeError",
+ "evalue": "'NoneType' object is not subscriptable",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m----------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
+ "\u001b[0;32m<ipython-input-16-df17e62a822a>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[0;34m\"patch_size\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0;36m28\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m28\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 14\u001b[0m \"stride\": [1, 14],}\n\u001b[0;32m---> 15\u001b[0;31m \u001b[0mline_ctc_model\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mCRNNModel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"ConvolutionalRecurrentNetwork\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"IamLinesDataset\"\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m#, network_args)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
+ "\u001b[0;32m~/Documents/projects/quest-for-general-artifical-intelligence/projects/text-recognizer/src/text_recognizer/models/crnn_model.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, network_fn, dataset, network_args, dataset_args, metrics, criterion, criterion_args, optimizer, optimizer_args, lr_scheduler, lr_scheduler_args, swa_args, device)\u001b[0m\n\u001b[1;32m 49\u001b[0m )\n\u001b[1;32m 50\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 51\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpad_token\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdataset_args\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"args\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"pad_token\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 52\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_mapper\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 53\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_mapper\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mEmnistMapper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpad_token\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpad_token\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+ "\u001b[0;31mTypeError\u001b[0m: 'NoneType' object is not subscriptable"
]
}
],
@@ -124,7 +137,7 @@
" \"num_classes\": 80,\n",
" \"patch_size\": [28, 28],\n",
" \"stride\": [1, 14],}\n",
- "line_ctc_model = LineCTCModel(LineRecurrentNetwork, EmnistLinesDataset) #, network_args)"
+ "line_ctc_model = CRNNModel(\"ConvolutionalRecurrentNetwork\", \"IamLinesDataset\") #, network_args)"
]
},
{
@@ -398,7 +411,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.7.4"
+ "version": "3.8.2"
}
},
"nbformat": 4,