ML: Hand movements with regression or smooth classification?

Hi everyone! I have been playing with image classification using ofxRapidLib (.cpp posted under this message). I like the fact that I can train its json file to be used to classify my hand positions in my actual program.

Now: Has anyone bumped into a similar addon with regression or otherwise smoother results? Basically I would want to cause gradual changes to my animation by moving my hand. Even if I train the classifier to put the movement into 20-24 classes the results are of course jumpy (for example, size of the shape growing in 24 steps).

One option might of course be to have just a few classes and each of them starts an independent animation process once the class is called? And one might of course skip ML altogether and just use computer vision. But for my project idea and theme ML would be fitting.

Any ideas welcome! Take care,

#include "ofApp.h"

//--------------------------------------------------------------
void ofApp::setup(){
    
    ofBackground(0,0,0);
    ofSetFrameRate(60);
    
    vidGrabber.setVerbose(true);
    vidGrabber.setup(640,480);
    
    classID = 0;
    recordingState = false;
}

//--------------------------------------------------------------
void ofApp::update(){
    vidGrabber.update();
    
    //making a copy of video image and downsampling it
    smallImg.setFromPixels(vidGrabber.getPixels());
    smallImg.resize(32, 24);
    ofPixelsRef pixelsRef = smallImg.getPixels();
    
    //-------RAPID-MIX STUFF---------------//
    std::vector<double> trainingInput;
    std::vector<double> trainingOutput;
    
    //loop over image pixels and get brightness of pixels
    for (int i = 0; i < smallImg.getWidth(); ++i){
        for (int j = 0; j < smallImg.getHeight(); ++j){
            float lightness = pixelsRef.getColor(i,j).getLightness();
            trainingInput.push_back(double(lightness));
        }
    }
    

    if (recordingState) { // if recording, start saving brightness data
        trainingOutput = { double(classID) };
        trainingExample tempExample;
        tempExample.input = trainingInput;
        tempExample.output = trainingOutput;
        myData.push_back(tempExample);
    }
    
    if (trained) { // if classifier trained, start classifying brightness data
        result = myKnn.run(trainingInput)[0];
    }

}

//--------------------------------------------------------------
void ofApp::draw(){
    ofSetColor(255);
    vidGrabber.draw(0,0);
    smallImg.draw(0,0,64,48);
    
    if (recordingState) {
        ofSetColor(255);
        ofDrawBitmapString("collecting data for state: " + ofToString(classID), 10, 60);
    }
    if (trained) {
        ofSetColor(255);
        ofDrawBitmapString("state detected: " + ofToString(result), 10, 60);
    }

}

//--------------------------------------------------------------
void ofApp::keyPressed  (int key){
    if (key == 'r' || key == 'R')  {
        recordingState = true;
        trained = false;
    }
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){
    if(myData.size() > 0) {
        trained = myKnn.train(myData); // train classifier
        myKnn.writeJSON(ofToDataPath("data.json", true)); // save model
        recordingState = false;
        classID++;                  // increment classID to prepare for next class
    }
}