Skip to content

Commit 2b78890

Browse files
committed
Attenpt to supress visual studio and IOS warnings
1 parent 53a8677 commit 2b78890

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

modules/text/FindProtobuf.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Protobuf package required for Caffe
1+
#Protobuf package required for Caffe
22
unset(Protobuf_FOUND)
33

44
find_library(Protobuf_LIBS NAMES protobuf

modules/text/samples/dictnet_demo.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ def mouseCallback(event, x, y, flags, param):
3838
cv2.rectangle(drawImage, refPt[0], refPt[1], (0, 255, 0), 2)
3939
cv2.putText(drawImage,"%s:%f"%(res[0],res[1]),refPt[0],cv2.FONT_HERSHEY_SIMPLEX,1,(255,255,255),2)
4040
cv2.imshow("Select A Region", drawImage)
41-
41+
4242

4343
if __name__=='__main__':
4444
USEGPU=False
45-
helpStr=""" Usage: """+sys.argv[0]+""" IMAGE_FILENAME
46-
45+
helpStr="""Usage: """+sys.argv[0]+""" IMAGE_FILENAME
46+
4747
Press 'q' or 'Q' exit
48-
48+
4949
The modelFiles must be available in the current directory.
5050
In linux shell they can be downloaded (~2GB) with the following commands:
5151
wget http://nicolaou.homouniversalis.org/assets/vgg_text/dictnet_vgg.caffemodel
@@ -56,7 +56,7 @@ def mouseCallback(event, x, y, flags, param):
5656
print helpStr
5757
print 'No image file given Aborting!'
5858
sys.exit(1)
59-
if not (os.path.isfile('dictnet_vgg_deploy.prototxt') and
59+
if not (os.path.isfile('dictnet_vgg_deploy.prototxt') and
6060
os.path.isfile('dictnet_vgg.caffemodel') and
6161
os.path.isfile('dictnet_vgg_labels.txt')):
6262
print helpStr

modules/text/src/ocr_holistic.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class DictNetCaffeImpl: public DictNet{
6767
net_->Reshape();
6868
float* inputBuffer=net_->input_blobs()[0]->mutable_cpu_data();
6969
float* inputData=inputBuffer;
70-
for(int imgNum=0;imgNum<inputImageList.size();imgNum++){
70+
for(size_t imgNum=0;imgNum<inputImageList.size();imgNum++){
7171
Mat preprocessed;
7272
cv::Mat netInputWraped(this->inputGeometry_.height, this->inputGeometry_.width, CV_32FC1, inputData);
7373
this->preprocess(inputImageList[imgNum],preprocessed);
@@ -87,11 +87,16 @@ class DictNetCaffeImpl: public DictNet{
8787
Size inputGeometry_;
8888
const int minibatchSz_;
8989
const bool gpuBackend_;
90-
Ptr<Mat> meanImage_;
91-
bool standarize_;
92-
std::vector<std::string> labels_;
9390
int outputSize_;
9491
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+
95100
DictNetCaffeImpl(String modelArchFilename, String modelWeightsFilename, int maxMinibatchSz, bool useGpu)
96101
:minibatchSz_(maxMinibatchSz), gpuBackend_(useGpu){
97102
CV_Assert(this->minibatchSz_>0);
@@ -128,9 +133,9 @@ class DictNetCaffeImpl: public DictNet{
128133
void classifyBatch(InputArrayOfArrays inputImageList, OutputArray classProbabilities){
129134
std::vector<Mat> allImageVector;
130135
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);
132137
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_){
134139
int rangeEnd=imgNum+std::min<int>(allImageVector.size()-imgNum,this->minibatchSz_);
135140
std::vector<Mat>::const_iterator from=allImageVector.begin()+imgNum;
136141
std::vector<Mat>::const_iterator to=allImageVector.begin()+rangeEnd;
@@ -250,7 +255,7 @@ class OCRHolisticWordRecognizerImpl: public OCRHolisticWordRecognizer{
250255
}
251256
if(component_confidences!=NULL){
252257
component_confidences->resize(1);
253-
(*component_confidences)[0]=confidence;
258+
(*component_confidences)[0]=float(confidence);
254259
}
255260
}
256261
void run(Mat& image, Mat& mask, std::string& output_text, std::vector<Rect>* component_rects=NULL,
@@ -261,13 +266,7 @@ class OCRHolisticWordRecognizerImpl: public OCRHolisticWordRecognizer{
261266
}
262267
std::vector<String>& getVocabulary(){
263268
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+
}
271270
};
272271

273272
Ptr<OCRHolisticWordRecognizer> OCRHolisticWordRecognizer::create(Ptr<TextImageClassifier> classifierPtr,String vocabullaryFilename ){

0 commit comments

Comments
 (0)