cardstream 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cardstream-0.2.0/LICENSE +201 -0
- cardstream-0.2.0/MANIFEST.in +14 -0
- cardstream-0.2.0/NOTICE +46 -0
- cardstream-0.2.0/PKG-INFO +258 -0
- cardstream-0.2.0/README.md +211 -0
- cardstream-0.2.0/pyproject.toml +175 -0
- cardstream-0.2.0/setup.cfg +4 -0
- cardstream-0.2.0/src/cardstream/__init__.py +13 -0
- cardstream-0.2.0/src/cardstream/client/__init__.py +0 -0
- cardstream-0.2.0/src/cardstream/client/_tflite.py +41 -0
- cardstream-0.2.0/src/cardstream/client/analyzer.py +406 -0
- cardstream-0.2.0/src/cardstream/client/banner.py +181 -0
- cardstream-0.2.0/src/cardstream/client/common.py +622 -0
- cardstream-0.2.0/src/cardstream/client/embedders.py +208 -0
- cardstream-0.2.0/src/cardstream/client/identify_target.py +37 -0
- cardstream-0.2.0/src/cardstream/client/sources.py +299 -0
- cardstream-0.2.0/src/cardstream/client/stream_client.py +169 -0
- cardstream-0.2.0/src/cardstream/client/web_camera.py +132 -0
- cardstream-0.2.0/src/cardstream/client/web_client.py +285 -0
- cardstream-0.2.0/src/cardstream/client/web_common.py +81 -0
- cardstream-0.2.0/src/cardstream/client/web_settings.py +243 -0
- cardstream-0.2.0/src/cardstream/client/web_stream.py +128 -0
- cardstream-0.2.0/src/cardstream/client/ximilar_api.py +45 -0
- cardstream-0.2.0/src/cardstream/core/__init__.py +0 -0
- cardstream-0.2.0/src/cardstream/core/_onnx.py +25 -0
- cardstream-0.2.0/src/cardstream/core/detection_filters.py +94 -0
- cardstream-0.2.0/src/cardstream/core/detectors.py +499 -0
- cardstream-0.2.0/src/cardstream/core/engine.py +377 -0
- cardstream-0.2.0/src/cardstream/core/id_types.py +210 -0
- cardstream-0.2.0/src/cardstream/core/identify_client.py +118 -0
- cardstream-0.2.0/src/cardstream/core/identify_options.py +118 -0
- cardstream-0.2.0/src/cardstream/core/image_store.py +116 -0
- cardstream-0.2.0/src/cardstream/core/imaging.py +162 -0
- cardstream-0.2.0/src/cardstream/core/models.py +152 -0
- cardstream-0.2.0/src/cardstream/core/motion.py +80 -0
- cardstream-0.2.0/src/cardstream/core/quad.py +197 -0
- cardstream-0.2.0/src/cardstream/core/tracking.py +74 -0
- cardstream-0.2.0/src/cardstream/core/ximilar.py +178 -0
- cardstream-0.2.0/src/cardstream/log.py +32 -0
- cardstream-0.2.0/src/cardstream/py.typed +0 -0
- cardstream-0.2.0/src/cardstream/webui/shared/capture.js +112 -0
- cardstream-0.2.0/src/cardstream/webui/shared/constants.js +8 -0
- cardstream-0.2.0/src/cardstream/webui/shared/logo.svg +6 -0
- cardstream-0.2.0/src/cardstream/webui/shared/overlay.js +358 -0
- cardstream-0.2.0/src/cardstream/webui/shared/session.js +74 -0
- cardstream-0.2.0/src/cardstream/webui/shared/style.css +206 -0
- cardstream-0.2.0/src/cardstream/webui/shared/ws.js +69 -0
- cardstream-0.2.0/src/cardstream/webui/smart/app.js +183 -0
- cardstream-0.2.0/src/cardstream/webui/smart/index.html +114 -0
- cardstream-0.2.0/src/cardstream/webui/smart/settings-fields.js +120 -0
- cardstream-0.2.0/src/cardstream/webui/smart/settings.js +254 -0
- cardstream-0.2.0/src/cardstream/webui/smart/smart.css +178 -0
- cardstream-0.2.0/src/cardstream.egg-info/PKG-INFO +258 -0
- cardstream-0.2.0/src/cardstream.egg-info/SOURCES.txt +56 -0
- cardstream-0.2.0/src/cardstream.egg-info/dependency_links.txt +1 -0
- cardstream-0.2.0/src/cardstream.egg-info/entry_points.txt +3 -0
- cardstream-0.2.0/src/cardstream.egg-info/requires.txt +20 -0
- cardstream-0.2.0/src/cardstream.egg-info/top_level.txt +1 -0
cardstream-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Ximilar s.r.o.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# The sdist is what `pip install cardstream` builds from — it needs the
|
|
2
|
+
# package, its metadata and its licence, and nothing else. Without this,
|
|
3
|
+
# setuptools' defaults sweep in a stray top-level test file but not the rest
|
|
4
|
+
# of the suite, which is the worst of both: run the tests from a checkout.
|
|
5
|
+
include LICENSE NOTICE README.md
|
|
6
|
+
recursive-include src/cardstream/webui *
|
|
7
|
+
prune tests
|
|
8
|
+
prune docs
|
|
9
|
+
prune model
|
|
10
|
+
prune scripts
|
|
11
|
+
prune docker
|
|
12
|
+
prune .github
|
|
13
|
+
exclude Makefile Dockerfile uv.lock .pre-commit-config.yaml .editorconfig
|
|
14
|
+
exclude CLAUDE.md AGENTS.md CONTRIBUTING.md SECURITY.md CHANGELOG.md
|
cardstream-0.2.0/NOTICE
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
cardstream
|
|
2
|
+
Copyright 2026 Ximilar s.r.o.
|
|
3
|
+
|
|
4
|
+
This product includes software developed at Ximilar (https://ximilar.com).
|
|
5
|
+
|
|
6
|
+
Licensed under the Apache License, Version 2.0. See LICENSE for the full
|
|
7
|
+
terms.
|
|
8
|
+
|
|
9
|
+
--------------------------------------------------------------------------
|
|
10
|
+
Third-party components
|
|
11
|
+
--------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
Every model architecture and runtime weight this project loads is
|
|
14
|
+
Apache-2.0. A licence-encumbered backend is deliberately out of scope --
|
|
15
|
+
see model/README.md.
|
|
16
|
+
|
|
17
|
+
RF-DETR
|
|
18
|
+
Roboflow. Apache License 2.0.
|
|
19
|
+
https://github.com/roboflow/rf-detr
|
|
20
|
+
The detection and instance-segmentation architectures behind
|
|
21
|
+
--detector-model and --segmentor-model, finetuned by Ximilar. The
|
|
22
|
+
finetuned WEIGHTS are a separate grant from the architecture -- see the
|
|
23
|
+
model zoo for the licence attached to each file.
|
|
24
|
+
|
|
25
|
+
RT-DETRv2
|
|
26
|
+
Baidu / lyuwenyu, and the Hugging Face Transformers implementation.
|
|
27
|
+
Apache License 2.0.
|
|
28
|
+
https://github.com/lyuwenyu/RT-DETR
|
|
29
|
+
https://github.com/huggingface/transformers
|
|
30
|
+
The alternative detection backend (--detector rtdetr).
|
|
31
|
+
|
|
32
|
+
OpenCV and the OpenCV Model Zoo (vitTracker)
|
|
33
|
+
OpenCV team. Apache License 2.0.
|
|
34
|
+
https://github.com/opencv/opencv
|
|
35
|
+
https://github.com/opencv/opencv_zoo
|
|
36
|
+
Image primitives throughout core/, and the optional per-frame visual
|
|
37
|
+
tracker (--tracker-model).
|
|
38
|
+
|
|
39
|
+
MobileNetV2
|
|
40
|
+
Google. Apache License 2.0.
|
|
41
|
+
The embedding backbone behind the identity gate (--embed-model),
|
|
42
|
+
finetuned by Ximilar.
|
|
43
|
+
|
|
44
|
+
Identification is performed by the Ximilar collectibles API
|
|
45
|
+
(https://api.ximilar.com), which is a paid hosted service and is not
|
|
46
|
+
covered by this licence.
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cardstream
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Real-time trading-card identification: a smart local client backed by Ximilar collectibles endpoints
|
|
5
|
+
Author-email: Ximilar <tech@ximilar.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://cardstream.ai
|
|
8
|
+
Project-URL: Documentation, https://cardstream.ai/docs
|
|
9
|
+
Project-URL: Source, https://github.com/Ximilar-com/cardstream
|
|
10
|
+
Project-URL: Issues, https://github.com/Ximilar-com/cardstream/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/Ximilar-com/cardstream/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: trading-cards,tcg,pokemon,card-identification,computer-vision,instance-segmentation,onnx,rf-detr,real-time,video-stream
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Environment :: Web Environment
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
23
|
+
Classifier: Topic :: Multimedia :: Video
|
|
24
|
+
Classifier: Topic :: Scientific/Engineering :: Image Recognition
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.11
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
License-File: NOTICE
|
|
30
|
+
Requires-Dist: numpy>=1.23
|
|
31
|
+
Requires-Dist: opencv-python-headless>=4.9
|
|
32
|
+
Requires-Dist: requests>=2.31
|
|
33
|
+
Provides-Extra: client
|
|
34
|
+
Requires-Dist: websockets>=12; extra == "client"
|
|
35
|
+
Requires-Dist: fastapi>=0.110; extra == "client"
|
|
36
|
+
Requires-Dist: uvicorn[standard]>=0.29; extra == "client"
|
|
37
|
+
Requires-Dist: pydantic>=2; extra == "client"
|
|
38
|
+
Provides-Extra: torch
|
|
39
|
+
Requires-Dist: torch>=2.1; extra == "torch"
|
|
40
|
+
Requires-Dist: torchvision>=0.16; extra == "torch"
|
|
41
|
+
Requires-Dist: transformers>=4.49; extra == "torch"
|
|
42
|
+
Provides-Extra: onnx
|
|
43
|
+
Requires-Dist: onnxruntime>=1.17; extra == "onnx"
|
|
44
|
+
Provides-Extra: tflite
|
|
45
|
+
Requires-Dist: ai-edge-litert>=1.0; extra == "tflite"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
|
|
50
|
+
<img src="src/cardstream/webui/shared/logo.svg" alt="cardstream" width="320">
|
|
51
|
+
|
|
52
|
+
**Point a camera at a trading card. Get the name, set and confidence the moment
|
|
53
|
+
it enters the frame.**
|
|
54
|
+
|
|
55
|
+
[](https://pypi.org/project/cardstream/)
|
|
56
|
+
[](https://pypi.org/project/cardstream/)
|
|
57
|
+
[](LICENSE)
|
|
58
|
+
[](https://github.com/Ximilar-com/cardstream/actions/workflows/ci.yml)
|
|
59
|
+
|
|
60
|
+
<!-- Replace with a ~15s screen recording of the browser UI identifying cards.
|
|
61
|
+
GitHub caps media at 10 MB. Prefer a GIF: MP4 does not render on PyPI,
|
|
62
|
+
which serves this same README as the project description. -->
|
|
63
|
+
<img src="docs/media/demo.gif" alt="cardstream identifying cards live" width="720">
|
|
64
|
+
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
No capture button, no per-frame API spam: **one paid API call per distinct
|
|
70
|
+
card, not per frame.** All the vision runs on your machine; a single cropped
|
|
71
|
+
JPEG leaves it each time a genuinely new card appears.
|
|
72
|
+
|
|
73
|
+
## Quick start
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv tool install "cardstream[client,onnx]" # or: pip install "cardstream[client,onnx]"
|
|
77
|
+
export XIMILAR_API_KEY=... # the one environment variable anything here reads
|
|
78
|
+
|
|
79
|
+
cardstream-web # browser UI on your webcam → http://127.0.0.1:8001
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Hold a card up. The overlay shows the state machine thinking and the match when
|
|
83
|
+
it lands.
|
|
84
|
+
|
|
85
|
+
You will also need the model weights — they are too large to ship in the wheel.
|
|
86
|
+
The [installer](#install) fetches them for you; a source checkout needs them
|
|
87
|
+
dropped into `model/` (see **[Model weights](#model-weights)**).
|
|
88
|
+
|
|
89
|
+
Headless, for rigs and streams:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cardstream-client --source 0 # webcam, results to the terminal
|
|
93
|
+
cardstream-web --source rtsp://user:pw@cam/stream1 # pull a camera
|
|
94
|
+
cardstream-web --source rtmp://0.0.0.0:1935/live --listen # OBS pushes here
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Why it is cheap
|
|
98
|
+
|
|
99
|
+
Identification is a paid call of roughly half a second, so cardstream never
|
|
100
|
+
makes one per frame. A per-card **state machine** driven by free, entirely
|
|
101
|
+
local signals decides when a fresh call is actually warranted:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
┌─────────────────────── frame ───────────────────────┐
|
|
105
|
+
▼ │
|
|
106
|
+
1. detection (throttled) card bbox + deskewed crop │
|
|
107
|
+
│ no card → EMPTY │
|
|
108
|
+
▼ │
|
|
109
|
+
2. MotionGate mean frame-diff; low for N frames → SETTLED
|
|
110
|
+
│ still moving → MOVING │
|
|
111
|
+
▼ │
|
|
112
|
+
3. identity gate pHash Hamming / embedding cosine → NEW card?
|
|
113
|
+
│ same card → IDENTIFIED (re-emit cached, 0 calls) │
|
|
114
|
+
▼ │
|
|
115
|
+
4. identify (async/thread, debounced) → IDENTIFIED + result ────┘
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Detection itself is throttled in three tiers by the free motion gate (moving /
|
|
119
|
+
static-with-card / empty heartbeat). The net effect is **one identify call per
|
|
120
|
+
distinct card presentation, regardless of frame rate**. Hold a card still and
|
|
121
|
+
it costs nothing more. Swap cards and it costs exactly one call.
|
|
122
|
+
|
|
123
|
+
| Stage | Where it runs | Cost |
|
|
124
|
+
|---|---|---|
|
|
125
|
+
| Frame capture | browser webcam, or a pulled source | free |
|
|
126
|
+
| Motion gate | local (mean frame-diff) | free |
|
|
127
|
+
| Card location | local: detection (RF-DETR / RT-DETRv2) or segmentation (RF-DETR) | free |
|
|
128
|
+
| Same-card identity gate | local (embedding cosine, or pHash) | free |
|
|
129
|
+
| Identify lookup | Ximilar `collectibles/v2/*_id` | **paid, once per distinct card** |
|
|
130
|
+
|
|
131
|
+
Everything above the last row is free and local. Nothing but that one crop
|
|
132
|
+
leaves the process — there is no service in the path.
|
|
133
|
+
|
|
134
|
+
## Model weights
|
|
135
|
+
|
|
136
|
+
`model/` is gitignored, so a fresh checkout has no weights and the CLI says so
|
|
137
|
+
at startup until you supply them. The installer and the Docker image fetch them
|
|
138
|
+
for you.
|
|
139
|
+
|
|
140
|
+
| Weight | Flag | Required |
|
|
141
|
+
| --- | --- | --- |
|
|
142
|
+
| **segmentation** — finds the card's outline, so the crop is deskewed and cut tight | `--segmentor-model` | **yes — the default locator** |
|
|
143
|
+
| **similarity** — the embedding the identity gate compares crops with | `--embed-model` | **yes by default** (`--gate phash` needs none) |
|
|
144
|
+
| detection — finds a bounding box instead | `--detector-model` | no — opt-in, replaces the segmentor |
|
|
145
|
+
| tracking — carries the box between detections | `--tracker-model` | no — opt-in |
|
|
146
|
+
|
|
147
|
+
Full details, download table and each export's I/O contract:
|
|
148
|
+
**[`model/README.md`](model/README.md)** and the
|
|
149
|
+
[model zoo](https://cardstream.ai/models).
|
|
150
|
+
|
|
151
|
+
## Install
|
|
152
|
+
|
|
153
|
+
**The quick way** (Linux/macOS — a venv in `~/.cardstream`, shims in
|
|
154
|
+
`~/.local/bin`, model weights included):
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
curl -fsSL https://cardstream.ai/install.sh | sh
|
|
158
|
+
cardstream-web --version
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**From PyPI.** Extras are independent and ML imports are lazy, so any subset
|
|
162
|
+
installs — but locating a card always needs a model, so pick a backend:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pip install "cardstream[client,onnx]" # ONNX Runtime — what the shipped weights use
|
|
166
|
+
pip install "cardstream[client,torch]" # torch/transformers backends instead
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**From a checkout:**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
git clone https://github.com/Ximilar-com/cardstream && cd cardstream
|
|
173
|
+
python3 -m venv .venv && source .venv/bin/activate
|
|
174
|
+
pip install -e '.[client,onnx]' --group dev
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
or in one step with the smoke checks: `./scripts/build-from-source.sh`
|
|
178
|
+
(`--models` also fetches the weights).
|
|
179
|
+
|
|
180
|
+
**Docker.** Read the security header in the `Dockerfile` before publishing any
|
|
181
|
+
port:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
docker build -t cardstream .
|
|
185
|
+
docker run --rm -e XIMILAR_API_KEY -p 127.0.0.1:8001:8001 -v cardstream-models:/models cardstream
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Releases carry the wheel, sdist and `SHA256SUMS`, which `install.sh` verifies.
|
|
189
|
+
|
|
190
|
+
## Common recipes
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
cardstream-web --game "One Piece" --alphabet latin # prefill: faster, more precise
|
|
194
|
+
cardstream-web --set-code PBL # restrict matching to one set
|
|
195
|
+
cardstream-web --camera-width 3840 # more pixels to identify from
|
|
196
|
+
cardstream-web --store-images crops/ # keep every crop you paid for
|
|
197
|
+
cardstream-web --show-detection --debug # see what was located, and why
|
|
198
|
+
cardstream-web --gate phash # zero-ML identity gate
|
|
199
|
+
cardstream-client --source card.jpg --loop # a still image, on repeat
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**Set `--alphabet` whenever you set `--game`.** Prefilling the game switches
|
|
203
|
+
off the endpoint's own writing-system detection, and it then assumes latin — so
|
|
204
|
+
a Japanese card comes back as its English print. Leave both unset and the
|
|
205
|
+
endpoint works them out itself, which is why neither is defaulted.
|
|
206
|
+
|
|
207
|
+
The shipped defaults **are** the tuned configuration: `make prod` passes no
|
|
208
|
+
flags at all and runs the same pipeline `make dev` spells out flag by flag.
|
|
209
|
+
|
|
210
|
+
## Documentation
|
|
211
|
+
|
|
212
|
+
| | |
|
|
213
|
+
| --- | --- |
|
|
214
|
+
| **[CLI reference](docs/cli-reference.md)** | every flag and its default, generated from the parser |
|
|
215
|
+
| **[Tuning](docs/tuning.md)** | call economics, detection filters, resolution, the settings dialog |
|
|
216
|
+
| **[Locating the card](docs/locators.md)** | detection vs segmentation, expansion, visual tracking |
|
|
217
|
+
| **[Frame sources](docs/sources.md)** | webcams, files, RTSP/RTMP/SRT, `--listen` |
|
|
218
|
+
| **[Model weights](model/README.md)** | the model zoo and each export's contract |
|
|
219
|
+
| **[Architecture](CLAUDE.md)** | the internals map, for contributors |
|
|
220
|
+
|
|
221
|
+
## Verify the no-spam behaviour
|
|
222
|
+
|
|
223
|
+
Run with `--debug` and watch the identify lines: they appear only on a new-card
|
|
224
|
+
transition. Hold one card steady → exactly one. Swap to another → one more. Run
|
|
225
|
+
at 10–15 fps throughout → still only those. The header's `N calls` badge counts
|
|
226
|
+
the same thing. That is the whole point.
|
|
227
|
+
|
|
228
|
+
## Development
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
make venv # .venv with the client, onnx and dev dependencies
|
|
232
|
+
make check # lint + typecheck + both test suites — what CI runs
|
|
233
|
+
make dev # the tuned run plus diagnostics
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
The suite is entirely offline: no API key, camera, network or model files. See
|
|
237
|
+
**[CONTRIBUTING.md](CONTRIBUTING.md)**.
|
|
238
|
+
|
|
239
|
+
## Limitations
|
|
240
|
+
|
|
241
|
+
- **Your Ximilar API key lives on the machine running the client**, and the
|
|
242
|
+
local web app is unauthenticated. That is the direct consequence of having no
|
|
243
|
+
service in the path. `--host` defaults to `127.0.0.1` — keep it there. See
|
|
244
|
+
**[SECURITY.md](SECURITY.md)**.
|
|
245
|
+
- **Detector boxes are axis-aligned**, so an angled card's crop carries
|
|
246
|
+
background wedges. `--segmentor-model` — the default — is the answer: a mask
|
|
247
|
+
gives four corners and the crop is deskewed and cut tight.
|
|
248
|
+
- **One card per frame.** The locator picks the best-scoring candidate.
|
|
249
|
+
- **The tracker is presence, not identity.** An in-place card swap keeps its
|
|
250
|
+
score high, so it never replaces the embedding gate's same-vs-new decision.
|
|
251
|
+
- **A game prefill costs alphabet detection** — see the warning above.
|
|
252
|
+
- `--listen` and `--ffmpeg` need the system `ffmpeg` binary.
|
|
253
|
+
|
|
254
|
+
## Licence
|
|
255
|
+
|
|
256
|
+
[Apache-2.0](LICENSE). Every model architecture and runtime weight here is
|
|
257
|
+
Apache-2.0 too — see [NOTICE](NOTICE). Identification is performed by the
|
|
258
|
+
[Ximilar](https://www.ximilar.com) collectibles API, a paid hosted service.
|