Like a lot of true collectors here I use a flatbed scanner to scan my graded cards for documenting as well as for uploading pictures to my eBay store, However my OCD and thirst for efficiency would always present me with the following issues:
I scan four cards at a time on pokedreamer’s scanner frame and cropping all four images is tedious
slabs are rounded and crops are square, so you end up with little corner slivers of black or white around your card and it’s just not aesthetic
eBay uses square ratio for all it’s thumbnails, so a vertical card crop ends up having that boring default light grey border around your card
So instead I used a combination of photoshop templates and manual work to cut each graded card out with rounded corners, place it on my preferred backdrop color of Eigengrau, and center it within a square aspect ratio. The problem is this took way too long and has little to no effect on my sales.
Example of a processed scan ready for uploading to eBay
After enough rationalizing to myself that this was “worth it” I decided to try and automate this process as both a learning experience and way to stop wasting hours in photoshop.
First I made three folders of images holding specific datasets:
raw images of my scans, using a variety of card orientations and styles to get a smarter model
“ground truth” alpha maps of those scans where the cards should be cut out
another set of raw scan images not in the first set to validate the machine learning model
Which basically gives the algorithm a cheat sheet to learn what it’s supposed to do - this is what they looked like:
black and white images where the white represents the card being cut out
For training the machine learning model, I used this open source library which only took me a full day of fussing with my development environment to get running but once it did it was beautiful:
But of course I need every card by itself as it’s own square ratio image on a nice dark grey, so next I wrote a python script using Pillow and OpenCV to programmatically detect the contours of a card, read the cert number for its filename, and then save that card out with my desired aspect ratio and background image. Shoutout to Chat GPT which helped me write most of this script. I repeat this process for the scan for the back of the cards and the end result is an output folder which I can easily upload to my eBay listings:
I exclusively use this script to prepare slab scans now and it’s taken my time to process a PSA return from an hour or two down to seconds (minus physical scan time). After a couple dozen more PSA submissions I might have saved enough time to make up for what I spent writing this script and thread. Cheers!
That’s really cool. Honestly looks really good without the square corners on the slabs. This is what AI is cool for. The art AI is cool and all, but this simplifying a task that took you forever manually is awesome.
Super cool, thanks for sharing. It looks like it’s an extension of the convolutional neural network. Here’s the full article for nerds. This kind of thing is way over my head, but I love to see applications in one area of science/technology be applied to other areas like hobbies!
This is cool . I also do something incredibly similar, with a pricing database that uses ML to predict price points for grades which don’t exist. It’s fun, but it’s also my day job so I try not to spend too much time doing this stuff outside of work .
Really nice scans though, and I’m sure that helped the model learn (I would argue that at that quality, consistency and low number of placements) a heuristic model rather than ML would be more than sufficient. Out of curiosity, what scanner are you using?
I’m not ready to make my spaghetti code public just yet, but part of posting this thread was to see if there was interest in others using it, so I may work on making it into a proper app.
There is also lots of AI services for removing stuff from it’s background that probably work just as good if not better but I wanted to learn how to do it myself.
Was hoping actual data scientists might chime in with ways to improve or simplify the process but yeah I don’t do this type of work in my day job so it’s still “fun” for me.
I use the Epson Perfection v600 scanner, with settings that i’m pretty sure I got from a @Coop13 post but can’t find the original