Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

ANN_MLP Access violation Exception

i train ann to detect eye state with out problem but when i want to load pre trained file and predict samples this exception occurred : my training image size is 24*24;

Exception thrown at 0x00007FF8BB6980DC (opencv_world310d.dll) in SvmTrainingEye.exe: 0xC0000005: Access violation reading location 0x0000001F8768B000.

this is my code:

Mat openEye, closeEye,imgOpen,imgClose;
imgOpen = cv::imread("open.jpg");
imgClose = cv::imread("close.jpg");

cv::resize(imgOpen, openEye, cv::Size(24,24));
cv::resize(imgClose, closeEye, cv::Size(24, 24));

Mat lbpOpen, lbpClose;
if (openEye.channels() > 1)
    cvtColor(openEye, openEye, CV_BGR2GRAY);
lbp::ELBP(openEye, lbpOpen, 1, 16);
if (closeEye.channels() > 1)
    cvtColor(closeEye, closeEye, CV_BGR2GRAY);
lbp::ELBP(closeEye, lbpClose, 1, 16);

lbpOpen = lbpOpen.reshape(0, 1);
lbpClose = lbpClose.reshape(0, 1);

lbpOpen.convertTo(lbpOpen, CV_32FC1);
lbpClose.convertTo(lbpClose, CV_32FC1);

cv::Ptr<cv::ml::ANN_MLP> eyeNetwork;
eyeNetwork = Algorithm::load<ml::ANN_MLP>("Ann_sigmoid_eye.xml");

Mat outputOpen, outputClose;

eyeNetwork->predict(lbpOpen, outputOpen);
eyeNetwork->predict(lbpClose, outputClose);