@@ -67,7 +67,7 @@ class DictNetCaffeImpl: public DictNet{
67
67
net_->Reshape ();
68
68
float * inputBuffer=net_->input_blobs ()[0 ]->mutable_cpu_data ();
69
69
float * inputData=inputBuffer;
70
- for (int imgNum=0 ;imgNum<inputImageList.size ();imgNum++){
70
+ for (size_t imgNum=0 ;imgNum<inputImageList.size ();imgNum++){
71
71
Mat preprocessed;
72
72
cv::Mat netInputWraped (this ->inputGeometry_ .height , this ->inputGeometry_ .width , CV_32FC1, inputData);
73
73
this ->preprocess (inputImageList[imgNum],preprocessed);
@@ -87,11 +87,16 @@ class DictNetCaffeImpl: public DictNet{
87
87
Size inputGeometry_;
88
88
const int minibatchSz_;
89
89
const bool gpuBackend_;
90
- Ptr<Mat> meanImage_;
91
- bool standarize_;
92
- std::vector<std::string> labels_;
93
90
int outputSize_;
94
91
public:
92
+ DictNetCaffeImpl (const DictNetCaffeImpl& dn):inputGeometry_(dn.inputGeometry_),minibatchSz_(dn.minibatchSz_),
93
+ gpuBackend_ (dn.gpuBackend_),outputSize_(dn.outputSize_){
94
+ // Implemented to supress Visual Studio warning
95
+ #ifdef HAVE_CAFFE
96
+ this ->net_ =dn.net_ ;
97
+ #endif
98
+ }
99
+
95
100
DictNetCaffeImpl (String modelArchFilename, String modelWeightsFilename, int maxMinibatchSz, bool useGpu)
96
101
:minibatchSz_(maxMinibatchSz), gpuBackend_(useGpu){
97
102
CV_Assert (this ->minibatchSz_ >0 );
@@ -128,9 +133,9 @@ class DictNetCaffeImpl: public DictNet{
128
133
void classifyBatch (InputArrayOfArrays inputImageList, OutputArray classProbabilities){
129
134
std::vector<Mat> allImageVector;
130
135
inputImageList.getMatVector (allImageVector);
131
- classProbabilities.create (Size (this ->outputSize_ ,allImageVector.size ()),CV_32F);
136
+ classProbabilities.create (Size (unsigned int ( this ->outputSize_ ) ,allImageVector.size ()),CV_32F);
132
137
Mat outputMat = classProbabilities.getMat ();
133
- for (int imgNum=0 ;imgNum<int ( allImageVector.size () );imgNum+=this ->minibatchSz_ ){
138
+ for (size_t imgNum=0 ;imgNum<allImageVector.size ();imgNum+=this ->minibatchSz_ ){
134
139
int rangeEnd=imgNum+std::min<int >(allImageVector.size ()-imgNum,this ->minibatchSz_ );
135
140
std::vector<Mat>::const_iterator from=allImageVector.begin ()+imgNum;
136
141
std::vector<Mat>::const_iterator to=allImageVector.begin ()+rangeEnd;
@@ -250,7 +255,7 @@ class OCRHolisticWordRecognizerImpl: public OCRHolisticWordRecognizer{
250
255
}
251
256
if (component_confidences!=NULL ){
252
257
component_confidences->resize (1 );
253
- (*component_confidences)[0 ]=confidence;
258
+ (*component_confidences)[0 ]=float ( confidence) ;
254
259
}
255
260
}
256
261
void run (Mat& image, Mat& mask, std::string& output_text, std::vector<Rect>* component_rects=NULL ,
@@ -261,13 +266,7 @@ class OCRHolisticWordRecognizerImpl: public OCRHolisticWordRecognizer{
261
266
}
262
267
std::vector<String>& getVocabulary (){
263
268
return this ->labels_ ;
264
- }/*
265
- void getVocabulary(CV_OUT const std::vector<String>& voc){
266
- voc.reshape(this->labels_.size());
267
- for(int k =0;k<voc.size();k++){
268
- voc[k]=this->labels_[k];
269
- }
270
- }*/
269
+ }
271
270
};
272
271
273
272
Ptr<OCRHolisticWordRecognizer> OCRHolisticWordRecognizer::create (Ptr<TextImageClassifier> classifierPtr,String vocabullaryFilename ){
0 commit comments