Instructions to use HanClinto/cornelius with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- CollectorVision
How to use HanClinto/cornelius with CollectorVision:
pip install git+https://github.com/HanClinto/CollectorVision huggingface_hub
from huggingface_hub import hf_hub_download import collector_vision as cvg checkpoint = hf_hub_download(repo_id="HanClinto/cornelius", filename="model.onnx") # Detector models, such as Cornelius: detector = cvg.NeuralCornerDetector(checkpoint) # Embedder models, such as Milo: embedder = cvg.NeuralEmbedder(checkpoint)
- Notebooks
- Google Colab
- Kaggle
fix: remove ImageMagick garbage from Usage, license MIT -> AGPL-3.0
Browse files
README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
tags:
|
| 4 |
- onnx
|
| 5 |
- object-detection
|
|
@@ -26,207 +26,46 @@ MobileViT-XXS backbone with a SimCC coordinate classification head, trained to l
|
|
| 26 |
|
| 27 |
## Outputs
|
| 28 |
|
| 29 |
-
- **corners** —
|
| 30 |
-
- **presence** — raw logit; unreliable on blank images, prefer sharpness gate
|
| 31 |
- **sharpness** — mean peak of the 8 SimCC softmax distributions; blank frames ≈ 0.008, valid cards ≈ 0.03–0.07
|
| 32 |
|
| 33 |
## Usage
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
-interpolate method pixel color interpolation method
|
| 69 |
-
-label string assign a label to an image
|
| 70 |
-
-limit type value Area, Disk, Map, or Memory resource limit
|
| 71 |
-
-monitor monitor progress
|
| 72 |
-
-page geometry size and location of an image canvas
|
| 73 |
-
-pause seconds seconds delay between snapshots
|
| 74 |
-
-pointsize value font point size
|
| 75 |
-
-quality value JPEG/MIFF/PNG compression level
|
| 76 |
-
-quiet suppress all warning messages
|
| 77 |
-
-regard-warnings pay attention to warning messages
|
| 78 |
-
-repage geometry size and location of an image canvas
|
| 79 |
-
-respect-parentheses settings remain in effect until parenthesis boundary
|
| 80 |
-
-sampling-factor geometry
|
| 81 |
-
horizontal and vertical sampling factor
|
| 82 |
-
-scene value image scene number
|
| 83 |
-
-screen select image from root window
|
| 84 |
-
-seed value seed a new sequence of pseudo-random numbers
|
| 85 |
-
-set property value set an image property
|
| 86 |
-
-silent operate silently, i.e. don't ring any bells
|
| 87 |
-
-snaps value number of screen snapshots
|
| 88 |
-
-support factor resize support: > 1.0 is blurry, < 1.0 is sharp
|
| 89 |
-
-synchronize synchronize image to storage device
|
| 90 |
-
-taint declare the image as modified
|
| 91 |
-
-transparent-color color
|
| 92 |
-
transparent color
|
| 93 |
-
-treedepth value color tree depth
|
| 94 |
-
-verbose print detailed information about the image
|
| 95 |
-
-virtual-pixel method
|
| 96 |
-
Constant, Edge, Mirror, or Tile
|
| 97 |
-
-window id select window with this id or name
|
| 98 |
-
root selects whole screen
|
| 99 |
-
|
| 100 |
-
Image Operators:
|
| 101 |
-
-annotate geometry text
|
| 102 |
-
annotate the image with text
|
| 103 |
-
-colors value preferred number of colors in the image
|
| 104 |
-
-crop geometry preferred size and location of the cropped image
|
| 105 |
-
-encipher filename convert plain pixels to cipher pixels
|
| 106 |
-
-extent geometry set the image size
|
| 107 |
-
-geometry geometry preferred size or location of the image
|
| 108 |
-
-help print program options
|
| 109 |
-
-monochrome transform image to black and white
|
| 110 |
-
-negate replace every pixel with its complementary color
|
| 111 |
-
-quantize colorspace reduce colors in this colorspace
|
| 112 |
-
-resize geometry resize the image
|
| 113 |
-
-rotate degrees apply Paeth rotation to the image
|
| 114 |
-
-strip strip image of all profiles and comments
|
| 115 |
-
-thumbnail geometry create a thumbnail of the image
|
| 116 |
-
-transparent color make this color transparent within the image
|
| 117 |
-
-trim trim image edges
|
| 118 |
-
-type type image type
|
| 119 |
-
|
| 120 |
-
Miscellaneous Options:
|
| 121 |
-
-debug events display copious debugging information
|
| 122 |
-
-help print program options
|
| 123 |
-
-list type print a list of supported option arguments
|
| 124 |
-
-log format format of debugging information
|
| 125 |
-
-version print version information
|
| 126 |
-
|
| 127 |
-
By default, 'file' is written in the MIFF image format. To
|
| 128 |
-
specify a particular image format, precede the filename with an image
|
| 129 |
-
format name and a colon (i.e. ps:image) or specify the image type as
|
| 130 |
-
the filename suffix (i.e. image.ps). Specify 'file' as '-' for
|
| 131 |
-
standard input or output.
|
| 132 |
-
Version: ImageMagick 7.1.2-13 Q16-HDRI aarch64 23522 https://imagemagick.org
|
| 133 |
-
Copyright: (C) 1999 ImageMagick Studio LLC
|
| 134 |
-
License: https://imagemagick.org/license/
|
| 135 |
-
Features: Cipher DPC HDRI Modules
|
| 136 |
-
Delegates (built-in): bzlib heic jng jpeg lcms ltdl lzma png tiff webp xml zlib zstd
|
| 137 |
-
Compiler: clang (17.0.0)
|
| 138 |
-
Usage: import [options ...] [ file ]
|
| 139 |
-
|
| 140 |
-
Image Settings:
|
| 141 |
-
-adjoin join images into a single multi-image file
|
| 142 |
-
-border include window border in the output image
|
| 143 |
-
-channel type apply option to select image channels
|
| 144 |
-
-colorspace type alternate image colorspace
|
| 145 |
-
-comment string annotate image with comment
|
| 146 |
-
-compress type type of pixel compression when writing the image
|
| 147 |
-
-define format:option
|
| 148 |
-
define one or more image format options
|
| 149 |
-
-density geometry horizontal and vertical density of the image
|
| 150 |
-
-depth value image depth
|
| 151 |
-
-descend obtain image by descending window hierarchy
|
| 152 |
-
-display server X server to contact
|
| 153 |
-
-dispose method layer disposal method
|
| 154 |
-
-dither method apply error diffusion to image
|
| 155 |
-
-delay value display the next image after pausing
|
| 156 |
-
-encipher filename convert plain pixels to cipher pixels
|
| 157 |
-
-endian type endianness (MSB or LSB) of the image
|
| 158 |
-
-encoding type text encoding type
|
| 159 |
-
-filter type use this filter when resizing an image
|
| 160 |
-
-format "string" output formatted image characteristics
|
| 161 |
-
-frame include window manager frame
|
| 162 |
-
-gravity direction which direction to gravitate towards
|
| 163 |
-
-identify identify the format and characteristics of the image
|
| 164 |
-
-interlace type None, Line, Plane, or Partition
|
| 165 |
-
-interpolate method pixel color interpolation method
|
| 166 |
-
-label string assign a label to an image
|
| 167 |
-
-limit type value Area, Disk, Map, or Memory resource limit
|
| 168 |
-
-monitor monitor progress
|
| 169 |
-
-page geometry size and location of an image canvas
|
| 170 |
-
-pause seconds seconds delay between snapshots
|
| 171 |
-
-pointsize value font point size
|
| 172 |
-
-quality value JPEG/MIFF/PNG compression level
|
| 173 |
-
-quiet suppress all warning messages
|
| 174 |
-
-regard-warnings pay attention to warning messages
|
| 175 |
-
-repage geometry size and location of an image canvas
|
| 176 |
-
-respect-parentheses settings remain in effect until parenthesis boundary
|
| 177 |
-
-sampling-factor geometry
|
| 178 |
-
horizontal and vertical sampling factor
|
| 179 |
-
-scene value image scene number
|
| 180 |
-
-screen select image from root window
|
| 181 |
-
-seed value seed a new sequence of pseudo-random numbers
|
| 182 |
-
-set property value set an image property
|
| 183 |
-
-silent operate silently, i.e. don't ring any bells
|
| 184 |
-
-snaps value number of screen snapshots
|
| 185 |
-
-support factor resize support: > 1.0 is blurry, < 1.0 is sharp
|
| 186 |
-
-synchronize synchronize image to storage device
|
| 187 |
-
-taint declare the image as modified
|
| 188 |
-
-transparent-color color
|
| 189 |
-
transparent color
|
| 190 |
-
-treedepth value color tree depth
|
| 191 |
-
-verbose print detailed information about the image
|
| 192 |
-
-virtual-pixel method
|
| 193 |
-
Constant, Edge, Mirror, or Tile
|
| 194 |
-
-window id select window with this id or name
|
| 195 |
-
root selects whole screen
|
| 196 |
-
|
| 197 |
-
Image Operators:
|
| 198 |
-
-annotate geometry text
|
| 199 |
-
annotate the image with text
|
| 200 |
-
-colors value preferred number of colors in the image
|
| 201 |
-
-crop geometry preferred size and location of the cropped image
|
| 202 |
-
-encipher filename convert plain pixels to cipher pixels
|
| 203 |
-
-extent geometry set the image size
|
| 204 |
-
-geometry geometry preferred size or location of the image
|
| 205 |
-
-help print program options
|
| 206 |
-
-monochrome transform image to black and white
|
| 207 |
-
-negate replace every pixel with its complementary color
|
| 208 |
-
-quantize colorspace reduce colors in this colorspace
|
| 209 |
-
-resize geometry resize the image
|
| 210 |
-
-rotate degrees apply Paeth rotation to the image
|
| 211 |
-
-strip strip image of all profiles and comments
|
| 212 |
-
-thumbnail geometry create a thumbnail of the image
|
| 213 |
-
-transparent color make this color transparent within the image
|
| 214 |
-
-trim trim image edges
|
| 215 |
-
-type type image type
|
| 216 |
-
|
| 217 |
-
Miscellaneous Options:
|
| 218 |
-
-debug events display copious debugging information
|
| 219 |
-
-help print program options
|
| 220 |
-
-list type print a list of supported option arguments
|
| 221 |
-
-log format format of debugging information
|
| 222 |
-
-version print version information
|
| 223 |
-
|
| 224 |
-
By default, 'file' is written in the MIFF image format. To
|
| 225 |
-
specify a particular image format, precede the filename with an image
|
| 226 |
-
format name and a colon (i.e. ps:image) or specify the image type as
|
| 227 |
-
the filename suffix (i.e. image.ps). Specify 'file' as '-' for
|
| 228 |
-
standard input or output.
|
| 229 |
|
| 230 |
## Part of CollectorVision
|
| 231 |
|
| 232 |
-
Used together with [HanClinto/milo](https://huggingface.co/HanClinto/milo) in the [
|
|
|
|
| 1 |
---
|
| 2 |
+
license: agpl-3.0
|
| 3 |
tags:
|
| 4 |
- onnx
|
| 5 |
- object-detection
|
|
|
|
| 26 |
|
| 27 |
## Outputs
|
| 28 |
|
| 29 |
+
- **corners** — 8 floats `[x0,y0, x1,y1, x2,y2, x3,y3]` in TL→TR→BR→BL order, normalised [0,1]
|
| 30 |
+
- **presence** — raw logit; unreliable on blank images, prefer the sharpness gate
|
| 31 |
- **sharpness** — mean peak of the 8 SimCC softmax distributions; blank frames ≈ 0.008, valid cards ≈ 0.03–0.07
|
| 32 |
|
| 33 |
## Usage
|
| 34 |
|
| 35 |
+
The easiest way to use Cornelius is through the [CollectorVision](https://github.com/HanClinto/CollectorVision) library, which wires it into a full detect → dewarp → embed → identify pipeline:
|
| 36 |
+
|
| 37 |
+
```python
|
| 38 |
+
import collector_vision as cvg
|
| 39 |
+
|
| 40 |
+
cvid = cvg.Identifier(cvg.HFD("HanClinto/milo", "scryfall-mtg"))
|
| 41 |
+
result = cvid.identify("photo.jpg")
|
| 42 |
+
print(result.ids) # {"scryfall_id": "..."}
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
### Direct ONNX usage
|
| 46 |
+
|
| 47 |
+
```python
|
| 48 |
+
import onnxruntime as ort
|
| 49 |
+
import numpy as np
|
| 50 |
+
from PIL import Image
|
| 51 |
+
|
| 52 |
+
session = ort.InferenceSession("model.onnx")
|
| 53 |
+
|
| 54 |
+
# Preprocess: resize to 384×384, ImageNet normalise, NCHW float32
|
| 55 |
+
img = Image.open("photo.jpg").convert("RGB").resize((384, 384))
|
| 56 |
+
x = np.array(img, dtype=np.float32) / 255.0
|
| 57 |
+
x = (x - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
|
| 58 |
+
x = x.transpose(2, 0, 1)[None] # (1, 3, 384, 384)
|
| 59 |
+
|
| 60 |
+
corners, presence, sharpness = session.run(None, {"pixel_values": x})
|
| 61 |
+
# corners: (1, 8) — x0,y0,x1,y1,x2,y2,x3,y3 normalised [0,1], TL→TR→BR→BL
|
| 62 |
+
# presence: (1, 1) — raw logit
|
| 63 |
+
# sharpness: (1, 1) — use > 0.02 as a card-present gate
|
| 64 |
+
|
| 65 |
+
if sharpness[0, 0] > 0.02:
|
| 66 |
+
pts = corners[0].reshape(4, 2) # (4, 2) normalised corners
|
| 67 |
+
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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ollectorVision) inference library.
|