Skip to content

tgrunnagle/mtg-deck-scanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mtg-deck-scanner

Generate MTG decklists from a webcam

Repo setup

Requirements

  • Python 3.10
  • On windows, set EOL to LF:
git config --global core.autocrlf false
git config --global core.eol lf

venv

py -3.10 -m venv env
# on macOS
source env/bin/activate
# on windows (in powershell, Set-ExecutionPolicy RemoteSigned)
.\env\Scripts\activate
# exit venv
deactivate

# install basic requirements
pip install --upgrade -r requirements.txt

.env

Create a .env file in the root of the repository, populated based on .env_example.

llama-cpp-python (windows) w/ cuBLAS

Must be installed separately from pip install -r requiements.txt. See this guide. (This take a few minutes).

set CMAKE_ARGS=-DLLAMA_CUBLAS=on
set FORCE_CMAKE=1
pip install llama-cpp-python --no-cache-dir

Pytorch

Install based on these instructions. e.g.

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Guide

Initial work based on this guide.

Vector database

Weaviate DEPRECATED

Using Weaviate.

Docker compose guide.

docker compose -f docker/weaviate-compose.yml up --detach

Qdrant

Using qdrant.

Docker image:

docker pull qdrant/qdrant
docker volume create mtg-deck-scanner-qdrant-vol
docker run -d --name mtg-deck-scanner-qdrant -p 6333:6333 -v mtg-deck-scanner-qdrant-vol:/qdrant/storage:z qdrant/qdrant

Scryfall

The scripts should automatically download the "Unique art" bulk data file.

Run

Populate vector db

This step embeds the card image vectors from the Scryfall images linked by the bulk data file. It uses the OWL-ViT model.

python ./src/populate_db.py

This process takes ~45 minutes (for ~45k cards) depending on your setup.

Generate decklists

This step generates .txt files of card names based on images captured by webcam.

python ./src/create_decklist.py

About

Generate MTG decklists from a webcam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages