2023-03-23

Editing the layout in Transkribus


Transkribus
 is an AI-powered platform for automatic text recognition and transcription of historical (usually handwritten) documents.

Most Transkribus users probably do the automatic layout analysis and text recognition in one step or even upload, layout and text recognition all in one step.

However, you may have issues with the layout analysis, for example putting lines in the wrong order, breaking lines in the middle, or inventing non-existing lines. This is especially true of text in tables, where the columns are usually processed before the rows, contrary to what is usually desired.

That's why I routinely do the upload, layout analysis and text recognition in three separate steps and optimize the layout created by Transkribus manually before doing the automatic text recognition.

I use the web-based Transkribus App (also called Transkribus Lite) rather than Transkribus Expert (the standalone version that you install on your PC), which is no longer being further developed.

Transkribus changes the user interface often in their attempts to improve it, but that means parts of the following guide may become obsolete quickly. However, the main principles will no doubt be valid for some time.

Log in to Transkribus App.

Do not click "Text Recognition" in the menu on the left or "Select files" under "Quick Text Recognition" on the right.

Instead, choose "Upload" in the menu on the left.Choose "Image" or "PDF", then upload one or more files from your PC's file system.


Once you have uploaded the file(s), go to the overview of the page(s) in the document, but do not go to an individual page. You should see miniature views of the page(s) that you just uploaded. You will see checkboxes with the word "Select" to the lower left of the miniature views of the pages.


Click the checkbox of the first page you want to do the layout analysis for. The grayed out menu items on the left now become activated. Do not choose "Text Recognition".


Instead, choose "Layout Recognition".

At the time of this writing, you now have a choice among ""Printed Block Detection", "Preset Model", and "Choose Model", but this may change.

Choose "Preset Model" and click "Start".

As of this writing, a window now appears explaining what is currently being changed with the layout analysis models. Click "Start" again.


Close any open windows. Click "Jobs" in the menu on the left. Wait for the automatic layout analysis of the first job to finish.


When it is finished click on the document link in the column "Action".

Click on the miniature view of the page you just did the automatic layout analysis for.

At the time of this writing, a window explaining the new document editor is displayed. Close this window.

The layout of the page consists mainly of regions that contain lines that contain points.


The "Info" icon shows you a cheat sheet on how to edit the layout. Read this.

First check to see if the regions are OK. Often any text written in the margin is included in the same region as the main text and the lines may even run into each other.


So you need to create a new region for the text in the margin. Click the "Add Region" icon on the left. Define the new region by clicking on one corner with the mouse, then click on the opposite corner with the mouse.

If lines run into each other, you need to split the line. Mark the line by clicking on it with the mouse. Then hit the "V" key (for "vertical split"). While holding the "V" key move the mouse cursor till the vertical line is where you want to split the text line. Then tap the left mouse button.

Now mark the line that needs to go into the new region. Hit the line you marked with the right mouse button. A context-sensitive menu will open. Choose "Assign to new region"; then choose the new region with the mouse. Repeat with any other lines that need move to the new region because this does not automatically happen when you create the new region.

To split a region, mark the region with the mouse, hit the "H" key (for "horizontal split") then move the mouse cursor to where you want the split, and hit the left mouse button. You can also split a region vertically with the "V" key, but that is more seldom.

To delete a region, mark it with the mouse, then hit the "Del" key.

To combine regions, mark the first region with the mouse, then hit the "Ctrl" key, and mark the second region with the mouse. Then hit the "M" key (for "merge").

To redefine the size of a region, drag the corners of it with the mouse.


Save your work by hitting the "Save" icon near the top right (a diskette symbol) to . Do this often.


Now check the lines. For this part it is extremely helpful to see the line numbers in the image in the left-hand panel (not just in the right-hand panel). Click the "Configure" icon on the extreme bottom right. Click the "Layout" tab. Click "Show reading order". Close the window. Now you will see little numbers indicating the order of the regions and the order of the lines within the regions.

Click on the first line in the first region in the image. The corresponding line in the right-hand panel will also be marked, and vice versa. To move from one line to the next in the image, hit the "Ctrl" key. To move from one line to the next in the right-hand panel hit the down arrow key.


To add a line, hit the "Add Line" icon, click the left mouse button at the beginning of the line, and double-click the mouse button to end the line. If the line is jagged or curved, you can add points on the line with a click of the mouse button anywhere in between before double-clicking at the end.


