Ask HN: How can I automatically scan and catalog a mountain of books?

275 points by cconcepts ↗ HN
This really kind, eccentric guy in my neighbourhood is stockpiling books and has been doing so for years. He has an enourmous barn that he is obsessively filling with whatever reasonable quality books he can get his hands on but he is completely overwhelmed in terms of cataloging/indexing them so customers have to go through his barn sifting through cartons full of books. He charges $1 or $2 for whatever book you dig out.

He buys bulk lots from deceased estates and bookstores that are closing down. Entire shipping containers are being gifted to him and showing up at his barn. The barn is full and he is now storing in shipping containers outside.

There is great quality books among this quagmire but it takes hours of searching to find them. I figured HN might be able to point me to a solution where I could quickly photograph the front cover and have a script/google images compare the image to online info to index the title and author and then perhaps list them online...

I dunno, it just seems like such a treasure trove of books that he will sell for practically nothing because he loves books and hopes that they will find their way to people who want them - the barrier is allowing customers to find what they are looking for.

Thoughts?

141 comments

[ 2.9 ms ] story [ 192 ms ] thread
If they are recent books (from about 1980) then they probably have a barcode on the back cover, so use that. My guess is that it won't be worth trying to automatically recognise older books from the cover: a lot of them had a dust jacket, that goes missing, and a cover under the dust jacket that is not at all distinctive. The title might be on the spine, but how many online images show the spine clearly?
I tried doing a book catalog about ten years ago. I got about 80% recognition rate by using multiple numbers (ISBN, and the Library of Congress number) and multiple online data sources. It was a pretty slow process, to the point where simply keyboarding the information was easier and less error-prone, and I had to manually enter the books that didn't get any online matches anyway.

Definitely not a "scan/beep/scan/beep" kind of thing. More like "scan . . . uh, scan . . . scan, damn you, SCAN I say! (beep) Okay . . . now the first problem is that 'The Sands of Mars' which I am holding is definitely not 'Great Montana Flapjack Recipes' on B&N, let's try the library of Congress . . . . nope, not 'Annals of 1959 Steelmaking', so (tap tappity-tap...)"

The last time I looked at this (admittedly quite a while ago) the book bar code contained the ISBN.

What was causing the mismatches? Bar codes that did not contain the ISBN? Non-unique numbers?

You would be surprised to see how many books have the wrong ISBN or have a mismatch between the barcode and the ISBN. Not as much of a problem with major publishers now, but some from the 80s and 90s were hilarious.
The ISBN mappings were maybe fifty percent reliable, service by service. So you'd do three or four ISBN lookups and paw through the results, and then failover to the LOC. The Library of Congress numbers were more accurate, but more effort to enter. Nothing worked 100%, and the failure rate on some of the more obscure books was very high.
Not sure if this will help - https://aws.amazon.com/rekognition/
Using computer vision may provide a good enough result for this use case. An interesting approach would be to segment the book piles and bulk scan the spines. There are projects that already tackled this problem:

https://www.cs.bgu.ac.il/~ben-shahar/Teaching/Computational-...

Won't be as accurate as barcode scanning, but will be definitely less time consuming.

That's fantastic. I was after a similar solution and after playing with OpenCV, I can see how they put the pieces together.

Annoyingly, I was trying to scan multiple books in charity shops, when one of my favourites started putting their own stickers directly over the barcode (when it existed).

Ask a professional. And by that I mean - get in touch with Jason Scott: https://twitter.com/textfiles
If we say books and professional, I think of the Internet Archive. They developed their own software which is used on the TT Scribe system, see https://archive.org/details/tabletopscribesystem. These people run an amazing operation, but even for them this still involves a lot of manual labor. In the end, what it takes is a person to grab a book and type in the title.
Jason Scott is the Internet Archive's Free Range Archivist.
HI
Is it true what vessenes said above about the Internet Archive receiving a dataset of book spines? And would it be possible for the IA to release that dataset publicly?
(comment deleted)
Google has a Books API. Look into that. There are smartphone apps that solve the problem of books that have barcodes. No matter what, this will be a huge task to complete. I scanned my small library (2-3 shelves) and was quite tired of it in the end.
For books that are not that old, you will often find the info you need on the copyright page - for US publications, the Library of Congress CIP info is there; see http://www.loc.gov/publish/cip/ . Other countries have similar programmes eg the British Library does the same.
Goodreads has a scanner in their app (on iOS/Android) that can scan covers although for some reason it automagically adds those books into a "to-read" shelf but I guess this isn't a problem for you if you create an account for the purpose.

The API is severely rate-limited (1rps), non-standard oath and badly documented, but you should be able to get some xml out of it and parse that however you'd like.

