JakeTurner616 commited on
Commit
ac7e13d
·
verified ·
1 Parent(s): c71682d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -52
README.md CHANGED
@@ -17,113 +17,125 @@ pretty_name: mtg card SIFT Feature dataset
17
  size_categories:
18
  - 100K<n<1M
19
  tags:
20
- - v5.0
21
  ---
22
 
23
- # MTG Card SIFT Features Dataset (v5)
24
 
25
  ![demo](https://github.com/JakeTurner616/simple-mtg-feature-extraction/raw/main/docs/feature-detect.gif)
26
 
27
- This dataset contains the latest output of my Magic: The Gathering (MTG) card image feature extraction pipeline, now upgraded to **version 5**. This release is designed for **incremental model growth**, allowing descriptor and ID map updates **without retraining from scratch** ideal for server-side production use.
28
 
29
- > **Note:** Version 5 introduces additive updates to the FAISS index and `id_map.json`, enabling true incremental inference pipelines.
30
 
31
  ---
32
 
33
- ## What’s New in v5?
34
 
35
- | Feature | v4 (Previous) | v5 (Current) |
36
- | -------------------- | ---------------------- | ---------------------------------------------- |
37
- | Index update | Full rebuild required | Additive-safe incremental indexing |
38
- | ID map behavior | Rewritten each time | Appended in-place to preserve alignment |
39
- | Feature pipeline | Batch-oriented | Fully resumable and append-safe |
40
- | Format compatibility | `.h5 + .json + .index` | Same, now stable for long-term use |
41
- | RAM usage | Low (<500MB typical) | Still low, with improved batching and flushing |
42
 
43
  ---
44
 
45
- ## File Layout (resourcesV5.zip)
46
 
47
  ```
48
  resources/
49
  └── run/
50
- ├── candidate_features.h5 # HDF5 with keypoints + descriptors per card
51
- ├── faiss_ivf.index # FAISS IVF-PQ index (incremental-safe)
52
- └── id_map.json # Linear descriptor-to-scryfall_id mapping
53
  ```
54
 
55
-
56
  ---
57
 
58
  ## What Is This?
59
 
60
- This is a high-precision visual descriptor dataset for Magic: The Gathering cards, intended for computer vision applications such as visual search, real-world scanning, and inference pipelines.
 
 
 
 
 
 
 
61
 
62
- ### Pipeline Summary
63
 
64
  1. **Image Acquisition**
65
 
66
- * Cards are fetched via the Scryfall API.
67
  2. **Preprocessing**
68
 
69
- * Images are resized with aspect ratio preserved, processed via CLAHE (L-channel), and converted to grayscale.
70
- 3. **SIFT + RootSIFT**
71
 
72
- * Keypoints are detected using OpenCV’s SIFT; RootSIFT normalization applied for FAISS compatibility.
73
- 4. **Efficient Storage**
74
 
75
- * All features and keypoints are stored in an HDF5 file (`candidate_features.h5`) with gzip compression.
76
  5. **Indexing**
77
 
78
- * Descriptors are indexed using FAISS IVF-PQ or FlatL2 depending on scale.
79
- * Index grows over time as new cards are processed.
80
  6. **Mapping**
81
 
82
- * A flat `id_map.json` file aligns descriptor index rows to `scryfall_id`s.
 
 
 
83
 
84
  ---
85
 
86
- ## Supported Use Cases
87
 
88
- * 🔍 **Visual Search**: Find the closest matching MTG card from a photo.
89
- * 🤖 **Model Inference**: Use as a lookup backend in a card recognition app.
90
- * 🔁 **Incremental Updates**: Continue indexing new cards without retraining.
91
- * 📦 **Dataset Analysis**: Explore descriptor density and clustering across cards.
92
 
93
  ---
94
 
95
- ## Integration Workflow (Back-End)
96
 
97
  ```text
98
- [Input: Cropped Card Image]
99
-
100
- [CLAHE Grayscale → SIFT RootSIFT]
101
-
102
  [FAISS IVF-PQ Search]
103
-
104
- [Descriptor match → ID mapping]
105
-
106
- [Return most common scryfall_id]
107
  ```
108
 
109
  ---
110
 
111
- ## Key Benefits
112
 
113
- ✅ No SQLite or database state required
114
- ✅ Works seamlessly with FAISS, NumPy, and h5py
115
- Handles partial runs and resumes automatically
116
- Small memory footprint and parallel-safe
117
- ✅ MIT Licensed freely usable and extendable
118
 
119
  ---
120
 
121
  ## Acknowledgments
122
 
123
- * Created by [JakeTurner616](https://github.com/JakeTurner616)
124
- * Based on images and data from [Scryfall](https://scryfall.com/docs/api)
125
- * Uses [FAISS](https://github.com/facebookresearch/faiss), [OpenCV](https://opencv.org/), and [h5py](https://www.h5py.org/)
 
 
 
 
126
 
127
  ---
128
 
129
- For more technical details, visit the [workflow notebook](https://github.com/JakeTurner616/simple-mtg-feature-extraction/blob/production/workflow.ipynb) or open an issue on GitHub.
 
17
  size_categories:
18
  - 100K<n<1M
19
  tags:
20
+ - v5.1
21
  ---
22
 
23
+ # MTG Card SIFT Features Dataset (v5.1)
24
 
25
  ![demo](https://github.com/JakeTurner616/simple-mtg-feature-extraction/raw/main/docs/feature-detect.gif)
26
 
27
+ This dataset contains the **latest incremental MTG card SIFT + RootSIFT feature extraction pipeline**. It is designed for **server-side production inference**, enabling **additive updates to the FAISS index and `id_map.json`** without retraining or reindexing from scratch.
28
 
29
+ > **Note:** This version aligns with a daily `resources-nightly.zip` Hugging Face upload workflow for reliable continuous deployment via my production server.
30
 
31
  ---
32
 
33
+ ## What’s New in v5.1?
34
 
35
+ | Feature | v5.0 | v5.1 (Current) |
36
+ | -------------------- | -------------------------- | ----------------------------------- |
37
+ | Index updates | Additive-safe | Same |
38
+ | Upload workflow | Manual or ad-hoc | Integrated with HF nightly pipeline |
39
+ | Logging | Basic | Detailed zipping and upload logs |
40
+ | Service impact | Potential blocking uploads | Runs in background, non-blocking |
41
+ | HF dataset structure | Single zip upload | Same, consistent naming |
42
 
43
  ---
44
 
45
+ ## File Layout (`resources-nightly.zip`)
46
 
47
  ```
48
  resources/
49
  └── run/
50
+ ├── candidate_features.h5 # Keypoints + descriptors per card (gzip HDF5)
51
+ ├── faiss_ivf.index # FAISS IVF-PQ index
52
+ └── id_map.json # Descriptor index-to-scryfall_id mapping
53
  ```
54
 
 
55
  ---
56
 
57
  ## What Is This?
58
 
59
+ A **high-precision visual descriptor dataset** for Magic: The Gathering cards, used for:
60
+
61
+ ✅ **Visual Search**
62
+ ✅ **Mobile/Server Card Scanning**
63
+ ✅ **FAISS-based Similarity Search**
64
+ ✅ **Incremental Model Growth**
65
+
66
+ ---
67
 
68
+ ## Pipeline Summary
69
 
70
  1. **Image Acquisition**
71
 
72
+ * Fetched from Scryfall using official API.
73
  2. **Preprocessing**
74
 
75
+ * Resize with aspect ratio, CLAHE on L-channel, grayscale conversion.
76
+ 3. **Feature Extraction**
77
 
78
+ * OpenCV SIFT + RootSIFT normalization.
79
+ 4. **Storage**
80
 
81
+ * `candidate_features.h5` using gzip compression.
82
  5. **Indexing**
83
 
84
+ * FAISS IVF-PQ (100 clusters, 8x8 PQ), additive updates supported.
 
85
  6. **Mapping**
86
 
87
+ * `id_map.json` aligns descriptors to `scryfall_id`.
88
+ 7. **HF Upload**
89
+
90
+ * Zipped nightly, uploaded to HF dataset repo in the background.
91
 
92
  ---
93
 
94
+ ## Use Cases
95
 
96
+ **Real-time card scanning** for Magic: The Gathering
97
+ **Card image search pipelines**
98
+ **Local inference on low-resource servers**
99
+ **Model growth without reindexing**
100
 
101
  ---
102
 
103
+ ## Workflow (Simplified)
104
 
105
  ```text
106
+ [Input Image]
107
+
108
+ [CLAHE + SIFT + RootSIFT]
109
+
110
  [FAISS IVF-PQ Search]
111
+
112
+ [Retrieve scryfall_id]
113
+
114
+ [Result]
115
  ```
116
 
117
  ---
118
 
119
+ ## Why v5.1 Matters
120
 
121
+ **No SQLite required**
122
+ **Works with h5py + NumPy**
123
+ **Parallel-safe and resumable**
124
+ **Tiny memory footprint**
125
+ **MIT Licensed for free, unlimited use**
126
 
127
  ---
128
 
129
  ## Acknowledgments
130
 
131
+ Created by [JakeTurner616](https://github.com/JakeTurner616)
132
+ Powered by:
133
+
134
+ * [Scryfall API](https://scryfall.com/docs/api)
135
+ * [FAISS](https://github.com/facebookresearch/faiss)
136
+ * [OpenCV](https://opencv.org/)
137
+ * [h5py](https://www.h5py.org/)
138
 
139
  ---
140
 
141
+ For deep implementation details, see the [mtgscan.cards monorepo](https://github.com/mtgscan-cards/monolithic).