Generate MTG decklists from a webcam
- Python 3.10
- On windows, set EOL to LF:
git config --global core.autocrlf false
git config --global core.eol lfpy -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.txtCreate a .env file in the root of the repository, populated based on .env_example.
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-dirInstall based on these instructions. e.g.
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118Initial work based on this guide.
Using Weaviate.
docker compose -f docker/weaviate-compose.yml up --detachUsing qdrant.
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/qdrantThe scripts should automatically download the "Unique art" bulk data file.
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.pyThis process takes ~45 minutes (for ~45k cards) depending on your setup.
This step generates .txt files of card names based on images captured by webcam.
python ./src/create_decklist.py