Skip to content

feat!: make classification module a vision labeled module#986

Merged
NorbertKlockiewicz merged 3 commits intomainfrom
@nk/classification-labeled-module
Mar 20, 2026
Merged

feat!: make classification module a vision labeled module#986
NorbertKlockiewicz merged 3 commits intomainfrom
@nk/classification-labeled-module

Conversation

@NorbertKlockiewicz
Copy link
Contributor

@NorbertKlockiewicz NorbertKlockiewicz commented Mar 19, 2026

Description

  • Refactors ClassificationModule into a type-safe, labeled vision module — forward() now returns Record<'GOLDEN_RETRIEVER' | 'TABBY' | ..., number> instead of Record<string, number>
  • Adds Imagenet1kLabel enum (1000 ImageNet class names) as a TS constant, replacing the hardcoded C++ Constants.h label array
  • Makes normalization (normMean/normStd) and label names configurable from JS, passed through to the native Classification constructor
  • Introduces fromCustomModel factory accepting a ClassificationConfig with a user-provided labelMap and optional preprocessing params
  • Adds VisionLabeledModule base class for shared label-mapping logic

Introduces a breaking change?

  • Yes
  • No

Type of change

  • Bug fix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Documentation update (improves or adds clarity to existing documentation)
  • Other (chores, tests, code style improvements etc.)

Tested on

  • iOS
  • Android

Testing instructions

Run classification in computer vision example app

Screenshots

Related issues

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@NorbertKlockiewicz NorbertKlockiewicz force-pushed the @nk/classification-labeled-module branch from 131eb70 to b5c4879 Compare March 20, 2026 10:08
@NorbertKlockiewicz NorbertKlockiewicz marked this pull request as ready for review March 20, 2026 10:13
@NorbertKlockiewicz NorbertKlockiewicz changed the title feat: make classification module a vision labeled module feat!: make classification module a vision labeled module Mar 20, 2026
@NorbertKlockiewicz NorbertKlockiewicz merged commit 6c1dea0 into main Mar 20, 2026
5 checks passed
@NorbertKlockiewicz NorbertKlockiewicz deleted the @nk/classification-labeled-module branch March 20, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Classification should be a VisionLabeledModule

2 participants