diff --git a/modules/text/src/ocr_holistic.cpp b/modules/text/src/ocr_holistic.cpp index 8e0bae007..035f104f2 100644 --- a/modules/text/src/ocr_holistic.cpp +++ b/modules/text/src/ocr_holistic.cpp @@ -271,9 +271,9 @@ protected: //Size outputGeometry_;//= Size(1,1); //int channelCount_; // int inputChannel_ ;//=1; - int _inputHeight; - int _inputWidth ; - int _inputChannel ; + // int _inputHeight; + //int _inputWidth ; + //int _inputChannel ; public: DeepCNNOpenCvDNNImpl(const DeepCNNOpenCvDNNImpl& dn): minibatchSz_(dn.minibatchSz_),outputSize_(dn.outputSize_){ @@ -300,8 +300,8 @@ public: //Implemented to supress Visual Studio warning "assignment operator could not be generated" } - DeepCNNOpenCvDNNImpl(String modelArchFilename, String modelWeightsFilename,Ptr preprocessor, int maxMinibatchSz,int inputWidth =100,int inputHeight = 32,int inputChannel =1) - :minibatchSz_(maxMinibatchSz),_inputWidth(inputWidth),_inputHeight(inputHeight),_inputChannel(inputChannel) + DeepCNNOpenCvDNNImpl(String modelArchFilename, String modelWeightsFilename,Ptr preprocessor, int maxMinibatchSz,int inputWidth ,int inputHeight ,int inputChannel ) + :minibatchSz_(maxMinibatchSz) { CV_Assert(this->minibatchSz_>0); @@ -326,8 +326,8 @@ public: } - this->inputGeometry_=Size(_inputWidth,_inputHeight);// Size(inputLayer->width(), inputLayer->height()); - this->channelCount_ = _inputChannel;//inputLayer->channels(); + this->inputGeometry_=Size(inputWidth,inputHeight);// Size(inputLayer->width(), inputLayer->height()); + this->channelCount_ = inputChannel;//inputLayer->channels(); //inputLayer->Reshape(this->minibatchSz_,this->channelCount_,this->inputGeometry_.height, this->inputGeometry_.width); Ptr< Layer > outLayer= net_->getLayer (net_->getLayerId (net_->getLayerNames()[net_->getLayerNames().size()-2])); @@ -408,7 +408,7 @@ Ptr DeepCNN::create(String archFilename,String weightsFilename,Ptr(new DeepCNNCaffeImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); #elif defined(HAVE_DNN) - return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); + return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz,100,32,1)); #else CV_Error(Error::StsError,"DeepCNN::create backend not implemented"); return Ptr(); @@ -419,7 +419,7 @@ Ptr DeepCNN::create(String archFilename,String weightsFilename,Ptr(new DeepCNNCaffeImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); break; case OCR_HOLISTIC_BACKEND_DNN: - return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); + return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz,100,32,1)); break; case OCR_HOLISTIC_BACKEND_NONE: default: @@ -440,7 +440,7 @@ Ptr DeepCNN::createDictNet(String archFilename,String weightsFilename,i return Ptr(new DeepCNNCaffeImpl(archFilename, weightsFilename,preprocessor, 100)); #elif defined(HAVE_DNN) - return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, 100)); + return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, 100,100,32,1)); #else CV_Error(Error::StsError,"DeepCNN::create backend not implemented"); return Ptr(); @@ -451,7 +451,7 @@ Ptr DeepCNN::createDictNet(String archFilename,String weightsFilename,i return Ptr(new DeepCNNCaffeImpl(archFilename, weightsFilename,preprocessor, 100)); break; case OCR_HOLISTIC_BACKEND_DNN: - return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, 100)); + return Ptr(new DeepCNNOpenCvDNNImpl(archFilename, weightsFilename,preprocessor, 100,100,32,1)); break; case OCR_HOLISTIC_BACKEND_NONE: default: diff --git a/modules/text/src/text_detectorCNN.cpp b/modules/text/src/text_detectorCNN.cpp index 9b2e61ac6..87f132850 100644 --- a/modules/text/src/text_detectorCNN.cpp +++ b/modules/text/src/text_detectorCNN.cpp @@ -376,7 +376,7 @@ Ptr DeepCNNTextDetector::create(String archFilename,String return Ptr(new DeepCNNTextDetectorCaffeImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); #elif defined(HAVE_DNN) - return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); + return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz,700,700,3)); #else CV_Error(Error::StsError,"DeepCNNTextDetector::create backend not implemented"); return Ptr(); @@ -387,7 +387,7 @@ Ptr DeepCNNTextDetector::create(String archFilename,String break; case OCR_HOLISTIC_BACKEND_DNN: - return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz)); + return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, minibatchSz,700,700,3)); break; case OCR_HOLISTIC_BACKEND_NONE: @@ -420,7 +420,7 @@ Ptr DeepCNNTextDetector::createTextBoxNet(String archFilena return Ptr(new DeepCNNTextDetectorCaffeImpl(archFilename, weightsFilename,preprocessor, 1)); #elif defined(HAVE_DNN) - return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, 1)); + return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, 1,700,700,3)); #else CV_Error(Error::StsError,"DeepCNNTextDetector::create backend not implemented"); return Ptr(); @@ -430,7 +430,7 @@ Ptr DeepCNNTextDetector::createTextBoxNet(String archFilena return Ptr(new DeepCNNTextDetectorCaffeImpl(archFilename, weightsFilename,preprocessor, 1)); break; case OCR_HOLISTIC_BACKEND_DNN: - return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, 1)); + return Ptr(new DeepCNNTextDetectorDNNImpl(archFilename, weightsFilename,preprocessor, 1,700,700,3)); break; case OCR_HOLISTIC_BACKEND_NONE: default: