Add files using upload-large-folder tool
Browse files
NOTICE.md
CHANGED
|
@@ -6,4 +6,4 @@ This repository is released under the Apache-2.0 license (`LICENSE`). It contain
|
|
| 6 |
|---|---|---|---|
|
| 7 |
| (none) | | | |
|
| 8 |
|
| 9 |
-
Published 2026-10-
|
|
|
|
| 6 |
|---|---|---|---|
|
| 7 |
| (none) | | | |
|
| 8 |
|
| 9 |
+
Published 2026-10-09 by Cubert GmbH (cuvis.ai@cubert-gmbh.de).
|
README.md
CHANGED
|
@@ -28,12 +28,12 @@ tags:
|
|
| 28 |
<p align="center">
|
| 29 |
<a href="https://docs.cuvis.ai"><img src="https://img.shields.io/badge/Docs-docs.cuvis.ai-0aa?logo=readthedocs&logoColor=white" alt="Cuvis.AI docs"/></a>
|
| 30 |
<a href="https://github.com/cubert-hyperspectral/cuvis-ai"><img src="https://img.shields.io/badge/GitHub-cuvis--ai-24292e?logo=github" alt="Cuvis.AI on GitHub"/></a>
|
| 31 |
-
<a href="https://huggingface.co/cubert-gmbh/
|
| 32 |
</p>
|
| 33 |
|
| 34 |
# Hyperspectral foreign-object detection in walnuts
|
| 35 |
|
| 36 |
-
Walnut kernels and shell fragments with foreign objects, recorded with a Cubert Ultris XMR hyperspectral camera between August and October 2026 for Cubert's foreign-object demonstration: first on a lab station with a blue mat, then on the demonstration stand with production lights, a turntable and a belt. The contaminants are stones, stems, rubber, aluminium shards and plastic imitation shells, placed by hand into the product; the shell fragments are labelled as a class of their own, so the same frames serve shell segmentation and unsupervised foreign-object detection. The trained pipelines fitted on these recordings are published in the companion model repository
|
| 37 |
|
| 38 |
Captured with a Cubert Ultris XMR camera (61 bands per pixel, 430 to 910 nm, 1080 x 1000 pixels). 7 acquisition days, 90 `.cu3s` recordings, 2,283 frames, 820 of them with pixel-level COCO annotations across 7 classes.
|
| 39 |
|
|
|
|
| 28 |
<p align="center">
|
| 29 |
<a href="https://docs.cuvis.ai"><img src="https://img.shields.io/badge/Docs-docs.cuvis.ai-0aa?logo=readthedocs&logoColor=white" alt="Cuvis.AI docs"/></a>
|
| 30 |
<a href="https://github.com/cubert-hyperspectral/cuvis-ai"><img src="https://img.shields.io/badge/GitHub-cuvis--ai-24292e?logo=github" alt="Cuvis.AI on GitHub"/></a>
|
| 31 |
+
<a href="https://huggingface.co/cubert-gmbh/Industrial_Foreign_Object_Detection_Walnuts"><img src="https://img.shields.io/badge/Model-HuggingFace-ffd21e?logo=huggingface&logoColor=000" alt="Companion model"/></a>
|
| 32 |
</p>
|
| 33 |
|
| 34 |
# Hyperspectral foreign-object detection in walnuts
|
| 35 |
|
| 36 |
+
Walnut kernels and shell fragments with foreign objects, recorded with a Cubert Ultris XMR hyperspectral camera between August and October 2026 for Cubert's foreign-object demonstration: first on a lab station with a blue mat, then on the demonstration stand with production lights, a turntable and a belt. The contaminants are stones, stems, rubber, aluminium shards and plastic imitation shells, placed by hand into the product; the shell fragments are labelled as a class of their own, so the same frames serve shell segmentation and unsupervised foreign-object detection. The trained pipelines fitted on these recordings are published in the companion model repository, cubert-gmbh/Industrial_Foreign_Object_Detection_Walnuts.
|
| 37 |
|
| 38 |
Captured with a Cubert Ultris XMR camera (61 bands per pixel, 430 to 910 nm, 1080 x 1000 pixels). 7 acquisition days, 90 `.cu3s` recordings, 2,283 frames, 820 of them with pixel-level COCO annotations across 7 classes.
|
| 39 |
|
fetch.py
CHANGED
|
@@ -17,6 +17,9 @@ files it still misses. A transfer goes to <name>.part and is renamed after the h
|
|
| 17 |
Transient errors are retried with a doubling delay. The summary lists what was downloaded,
|
| 18 |
skipped and rejected; a rejected file (hash mismatch, missing on the server) makes the script
|
| 19 |
exit 1.
|
|
|
|
|
|
|
|
|
|
| 20 |
"""
|
| 21 |
|
| 22 |
from __future__ import annotations
|
|
@@ -109,6 +112,12 @@ def fetch_all(manifest: dict, base_url: str, out: Path, opener=open_url, sleep=t
|
|
| 109 |
log(f"{len(files)} files, {total / 1e6:.1f} MB, from {base_url}")
|
| 110 |
for entry in files:
|
| 111 |
rel = str(entry["path"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
dest = out / rel
|
| 113 |
expected = str(entry["sha256"])
|
| 114 |
if dest.is_file() and dest.stat().st_size == int(entry["size"]) and sha256_of(dest) == expected:
|
|
@@ -146,6 +155,15 @@ def load_manifest(args: argparse.Namespace, base_url: str) -> dict:
|
|
| 146 |
return json.loads(response.read().decode("utf-8"))
|
| 147 |
|
| 148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
def main(argv: list[str] | None = None) -> int:
|
| 150 |
reconfigure = getattr(sys.stdout, "reconfigure", None)
|
| 151 |
if reconfigure is not None:
|
|
@@ -155,15 +173,20 @@ def main(argv: list[str] | None = None) -> int:
|
|
| 155 |
parser.add_argument("--out", type=Path, default=Path("."), help="target folder (default: here)")
|
| 156 |
parser.add_argument("--repo-id", default=REPO_ID)
|
| 157 |
parser.add_argument("--repo-type", default=REPO_TYPE, choices=["dataset", "model"])
|
| 158 |
-
parser.add_argument(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
parser.add_argument("--base-url", default=None, help="override the download root (testing)")
|
| 160 |
parser.add_argument("--manifest", default=None, help="a local manifest.json to use instead of fetching it")
|
| 161 |
parser.add_argument("--selftest", action="store_true")
|
| 162 |
args = parser.parse_args(argv)
|
| 163 |
if args.selftest:
|
| 164 |
return selftest()
|
| 165 |
-
base_url = args.base_url or resolve_base(args.repo_id, args.repo_type, args.revision)
|
| 166 |
manifest = load_manifest(args, base_url)
|
|
|
|
| 167 |
summary = fetch_all(manifest, base_url, args.out)
|
| 168 |
return 1 if summary["rejected"] else 0
|
| 169 |
|
|
@@ -213,6 +236,21 @@ def selftest() -> int:
|
|
| 213 |
s5 = fetch_all(manifest_missing, base, dest, sleep=quiet, log=quiet)
|
| 214 |
expect(s5["rejected"] == ["missing.txt"], f"missing on the server is rejected {s5}")
|
| 215 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
calls = {"n": 0}
|
| 217 |
sleeps: list[float] = []
|
| 218 |
|
|
@@ -244,7 +282,7 @@ def selftest() -> int:
|
|
| 244 |
for f in failures:
|
| 245 |
print(f" - {f}")
|
| 246 |
return 1
|
| 247 |
-
print("selftest OK: sha256 verification, resume, mismatch, retry")
|
| 248 |
return 0
|
| 249 |
|
| 250 |
|
|
|
|
| 17 |
Transient errors are retried with a doubling delay. The summary lists what was downloaded,
|
| 18 |
skipped and rejected; a rejected file (hash mismatch, missing on the server) makes the script
|
| 19 |
exit 1.
|
| 20 |
+
|
| 21 |
+
Without --revision the files come from the revision manifest.json records, the commit the manifest
|
| 22 |
+
was written for, or from main when it records none.
|
| 23 |
"""
|
| 24 |
|
| 25 |
from __future__ import annotations
|
|
|
|
| 112 |
log(f"{len(files)} files, {total / 1e6:.1f} MB, from {base_url}")
|
| 113 |
for entry in files:
|
| 114 |
rel = str(entry["path"])
|
| 115 |
+
# the rule of hfpub_common.repo_path(), repeated here because this file ships on its own
|
| 116 |
+
parts = rel.split("/")
|
| 117 |
+
if "\\" in rel or ":" in rel or rel.startswith("~") or any(part in ("", ".", "..") for part in parts):
|
| 118 |
+
log(f" {rel}: not a relative repository path, rejected")
|
| 119 |
+
summary["rejected"].append(rel)
|
| 120 |
+
continue
|
| 121 |
dest = out / rel
|
| 122 |
expected = str(entry["sha256"])
|
| 123 |
if dest.is_file() and dest.stat().st_size == int(entry["size"]) and sha256_of(dest) == expected:
|
|
|
|
| 155 |
return json.loads(response.read().decode("utf-8"))
|
| 156 |
|
| 157 |
|
| 158 |
+
def pinned_base(args: argparse.Namespace, manifest: dict, base_url: str, log=print) -> str:
|
| 159 |
+
"""The download root at the revision manifest.json records, unless the caller chose one."""
|
| 160 |
+
pinned = manifest.get("revision")
|
| 161 |
+
if args.revision or args.base_url or not pinned:
|
| 162 |
+
return base_url
|
| 163 |
+
log(f"revision {pinned} (recorded in manifest.json)")
|
| 164 |
+
return resolve_base(args.repo_id, args.repo_type, pinned)
|
| 165 |
+
|
| 166 |
+
|
| 167 |
def main(argv: list[str] | None = None) -> int:
|
| 168 |
reconfigure = getattr(sys.stdout, "reconfigure", None)
|
| 169 |
if reconfigure is not None:
|
|
|
|
| 173 |
parser.add_argument("--out", type=Path, default=Path("."), help="target folder (default: here)")
|
| 174 |
parser.add_argument("--repo-id", default=REPO_ID)
|
| 175 |
parser.add_argument("--repo-type", default=REPO_TYPE, choices=["dataset", "model"])
|
| 176 |
+
parser.add_argument(
|
| 177 |
+
"--revision",
|
| 178 |
+
default=None,
|
| 179 |
+
help="commit sha, branch or tag (default: the revision manifest.json records, else main)",
|
| 180 |
+
)
|
| 181 |
parser.add_argument("--base-url", default=None, help="override the download root (testing)")
|
| 182 |
parser.add_argument("--manifest", default=None, help="a local manifest.json to use instead of fetching it")
|
| 183 |
parser.add_argument("--selftest", action="store_true")
|
| 184 |
args = parser.parse_args(argv)
|
| 185 |
if args.selftest:
|
| 186 |
return selftest()
|
| 187 |
+
base_url = args.base_url or resolve_base(args.repo_id, args.repo_type, args.revision or "main")
|
| 188 |
manifest = load_manifest(args, base_url)
|
| 189 |
+
base_url = pinned_base(args, manifest, base_url)
|
| 190 |
summary = fetch_all(manifest, base_url, args.out)
|
| 191 |
return 1 if summary["rejected"] else 0
|
| 192 |
|
|
|
|
| 236 |
s5 = fetch_all(manifest_missing, base, dest, sleep=quiet, log=quiet)
|
| 237 |
expect(s5["rejected"] == ["missing.txt"], f"missing on the server is rejected {s5}")
|
| 238 |
|
| 239 |
+
escapes = ["../escape.txt", "a/name:stream", "~/x.txt"]
|
| 240 |
+
manifest_escape = {"files": [{"path": p, "size": 1, "sha256": "0" * 64, "role": "data"} for p in escapes]}
|
| 241 |
+
s6 = fetch_all(manifest_escape, base, dest, sleep=quiet, log=quiet)
|
| 242 |
+
expect(s6["rejected"] == escapes, f"paths leaving the target are rejected {s6}")
|
| 243 |
+
expect(not (root / "escape.txt").exists() and not list(dest.rglob("name*")), "nothing written for them")
|
| 244 |
+
|
| 245 |
+
ns = argparse.Namespace(revision=None, base_url=None, repo_id="o/n", repo_type="model")
|
| 246 |
+
pinned = pinned_base(ns, {"revision": "a" * 40}, "x", log=quiet)
|
| 247 |
+
expect(pinned.endswith("/resolve/" + "a" * 40), f"manifest revision pins the root {pinned}")
|
| 248 |
+
no_pin = pinned_base(ns, {"revision": None}, "x", log=quiet)
|
| 249 |
+
expect(no_pin == "x", "no recorded revision keeps the root")
|
| 250 |
+
ns.revision = "main"
|
| 251 |
+
explicit = pinned_base(ns, {"revision": "a" * 40}, "x", log=quiet)
|
| 252 |
+
expect(explicit == "x", "an explicit --revision wins")
|
| 253 |
+
|
| 254 |
calls = {"n": 0}
|
| 255 |
sleeps: list[float] = []
|
| 256 |
|
|
|
|
| 282 |
for f in failures:
|
| 283 |
print(f" - {f}")
|
| 284 |
return 1
|
| 285 |
+
print("selftest OK: sha256 verification, resume, mismatch, retry, path guard, manifest revision")
|
| 286 |
return 0
|
| 287 |
|
| 288 |
|
manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
"kind": "dataset",
|
| 4 |
"repo_id": "cubert-gmbh/XMR_Industrial_Foreign_Object_Detection_Walnuts",
|
| 5 |
"repo_type": "dataset",
|
| 6 |
-
"generated": "2026-10-
|
| 7 |
"revision": null,
|
| 8 |
"files": [
|
| 9 |
{
|
|
@@ -1893,13 +1893,13 @@
|
|
| 1893 |
{
|
| 1894 |
"path": "NOTICE.md",
|
| 1895 |
"size": 437,
|
| 1896 |
-
"sha256": "
|
| 1897 |
"role": "notice"
|
| 1898 |
},
|
| 1899 |
{
|
| 1900 |
"path": "fetch.py",
|
| 1901 |
-
"size":
|
| 1902 |
-
"sha256": "
|
| 1903 |
"role": "fetcher"
|
| 1904 |
},
|
| 1905 |
{
|
|
@@ -1910,8 +1910,8 @@
|
|
| 1910 |
},
|
| 1911 |
{
|
| 1912 |
"path": "README.md",
|
| 1913 |
-
"size":
|
| 1914 |
-
"sha256": "
|
| 1915 |
"role": "card"
|
| 1916 |
}
|
| 1917 |
]
|
|
|
|
| 3 |
"kind": "dataset",
|
| 4 |
"repo_id": "cubert-gmbh/XMR_Industrial_Foreign_Object_Detection_Walnuts",
|
| 5 |
"repo_type": "dataset",
|
| 6 |
+
"generated": "2026-10-09T07:47:27Z",
|
| 7 |
"revision": null,
|
| 8 |
"files": [
|
| 9 |
{
|
|
|
|
| 1893 |
{
|
| 1894 |
"path": "NOTICE.md",
|
| 1895 |
"size": 437,
|
| 1896 |
+
"sha256": "1093c14ea496d55df748f1b8d2214709ae1462c753d6cee8d094c2c415fd5084",
|
| 1897 |
"role": "notice"
|
| 1898 |
},
|
| 1899 |
{
|
| 1900 |
"path": "fetch.py",
|
| 1901 |
+
"size": 12588,
|
| 1902 |
+
"sha256": "6f150f3bf3a52f8200b8b2a58697f4c5a1d07efee05fe369220cbd921dc382aa",
|
| 1903 |
"role": "fetcher"
|
| 1904 |
},
|
| 1905 |
{
|
|
|
|
| 1910 |
},
|
| 1911 |
{
|
| 1912 |
"path": "README.md",
|
| 1913 |
+
"size": 33064,
|
| 1914 |
+
"sha256": "487019254d94be453fbc4e0d5ded48c77a47eb7eb3126f827a2e21c4e844e4ce",
|
| 1915 |
"role": "card"
|
| 1916 |
}
|
| 1917 |
]
|