To reorder lines, mark one of them, then hit the "Layout" icon on the left. Then drag the currently marked line to where it belongs with the mouse. Unfortunately the lines in this window are not numbered, so it can be confusing.

Splitting lines is explained above when explaining how to add a region.

To merge lines, mark the first one with the mouse, then hold the "Ctrl" key and mark the second one with the mouse, and hit the "M" key (for "merge").


To extend a line to the left or right, mark it with the mouse, then drag the first or last point to the left or right.

When you have finished editing the layout, don't forget to save your work.

If the layout is so wrong that optimizing it is too cumbersome, you can delete all the regions and all the lines, then add the regions and lines manually as described above. Or don't do the automatic layout analysis at all, and add the regions and lines manually.

Up to this point, no credits have been used.


Now you can do the text recognition by clicking the "Recognition" icon near the bottom left. This is when a credit is deducted.

2014-07-21

Homemade Phonescoping Adapter

Many of my previous posts dealt with digiscoping adapters for compact digital cameras and spotting scopes, but what if you don't have one of those three ingredients with you? You're more likely to have your smartphone and binoculars with you when birding, so here's how to make your own smartphone digiscoping adapter. Is it still called digiscoping? I guess it's called phonescoping.

What you need:

A case that fits the back of your phone.

Self-adhesive hook and loop fastener ("Velcro"). I found some 5 cm (2 in.) wide at Amazon. Try to get the widest and strongest you can find.

A 35mm film container or similar item that will fit snugly inside the eyecup or outside the ocular of your binoculars, here my trusty old Swarovski Habicht 7x42s. I saved a bunch of film containers when digital cameras arrived on the scene, but you can still find them online, e.g. at eBay.

Use a jar lid or similar item as a template to mark the back of the soft side ("loop" part) of the hook and loop tape. You want it to be 6 or 7 cm (2.5 to 3 in.) wide in order to accommodate several sizes of adapters. Cut along your marking.

Now use your smartphone case as a template to mark the hole in the middle. Then cut it out.

Take the backing off the tape, and press it firmly onto the phone case, centering the holes. Cut off the excess.

You will want to weigh the tape down with a stack of books overnight in order to create a stronger bond.

Now do the same thing with the hook part of the hook and loop tape, this time using the film container as a template. Cut a hole in the middle that's as big as the hole in your phone case. I used a 14mm (6/16 in.) drill bit. Then cut off as much of the rest of the film container to get your phone as close as possible to the binoculars (to avoid vignetting). I used my trusty table saw. Here's the result:

The surface area looks pretty small, but it works surprisingly well. Now insert your phone into the case, and stick your new adapter onto it.

Now insert this into the eyepiece of your binoculars.

And fire up your favorite camera app (or just the one that came with the phone).

