added CV_OUT to CvANN_MLP::predict
python cv2 MLP sample done
This commit is contained in:
parent
622bd42224
commit
a0af870719
@ -1926,7 +1926,7 @@ public:
|
||||
CvANN_MLP_TrainParams params = CvANN_MLP_TrainParams(),
|
||||
int flags=0 );
|
||||
|
||||
CV_WRAP virtual float predict( const cv::Mat& inputs, cv::Mat& outputs ) const;
|
||||
CV_WRAP virtual float predict( const cv::Mat& inputs, CV_OUT cv::Mat& outputs ) const;
|
||||
#endif
|
||||
|
||||
CV_WRAP virtual void clear();
|
||||
|
@ -90,6 +90,7 @@ class SVM(LetterStatModel):
|
||||
def predict(self, samples):
|
||||
return np.float32( [self.model.predict(s) for s in samples] )
|
||||
|
||||
|
||||
class MLP(LetterStatModel):
|
||||
def __init__(self):
|
||||
self.model = cv2.ANN_MLP()
|
||||
@ -109,10 +110,8 @@ class MLP(LetterStatModel):
|
||||
self.model.train(samples, np.float32(new_responses), None, params = params)
|
||||
|
||||
def predict(self, samples):
|
||||
pass
|
||||
#return np.float32( [self.model.predict(s) for s in samples] )
|
||||
|
||||
|
||||
ret, resp = self.model.predict(samples)
|
||||
return resp.argmax(-1)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user