{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Inspect\n", "\n", "We show how to inspect results and intermediate results\n", "using the example pages in the *example* directory.\n", "\n", "Reference: [page](https://among.github.io/fusus/fusus/page.html)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Enable auto-loading of changed code.\n", "This is handy if you are a developer and changing `fusus` code wanting to load changed code on the fly." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%load_ext autoreload\n", "%autoreload 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from fusus.book import Book" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "B = Book(cd=\"~/github/among/fusus/example\")" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# cd to the book directory\n", "!cd `pwd`" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/dirk/github/among/fusus/example\n" ] } ], "source": [ "!echo `pwd`" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.91s 18 pages: 47-48,58-59,63,67,101-102,111-113,121-122,131-132,200,300,400\n" ] } ], "source": [ "B.availablePages()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Inspection\n", "\n", "We run a single page and switch batch mode off." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " 0.00s Batch of 1 pages: 47\n", " 0.00s Start batch processing images\n", " | 1.27s Loading for Kraken: ~/github/among/fusus/model/arabic_generalized.mlmodel\n", " | 8.76s model loaded\n", " | 11s 1 047.tif \n", " 11s all done\n" ] } ], "source": [ "page = B.process(batch=False, pages='47')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Inspect intermediate stages\n", "\n", "We get a handle to the page object that has been processed,\n", "and because batch mode is off, it has retained its intermediate results.\n", "\n", "Let's show all stages, but heavily reduced:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
acro | band | mark | hits |
---|---|---|---|
h1 | high | a | 4 |
m19 | mid | comma | 10 |