def get_randomforest_pred(image, model): pose = get_pose(image) pose = clip_pose(pose) angles = get_ang(pose) prediction = model.predict_proba([angles])[0] i = prediction.argmax() return (int(i), float(prediction[i]))
def get_logreg_pred(image, classifier): pose = get_pose(image) pose = clip_pose(pose) angles = get_ang(pose) prediction = classifier.predict_proba((np.array(angles)).reshape(1, -1)) i = prediction[0].argmax() return (int(i), float(prediction[0][i]))
def get_catboost_pred(image, classifier): pose = get_pose(image) angles = get_ang(pose) prediction = classifier.predict_proba(angles) i = prediction.argmax() return (int(i), float(prediction[i]))