Class ImageLabel
java.lang.Object
com.codename1.ai.vision.ImageLabel
Portable ranked image-classification label. Confidence is normalized to
0..1. The numeric index is a backend/model class index and should not be
treated as stable across different backends; portable code should prefer
the text label.
-
Constructor Summary
ConstructorsConstructorDescriptionImageLabel(String text, float confidence, int index) Creates a label without backend metadata.ImageLabel(String text, float confidence, int index, VisionMetadata metadata) Creates a label with backend diagnostics. -
Method Summary
-
Constructor Details
-
ImageLabel
Creates a label without backend metadata.- Parameters:
text- normalized label textconfidence- provider confidence, normally from zero to oneindex- provider label index, or a negative value when unavailable
-
ImageLabel
Creates a label with backend diagnostics.- Parameters:
text- normalized label textconfidence- provider confidence, normally from zero to oneindex- provider label index, or a negative value when unavailablemetadata- backend details, ornull
-
-
Method Details
-
getText
- Returns:
- human-readable class label
-
getConfidence
public float getConfidence()- Returns:
- classification confidence in the range 0..1
-
getIndex
public int getIndex()Returns the backend/model class index when the selected classifier exposes one. The index identifies a class in that specific model; it is not portable across models or backends. Apple Vision does not expose a numeric class index and therefore returns-1. PrefergetText()when writing backend-independent application logic.- Returns:
- backend/model class index, or
-1when unavailable
-
getMetadata
- Returns:
- backend metadata, or
nullwhen manually constructed
-