The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
MTG card SIFT Features dataset
This package contains the outputs of our Magic: The Gathering (MTG) card image feature extraction pipeline. This resource bundle provides all the necessary components to perform image similarity and retrieval tasks using extracted SIFT features:
SQLite Database (
card_database.db
):
Contains metadata for each card image with unique art. Each record holds the card's unique identifier (scryfall_id
), its image path, and a face index.HDF5 Features File (
candidate_features.h5
):
Stores the SIFT keypoints and descriptors for each card image. The features are organized by card (usingscryfall_id
) and further segmented by extraction instances.FAISS Index (
faiss_ivf.index
):
An IVF FAISS index built using Product Quantization (PQ) over the extracted SIFT descriptors. This index supports fast nearest-neighbor searches for tasks like image retrieval or similarity matching.FAISS Mapping (stored in SQLite):
The mapping is stored in a table (e.g.,faiss_mapping
) within the same database. This approach centralizes all mapping information in a single database, simplifying batch processing.
Below is the directory structure of the zipped resources package:
resources/
└── run/
├── card_database.db # SQLite database with card metadata and FAISS mapping table
├── candidate_features.h5 # HDF5 file containing extracted SIFT features
└── faiss_ivf.index # FAISS index for fast image similarity search
What Is This?
This resource bundle is not a traditional neural network model. Instead, it is the product of a complete feature extraction workflow, where:
- Images:
PNG images of MTG cards (stored in theimages/
folder) were processed. - Feature Extraction:
OpenCV's SIFT was applied to extract keypoints and descriptors. The images underwent preprocessing steps such as resizing, conversion to LAB color space (with CLAHE), and grayscale conversion to ensure robust feature extraction. - Storage:
The extracted features were stored efficiently in an HDF5 file using high-level gzip compression and chunking. - Indexing:
A subset of descriptors was used to train a FAISS index (with IVF and Product Quantization) which was then incrementally updated with the full set of descriptors for rapid similarity searches. - Mapping:
Instead of using an external mapping file (index_to_card.txt
), the FAISS descriptor-to-card mapping is now maintained in a dedicated SQLite table (faiss_mapping
). This makes the process more integrated and simplifies both indexing and inference workflows.
How Were These Artifacts Created?
Database Setup:
A SQLite database was created by scanning animages
folder for PNG files. Each image’s filename (formatted asscryfall_id_faceindex.png
) provided the metadata used to populate the database.Feature Extraction Pipeline:
- Preprocessing: Each image is resized and enhanced to maximize the quality of the SIFT features.
- SIFT Extraction: Features are extracted using SIFT, normalized, and then stored in a compressed, half-precision format.
- HDF5 Storage: The features are stored in a hierarchical structure (organized by card ID) within an HDF5 file.
- Mapping & Indexing: A training sample of descriptors is used to build a FAISS index. As descriptors are added to the index, their FAISS index positions are recorded in a new SQLite table (
faiss_mapping
), which replaces the previous method that used an external text file.
Index Construction:
- A training sample of descriptors is used to build a FAISS index.
- Descriptors are added incrementally in batches, and a mapping table records which descriptor corresponds to which card.
Why?
Philosophy:
This project documents research in effective feature detection on par with card scanning apps like TCGplayer and ManaBox.Efficient Storage:
The HDF5 format allows for rapid reading/writing and efficient storage of large amounts of feature data.Fast Retrieval:
The FAISS index enables efficient nearest-neighbor searches, making it possible to quickly retrieve similar card images based on their visual features.Integrated Mapping:
By storing the descriptor-to-card mapping directly in SQLite (instead of a separate file), the system is more robust and easier to manage, particularly during batch processing and incremental index updates.
Use Cases
- Image Retrieval:
Quickly find cards that look similar based on SIFT features. - Duplicate Detection:
Identify near-duplicate images in a large dataset. - Research & Analysis:
Study the distribution of visual features across different card types. - Workflow Extension:
Easily update the feature dataset to support new cards without maintaining separate mapping files.
Further Details
For an in-depth explanation of the workflow, including the preprocessing steps, feature extraction techniques, and indexing strategies, please refer to the complete workflow notebook.
Caveats and Future Improvements
- Dataset Specificity:
The current pipeline is tailored for MTG card images. Adjustments may be needed for other datasets. - Feature Extraction:
While SIFT works well for this application, exploring alternative or complementary feature extractors could yield even better results. - Scalability:
The FAISS index parameters (e.g., number of clusters, batch sizes) might need to be tuned for larger datasets. - Mapping Integration:
The updated approach integrates the mapping into SQLite, which simplifies batch processing and removes the need for an externalindex_to_card.txt
file.
For further clarification on this project, please refer to the workflow notebook or leave an issue.
- Downloads last month
- 88