# \#svm

**URL:** https://forum.opencv.org/tag/svm/206.md

[Latest](https://forum.opencv.org/latest.md) · [Categories](https://forum.opencv.org/categories.md) · [Tags](https://forum.opencv.org/tags.md)

---

## [Training model to detect color instead of shape/features? AKA "Banana ripeness detector"](https://forum.opencv.org/t/training-model-to-detect-color-instead-of-shape-features-aka-banana-ripeness-detector/7203)

<div class="topic-metadata">

**Author:** [@CodeLoonie](https://forum.opencv.org/u/CodeLoonie)\
**Replies:** 0\
**Last updated:** [January 19, 2022, 2:34pm UTC](https://forum.opencv.org/t/training-model-to-detect-color-instead-of-shape-features-aka-banana-ripeness-detector/7203 "2022-01-19T14:34:34Z")

</div>

Hello there! Beginner here! So long story short I’m doing a program that detects bananas in a picture and tells you how ripe they are. How I want to do that? Well, I want to train a certain model to detect color and the…

---

## [Why SVM-\>predict(Mat) returns very large value that is greater than number of class?](https://forum.opencv.org/t/why-svm-predict-mat-returns-very-large-value-that-is-greater-than-number-of-class/16678)

<div class="topic-metadata">

**Author:** [@biabeogo147](https://forum.opencv.org/u/biabeogo147)\
**Replies:** 1\
**Last updated:** [March 4, 2024, 9:03am UTC](https://forum.opencv.org/t/why-svm-predict-mat-returns-very-large-value-that-is-greater-than-number-of-class/16678 "2024-03-04T09:03:23Z")

</div>

I start learning OpenCV and MFC, and my project is License Plate Recognition. However, there is a problem: SVM-\>predict(Mat) returns weird values and I don’t know why. This is my code: #include "TrainSVM.h" #include \<o…

---

## [SVM::isTrained returns false after SVM::load](https://forum.opencv.org/t/svm-istrained-returns-false-after-svm-load/14764)

<div class="topic-metadata">

**Author:** [@Rjc](https://forum.opencv.org/u/Rjc)\
**Replies:** 1\
**Last updated:** [October 6, 2023, 7:09am UTC](https://forum.opencv.org/t/svm-istrained-returns-false-after-svm-load/14764 "2023-10-06T07:09:48Z")

</div>

I successfully trained and predicted with SVM. The results are great with Windows OpenCV C++ versions 4.1 and 4.8. Parameters: Type: C\_SVC Kernel: RBF C: 1.0 Gamma: 0.5 TermCriteria: EPS, 1000, 1e-6 I save the mod…

---

## [What do the values returned from cv::ml::StatModel::predict() when using the RAW\_OUTPUT flag represent?](https://forum.opencv.org/t/what-do-the-values-returned-from-cv-predict-when-using-the-raw-output-flag-represent/8449)

<div class="topic-metadata">

**Author:** [@snsc](https://forum.opencv.org/u/snsc)\
**Replies:** 1\
**Last updated:** [April 20, 2022, 8:33am UTC](https://forum.opencv.org/t/what-do-the-values-returned-from-cv-predict-when-using-the-raw-output-flag-represent/8449 "2022-04-20T08:33:45Z")

</div>

I’m using an SVM to predict if images are of one label or another. I wanted to get some more information from the cv::ml::StatModel::predict method, so I used the RAW\_OUTPUT flag to get some value other than just the pre…

---

## [Different accuracy between OpenCV's SVM and sklearn's LinearSVM](https://forum.opencv.org/t/different-accuracy-between-opencvs-svm-and-sklearns-linearsvm/8380)

<div class="topic-metadata">

**Author:** [@Merkaber](https://forum.opencv.org/u/Merkaber)\
**Replies:** 0\
**Last updated:** [April 13, 2022, 3:18am UTC](https://forum.opencv.org/t/different-accuracy-between-opencvs-svm-and-sklearns-linearsvm/8380 "2022-04-13T03:18:46Z")

</div>

What is the difference between OpenCVs linear SVM and sklearn LinearSVM? The accuracy differs by 10%. sklearn: clf = make\_pipeline(MaxAbsScaler(), LinearSVC(C=1.0, tol=1e-8, max\_iter=1000)) clf.fit(training\_data, label…

---

## [Does svm-\>train() has a size limit? (segmentation fault)](https://forum.opencv.org/t/does-svm-train-has-a-size-limit-segmentation-fault/7985)

<div class="topic-metadata">

**Author:** [@Merkaber](https://forum.opencv.org/u/Merkaber)\
**Replies:** 2\
**Last updated:** [March 17, 2022, 7:15pm UTC](https://forum.opencv.org/t/does-svm-train-has-a-size-limit-segmentation-fault/7985 "2022-03-17T19:15:07Z")

</div>

Does svm-\>train() has a size limit? cv::Mat data(134181242, 2, CV\_32F, data.data()); cv::Mat label(134181242, 1, CV\_32SC1, label.data()); svm-\>train(data, ROW\_SAMPLE, label); will fail with segmentation fault. Howev…
