Looking for an image recognition api

I have an idea for a program to catalog Magic cards and am looking for an image recognition api I could use. I have a complete set of images to search against and would want to take a webcam (or similar) image of a card and have the api tell me what image from the set of images it thinks it is. Most I have seen will tell you if there is a person, or a whale in the picture. I specifically want what picture from the data set it is.

I looked at Clarifai but at 5000 searches a month, that isn’t really enough in the short term. I have like 100,000 to sort through. I would prefer something that can run locally and have a Dell R710 to run it on for some horsepower (albeit old) .

My friend who is an engineer at Dart Container is going to help me build a feeder/sorter system that can take a stack of cards and work it’s way down the stack, pushing cards left or right depending on it’s criteria.

Anyone have any suggestions?

You could look into TensorFlow

But I cannot really help you with that. I never touched python and I never really did any real machine learning. So there is that.

TensorFlow seems like the most popular framework to me (for ML). Although for things like ‘I just wanna recognize images’ there may be easiely things to use. I still think (if you can) learning tensorflow can give you a h3ll of a lot more options. So it is worth it.

Curious what others will suggest though.


Since then have actually had a reason to use it. They have a separate image recognition API. It’s really not that hard. The hardest part is installing tensorflow… (Btw don’t waste your time installing python from the windows Store, it’s a trap). The rest is knowing what to use but it’s all pre-made. It’s a lot of trial and error. There are a bunch of general purpose models on their “model zoo” site that you can base your model off and a bunch of parameters to change. It really does not feel like programming at all tbh.

In my case the purpose was data matrix detection. While there are many libraries that theoretically do this. The only one I found that actually picked up the tiny circles on metal that may or may not have a shiney coating with absolutely inconsistent lighting conditions was incredibly expensive. After failing miserable with circle detection without ML I tried tensorflows image detection and the result is surprisingly good with surprisingly little images required (like 20 or so). Ofc the thing only works for that specific usecase now it won’t fly as a general purpose data matrix reader for other different looking codes.

Those models also detect an amount of objects that is pre-defined at training time. It will always detect exactly that many objects. You have to put in a number big enough so it can detect the maximum amount of objects you expect. The extras you can then filter out with the confidence rating it assigns for every detection. Again even more trial and error.

1 Like

I can tell you image recognition is overkill for this, Use something like an OCR (optical character recognition) engine for this and just search the text against a known DB of magic cards. way easier and efficient.

Some helpfull links for this project

An ocr engine:

The python lib for it:

MTG card db:

Might have misinterpreted why you where doing it, if you want something to monitor a live game of magic trough a webcam you could just train a model to recognize cards (not the specific kind but just a card in general) and then feed the part of the image recognized as a card trough what i described above. it is way less black boxy (if that is a word) and less error prone/easier to maintain when new cards show up.

Hey! I’ve not completed this yet, though I still intend to. I did think of OCR but I think there would be an issue in determining what printing of a card it is. In Magic, the same card can come from multiple sets (called a printing here) and the recognition would need to be able to determine what set it is. The set is not represented by text on the card, but changes to the art, border, or set symbol.

Sounds like a fun project. I thought you wanted to know what the cards were game-wise, but apparently it is more based on the print/value

Do You have a properly labeled dataset? if you want to make image recognition happen the most important thing is: “quality of input = quality of output”

Maybe post some representative examples on a repo and share them on here

I used a site called scryfall.com to get source data and images. They have some great APIs and high res images. I used their bulk data to populate a database I built that I feel does a good job representing the complexities of MTG while being properly relational. I set the image names to the guid of the printing in the database.

I own a game store and MTG cards are a big part of what we do. There are systems out there that already do this sort of thing, but that’s no fun. Besides, I want to integrate into my other systems I have made for customers to request products, manage store credit, and what not.

6 posts were split to a new topic: Image Recongition API – Ethics Considerations

I do foresee some issues with this dataset, It is too clean. it will prevent proper generalization.

This will work if what you can feed it from the machine looks like that (no scratches, bumbs, creases, perfectly white balanced). but it will require you to do some preprocessing before feeding it into the IR part.

If you have the clean cards and know how damaged cards are generally supposed to look like. You could try to create the bad card images from the clean cards though. But yeah… most of the work is getting your hands on enough labelled data of the cards.

Especially color / white balanced seem fairly easy. Not so sure about other imperfections.

My best bet is write some shotty gui (doest have to look good). to label data from the actual machine. with as much cards as possible. the best dataset is the one from the exact source you want to operate on

I figured no matter what I will have to prepare a training set and set up a gui to run it through. I have a boat load of physical cards I can run through to work on training something.

Actually, looking up magic and image classification there are already a few attempts on this.

There is even this, which tries to do exactly what I kind of though you might wanna do. Generate dirty/faulty cards from perfect once.

Sorry to be off-topic. Has anyone used ready-made color palettes to create web projects?

You can look for ‘material color palettes’ you’ll find lots of online tools to generate one from a single main color.

That’s at least one way to do it.

I’ve been working as a web designer for about three years. In addition, I do professional Photoshop. As you can understand, color palettes are my primary working tool. When creating design projects, color is at the core of the workflow. For the last month, I’ve been primarily working with vintage style. I like to use the vintage color palette to create patterns for projects. I can also use the finished work in photoshop. Sometimes I upload illustrations and create beautiful visuals thanks to the color palette. I like that you can combine colors and create something new there.