I am using CNTK C++ API for License Plate Detection. My problem is that the code does not work in debug mode and it is very slow.
Here is my setup:
i am using Visual Studio 2015 Update 3
i have added CNTK.CPUOnly nuget package
i have trained the model in Keras with CNTK back-end
cv::Mat AECropper::GetMask(cv::Mat img) {
// pre-process and resize
cv::Mat img_pp = Preprocess(img);
// create network input from the image
ValuePtr inVal;
MatToInput(img_pp, inVal);
// pointer for network output
ValuePtr outVal;
std::unordered_map<Variable, ValuePtr> inputs = { {inVar, inVal} };
std::unordered_map<Variable, ValuePtr> outputs = { { outVar, outVal } };
// compute the output for the given input
model->Forward(inputs, outputs,DeviceDescriptor::CPUDevice());
// create an image from network's output
cv::Mat raw_mask = OutputToMat(outputs[outVar]);
// resize back to the original size
cv::Mat mask = Resize(raw_mask, img.size());
return mask;
}
The call to the Forward method takes 70 seconds in Debug mode and 0.5 seconds in Release mode and their result is different.
Release result:
Debug result:
This makes debugging very hard for me. i cannot trace the code in the release mode.
Do you know why CNTK behaves very different in Debug?
Is there any way to fix it?
Thanks.
I am using CNTK C++ API for License Plate Detection. My problem is that the code does not work in debug mode and it is very slow. Here is my setup:
The call to the
Forward
method takes 70 seconds in Debug mode and 0.5 seconds in Release mode and their result is different.Release result:
Debug result:
This makes debugging very hard for me. i cannot trace the code in the release mode. Do you know why CNTK behaves very different in Debug? Is there any way to fix it? Thanks.