Also, you can download the book information in a CSV format.
I'm wondering about the option of having a (cheap, not worth stealing) smartphone, with the Goodreads app on it, logged in to the Goodreads account for this place. People who come in are asked to use it to scan 10 books, and move them over to the "scanned and catalogued" shelves, in addition to paying the $1 fee to get a book. Most people would be fine with that, and over time you get it all scanned.

Goodreads cannot recognize anything, but since it works on either book cover or barcode it will work on lots.

simple approach would be to ask book lovers around the locality to volunteer with this task. Borrow some barcode scanners and computers. Give'em whatever books they like and it's kinda get-together for bibliophiles.
The amazon seller app does exactly this. I think eBay might have it built in as well, but I’m fairly certain with amazon you can scan the barcode or cover of a book.
Zotero (the free software reference manager) hooks into a bunch of online catalogues. You can use Zotero to manage books (I manage my own collection with it, but that's just a small personal home library of around 1000 books).

If a book has an ISBN, often Zotero will manage to find it using the magic lookup button. Just enter the ISBN (DOI's work too!) and it will usually find the book you meant. That covers about 90% of books with an ISBN.

The rest would have to be entered manually.

Zotero is not a full-blown inventory manager, but it may suit your needs.

First, is this really a problem that needs to be solved? Personally, his place sounds like my favorite kind of book shop. A lot of bookworms prefer wandering through dense forests of precariously-balanced piles of books. Is he getting those people, or is he getting people that are expecting Barnes & Noble?

If they really do need to be cataloged, then the next thing is to forget all about trying to inventory the entire thing. Instead, you're going to partition the collection into "easy to catalog" and "hard to catalog": pick a section of the barn and make this the organized area. Get a barcode scanner (https://www.newegg.com/Barcode-Scanner/SubCategory/ID-583) and throw together a quick API client that'll take an ISBN and display a title, author, edition, and picture. If it comes up correct, great: book goes into the cataloged section. If it doesn't, it goes somewhere else. Make it really simple, so that a single keystroke can accept that book into inventory.

Grocery stores have to regularly inventory everything on the shelves. I worked for an outfit once that wanted to do it all in-house, so we bought the commercial Telxon handheld wireless devices and I set about figuring out their software. Turned out that they just wanted to speak basic telnet to a server at a pre-configured IP address, so I put together a sloppy little telnet server interface and staff were able to count the entire store right on the devices in a few hours. That's way more complicated than what you'll need to do, so, y'know, your thing is doable. You'll have the added benefit of free online book databases and better hardware and easier-to-hack-together software.

Also might not be a bad idea to talk to your local librarian. They're book nerds too and he or she might have an actual library science degree. This would be right up their alley.

> First, is this really a problem that needs to be solved?

For insurance purposes, probably, yeah, especially if there's anything rare, antique, valuable, etc.

I doubt old guy with barn full of books is looking to insure his rare books.
Maybe he would, if the thought weren't so daunting.
Instead of creating an app for managing the books and integrating with Amazon API, I'd suggest Calibre which is an excellent open source ebook app. You can use it to manage paper books as well, and it will download all metadata from a given ISBN including Amazon ratings, cover page and so on.

https://dearauthor.com/ebooks/dear-jane-ebooks/dear-jane-can...

A dozen actions to get each book in the system sounds OK if you're adding a book every day, or a few books a week/month, not to input hundreds or thousands.
> Also might not be a bad idea to talk to your local librarian. They're book nerds too and he or she might have an actual library science degree. This would be right up their alley.

I second this. Also, maybe check with university libraries or university MLS/MLIS programs (Masters of Library Science). This is not a new problem, and they would be aware of existing tools/methodology. Also, maybe you could get a grad student/intern to help.

Smartphones of both flavours can load cheap or free apps that are quite effective enough to read barcodes and identify books. Librarything and its various catalogue tools can help with the metadata too. That said, the advice to get specialist help is well-founded.
(comment deleted)
One of these days I need to write my essay titled "Rubbish has no SKU".

I've seen a few of these, and the basic minimum difference between "pulp waiting to happen" and "bookshop" is basic shelving. Different shelves by category: fiction vs non-fiction and their subdivisions. Within the shelves, alphabetise. Now it's possible for browsers to actually find things. When you put them on Amazon this will also help find them for shipping.

This process will also help you find the stacks of duplicates. You'll have a crate of 50 Shades and Twilight and Stephen King. The Stephen King will eventually resell; the others won't.

This page from the excellent Barter Books on their acceptance policy may be of some help: https://www.barterbooks.co.uk/html/About%20Us/Incoming%20Boo...

At a local LP shop, they had a sign saying "If you misshelve a LP, you might as well steal it, at least someone will listen to it" (approximate translation).

Shelving in instead central to many specialty shops!

Yes, but there is something to be told for wading through mountains of junk to unearth something notable, I think many book nerds connect to that feeling.
One banana box full of random books: sure. Fun to dig into and see what's there.

Twenty unsorted banana boxes: every book just becomes a blur (as in, “Oh great, another Danielle Steele novel, and another bible, and another Excel 97 for dummies, …”).

I’m not the world’s biggest bookworm but I go to Goodwill almost every week and look through the used books for sale. The most fun part is browsing because I never go in knowing what I’m looking for.
That is only fun because they already cataloged them for you. They made a little collection "used books for sale" with just the right size for you to enjoy browsing through. Now imagine you run into a barn full of books, a couple of containers outside, unsorted, all labeled "used books for sale" and no way to tell which were there last week and which weren't. At best you can visit 1% of the books this week, and next week the same 1%, or maybe another. That's what the issue is here.

Most people do not enjoy that more then once or twice.

While I largely agree with your sentiment, I'd like to note that alphabetizing only assists those who know what they are looking for.

In a bookstore, this is a virtue. But we appear to be dealing with a book barn. Perhaps the patrons of book barn have not wandered in by accident while searching for a bookstore :)

For OP: I think you might be better off photographing the ISBN and then using a service or script to do a lookup and associate that with a cover and title. Various editions might not have their covers recorded in a database, and titles will give many dupes, but an ISBN will uniquely identify a book.

Additionally, OCR'ing stylized text is problematic. I wouldn't expect easy reading of covers, particularly of used books.

The challenge is, if the catalogued book is not immediately associated with where to find it if retrieving it later, all is in vain...
Ish. It would help with inventory anyway, by comparing data at point of scanning and point of sale - “we sold the last Stephen King, sorry”, “we do have a Twilight recorded, so it’s there, but you’ll have to find it...”
You need to stick a barcode on the location (shelf, box, etc) like they do in a warehouse. Scan the book, check it is correct, scan the location to book it in. Doesn't have a barcode, put it in another area for later. I wrote a sketch of exactly this once...
I wonder if OP has considered the 'next' step: what to do with the referenced data. If it's just to catalog for ease of search or to help identify potential jewels, keepers, junk and then price appropriately.

The answer to this is important in order to properly size the effort. If the goal is to impove the business efficiency of the store, then it should be seen from ROI stand-point. Even the fellow customers/rummaggers could be engaged with a right incentive and tools. Otherwise, the next estate books container shipment will negate the gains of ordering.

Basically, is OP ready to overhaul the operations or is just willing to do something nice just for now?

Ideally, a book cover and info page should be scanned/photo'ed on first touch either by receiver or shopper and sticker coded somehow as processed, then left wherever. In case any jewel-worthy titles uncovered from OCR, the book could be located (stickerwise, date log, crate, whatever) and brought to prominence and priced as appropriate.

Unleashing imagination, as an incentive and QC strategy - some sort of automated OCR and lookup could locate the pointed book on amz or elsewhere and thus reviews and going price vs rummager's deal.

Either way, I'd see this more of a business question, rather than a technical one. Donating a technical solution is fun, but without changing the operations process is not going to be sustainable.

> Different shelves by category: fiction vs non-fiction and their subdivisions. Within the shelves, alphabetise.

I worked on a similar project, with thousands of books to organize. We did just that, because it seemed common sense. We had a couple of issues:

1. We found that sorting books by category took quite a lot of time. For every book we had to spend a couple of seconds deciding in which category it should go. By the time we started wishing we had put them all together, sorted only by alphabet, it was already late.

2. Shelving books alphabetically is a problem when they keep coming and going. How do you know how much space to leave on the shelf for a specific letter? Maybe now you have 10 books by Stephen King, but the next container will have 50 more. If you don't leave enough space you'll have to shift all the books after that letter.

> If you don't leave enough space you'll have to shift all the books after that letter.

This is what card files were originally invented for— number all the shelves, put your new book wherever there’s room, and put a card with the title and shelf number in a sorted drawer. When you get rid of the book, get rid of the card.

That works well for closed stack collections. Open ones, not so much.
(comment deleted)
Use one of the solutions listed below, but you HAVE to do sorting on the fly. You need to have places to put books and sort them by some general genres and you HAVE to throw out books that aren't worth the time due to damage or any other reason a book would be deemed a recyclable. With that many books, a proper library style cataloging system may be your best bet.

That being said, if you do want to do image comparison for covers, books without covers usually have a copyright page with most of the info on it. Use that to determine what a book is when the other method fails. Throwing together some cheap bookshelves with plywood and 2x4's will greatly help with the finding part, but while scanning use some big bins to do a rough sort.

And I can't stress enough you HAVE to throw out books. It's clear that there's a space issue and if he's willing to get them for free but has a hard time getting rid of them, that's hoarder behavior, not just eccentricity.

I used Tellico to scan my library, it can automatically lookup the books from Amazon with their ISBN if you have a barcode scanner (else you have to type them by hands...)

http://tellico-project.org/

Amazon shutdown that API last fall, I think. I've been using one of tellico's other options since then. (I don't remember which offhand.)
You might try Delicious Library: https://delicious-monster.com
I was going to second that; it's the first thing that came to my mind—but then it doesn't work for books without barcodes (or does it now?). I worked with version 2 a while back, it was great. The iPhone app to scan books without the laptop nearby requires version 3 though. The Mac app could also check the price the book sells for online.
The easiest way by far is to download Goodreads and use the barcode scanner in their app and their lists feature.
It may very expensive in time and resources to scan it all even if it is just the covers. You need to work out how long it takes to fetch a book from the barn or container, flatten/unbind if necessary, scan the cover, rebind, and put back. Then multiply by how many books...

I worked at a small startup in the early 2000s that somehow got massive contract to digitalise a Middle Eastern Oil & Gas company's very very extensive documentation library. We had an e-learning product where you could use a scanner to digitalise a printed book into online documentation.

Demos of scanning a book or two was really impressive. So surely scanning more than a million books/manuals/charts will be just as easy. Not quite.

Think we calculated it would take years as the bottleneck is the manual unbinding and re-binding before and after scanning. Scale that to a million and it was not the 2 months project initially forecasted. Buying more scanners and hiring more local staff scaled that part horizontally and improved the speed but still a long project.

However the client "forgot" to pay us for a few months, the bank and our accountants forgot to check and we went bankrupt soon before we really got started. Though at least I got a trip to the Middle East for a few weeks.

I think “scan” here was in the sense of “scan the ISBN to catalogue the book”, not scan the insides. Since many of these are old books, many of them will not be perfect bindings. Scanning their contents therefore either requires opening the books and moving the pages (as Google Books did) or cutting the spine, which would be highly unhelpful since that would preclude any rebinding of the books into anything other than a perfect binding, reducing strength, repairability, and the ability to fold flat.
This sounds like a use-case inventaire.io ought to support. I'll try to ask them about it. They use wikidata for filling up book metadata.

Otherwise, as stated elsewhere in this thread, Zotero can usually find books with very little information:ISBN or title. It might be worth trying to set up an OCR with it.

In any case, if you go to the length of taking a picture for each book, you might as well save them and make the dataset public, for OCR training purposes (and a second pass). There is also the mechanical Turk option if you go this way.

And as someone stated already, you should plan the physical layout in advance.

yep, inventaire.io could help there, to some extent: they could scan books barcode in bulk from the webapp https://inventaire.io/add/scan , which should find data for most books. But then it gets tricky for books without barcode/ISBN has they would probably have to fill the data manually, which can be quite some work for large inventories. No plans to add OCR, yet ;)
My plan for books is to pull the rare/valuable ones, then subscribe for the $100/mo 100 book/mo plan at http://1dollarscan.com/ and send them all the rest, produce PDFs, and pulp the books. I have maybe 3000 books in storage and this would be preferable to anything else I've found, as I ultimately would rather consume them electronically.
1DS $100/month is about 30 books of ~300 pages (3+ "sets" of 100 pages, rounded up).

Scanning is only worthwhile for books which are not already available in electronic form ... somewhere.

If you bought from Amazon, there's sometimes an option to get the ebook cheaply. Archive.org has many books. There are also e-books at public libraries, so it may be enough to keep a list/photos/calibre of all your titles and discard rarely-accessed books.

Don’t forget about the Dewey decimal system. For the books with ISBNs, you can sort them into boxes by their Dewey decimal. If you don’t have time manually categorize the books without ISBNs, they can be put into “other” boxes and left unsorted
Library of Congress catalog information is more generally available, by ISBN if not already on the copyright page. For any conventionally published book since 1970.

http://eresources.loc.gov

Use a OCR service such as Firebase ML Text kit or the Amazon's similar offering or something and take pictures cover by cover, ping an API - even amazon or ebay might do to see if it exists and price of the book on average.

It also shouldn't be hard to up the speed by taking pictures of a stack of books - if you take an image of a stack of books and crop it book by book, training models to recognise books shouldn't be that hard but you could also use a CV solution (firebase, amazon, azure again) and then from the books it found in the stack ping the API for each one. This could probably be the fastest way if you can take a panorama and have it search from that.

Anyways, if you do it - try to get the price, ISBN and editions from the results.

Maybe light hardware scanner will be helpful, something like workers use in warehouses.