Nodes/comfyui_cv/CV Predict Classifier
ComfyUI Node

CV Predict Classifier

Classifies feature rows with a PREVIOUSLY TRAINED cv2.ml model: pick a file from ComfyUI/models/cvml - the gzip '.yml.gz' files 'CV Save Classifier' writes, or a plain '.yml'/'.yaml' dropped in by hand - or connect a model_yaml STRING to skip the file entirely (it takes precedence when connected). Loading and predicting happen inside one call - the model never crosses a graph edge, so caching stays correct (the same pure-function argument as 'CV Train Classifier'). The features must have the SAME length D the model was trained on (e.g. the same 'CV HOG Features' settings). Predictions are the label values the model was trained on - 'CV Train Classifier' trains on class INDICES 0..K-1 in 'CV Stack Feature Classes' input order (class_a = 0, ...). Failure-tolerant: a missing/corrupt file, a non-model YAML, a feature-length mismatch or empty features yield success=false and empty predictions, never an error - gate downstream consumers with if/else.

By bmad4ever·Created 3 months ago·Updated 2 days ago· 0
CV Predict Classifier
  • features
  • predictions
  • count
  • success
model
model_yaml
Categoryimage/CV/ml

Inputs (3)

NameTypeDefaultDescription
featuresNPARRAY(N, D) rows to classify (any shape flattens to one row per sample) - same D as at training time.
modelCOMBOSaved classifier from ComfyUI/models/cvml (written by 'CV Save Classifier'). Reload the page to list files saved during the same session.
model_yamloptSTRINGOptional: a model as YAML text (e.g. straight from 'CV Train Classifier'). When connected and non-empty it overrides the model file above.

Outputs (3)

NameTypeDescription
predictionsNPARRAY(N,) int32 predicted label per feature row (class indices 0..K-1 for models from 'CV Train Classifier'). Empty when success=false.
countINTHow many rows were classified.
successBOOLEANFalse when the model could not be loaded or the features do not fit it - gate with if/else.