Now point the whole thing at a bird (this one's hiding in the foliage).

As you can see, depending on how snugly the adapter fits into the eyepiece, one hand is free to zoom in (getting rid of the vignetting) and snap the photo.

This contraption also fits into the eyepiece of this newer model Swarovski SLC.

Here are a few photos taken with this setup:




If your new adapter doesn't fit into your eyepiece (here on a Swarovski CL) you can screw in the eyepiece where the adapter is and rest your phone on the other eyepiece.

With this setup you need both hands to hold the phone and adapter to the binoculars, making it hard to operate your camera app.

However, there are camera apps that react to your voice. You can take a picture, for example, by saying "take the picture"!

This can all be very tricky, however, so here's how I made an adapter to fit this model:

A friend had an old plastic vacuum cleaner nozzle that tapered slightly from one end to the other:

I cut off slices about 2 cm (1 in.) thick till I had a ring that fit snugly over the ocular:

Then I got a hole saw that would cut a circular piece of an old CD-ROM to fit exactly inside the plastic ring. First I pre-drilled a hole in a scrap of wood and clamped the CD-ROM centered on the drill hole:

This is the result of drilling the disc:

I had to cut off some extraneous plastic and flash with a Stanley knife to make the disc fit inside the ring. Then I cut off a piece of the hook and loop tape and stuck the ring on it:

Then I put the disc inside this:

Then I cut off the corners of the tape:

Then I made a few more snips to create some tabs:

Then I folded the tabs up and stuck them to the ring:

Then I taped some duct tape around the ring:

Then I cut a hole in the bottom of the hook and loop tape as large as the hole in the disc:

Done:

A couple photos from this new contraption:



None of these pictures will win prizes in a print publication of course, but if that's what you wanted, you wouldn't be using a smartphone. However, they're perfectly good for documentation purposes and for posting on your favorite social media site.

2014-03-15

Testing the Swarovski ATX Spotting Scope

Swarovski's modular spotting scope system ATX/STX allows you to interchange 3 sizes of objective lenses with one ocular.

The oculars are also available in angled (ATX) or straight (STX) versions.

The objective sizes are 65 mm (25 to 60 power zoom), 85 mm (also 25 to 60 power) and 95 mm (with a whopping 30 to 70 power zoom).

The objectives have the further advantage of having the zoom ring right next to the focus ring of the ocular... no more fumbling between the two when focussing and zooming on a distant subject.

65 mm objective and ATX ocular separate
65 mm objective and ATX ocular separate
65 mm objective and ATX ocular connected
65 mm objective and ATX ocular connected

I have been testing the ATX for several months with the 65 and 85 mm objectives.

65 mm and 85 mm objective comparison
65 mm and 85 mm objective comparison

My main focuses are identification, observation and digiscoping with a compact digital camera (both photos and videos). For this I've been using the DCB II digiscoping adapter.

65 mm objective with ATX ocular, DCB II and camera separate
65 mm objective with ATX ocular, DCB II and camera separate

65 mm objective with ATX ocular, DCB II and camera connected together and ready
65 mm objective with ATX ocular, DCB II and camera connected together and ready

The great advantage of this adapter is that you can easily fold it up out of the way to view through the scope.

65 mm objective with ATX ocular, DCB II and camera folded up
65 mm objective with ATX ocular, DCB II and camera folded up

Once you've attached the adapter, there's really no reason to ever take it off again even if you switch objectives. I walk around all day with this setup (plus tripod) on my shoulders. The only reason to take the camera off the adapter is when the battery runs down and you change to a freshly charged one.

The advantage of a larger 85 mm (and 95 mm) objective lens, of course, is to allow more light to reach the eye under suboptimal lighting conditions. The 65 mm lens is so good, however, that for me the advantages of lighter weight and less volume mean that I usually leave the 85 mm lens at home before leaving on my hours-long treks, often in mountainous terrain. The 85 mm objective lens alone (without the ocular) weighs 1.15 kg (2.53 lb.) compared to 0.84 kg (1.85 lb.) for the 65 mm lens, a difference of 0.31 kg (0.68 lb.).

With practice changing the objectives is easy, but since this is the part that attaches to the tripod, you have to change two attachments every time (the attachment to the tripod and the attachment to the ocular). Therefore, unless the lighting conditions are really bad and I won't be walking around too much, I would stick with the 65 mm lens. Your mileage may vary.

Another piece of optional equipment is the balance rail, the reasoning behind which is that the added weight of the camera will make the ocular end of the scope heavier, causing that end to tip down.

85 mm objective with ATX ocular and balance rail separate
85 mm objective with ATX ocular and balance rail separate

85 mm objective with ATX ocular and balance rail connected
85 mm objective with ATX ocular and balance rail connected

In the photos the foot on the balance rail is closer to your body (and the camera) than the foot on the scope. With a push of the green button on the balance rail you can easily slide the center of balance to any desired position.

The balance rail fits both the 65 mm and 85 mm (and presumably 95 mm) lens, but not without considerable fiddling. This is not meant to be done in the field.

The balance rail is much more sophisticated than in the ATM system. Swarovski obviously put a lot of thought into it, but it adds 0.34 kg (0.75 lb.) to the system. At first I thought the problem of the camera tipping down when you least expect it would be larger. Admittedly I've gotten into the unconscious habit of tightening the corresponding knob on the tripod before taking my hands off the positioning handle. And with compact digital cameras becoming more and more compact and lightweight, this is becoming less and less a problem.

The tripod head I tested with this system was a DH 101 and the tripod was a CT 101, the same as in this blog post, so I won't go into further detail.

As you can see the Swarovski ATX/STX spotting scope system is truly modular to fit any need.

In summary the system I usually use consists of:
  • Swarovski 25-60x 65mm spotting scope objective
  • ATX ocular
  • DCB II digital camera base
  • CT 101 carbon tripod
  • DH 101 tripod head
  • Nikon Coolpix P310 compact digital camera

The total weight of this system is about 4.5 kg or 10 lb. as measured by my luggage scale, about the same as my previous system.

For photos made with this system see my previous post and my Flickr Photostream. For videos, see my YouTube wildlife playlist.

German-language version of this post