When i write “make -j4 && make pycaffe” I already done the suggestions in changing
CV_LOAD_IMAGE_COLOR and V_LOAD_IMAGE_GRAYSCALE to cv::IMREAD_COLOR and cv::IMREAD_GRAYSCALE respectively. And i’ve also tried adding USE_OPENCV = 1 to the files such as makefile, but it seems to not work at all. I’ve successfully made that command(make -j4 && make pycaffe) to the fresh installed opencv4 and caffe without sweat but when I tried to do it in faster-rcnn folder, i just seem to run out of bugs at all.
Ubuntu : ver 20.0
OpenCV : ver 4
Python: ver 3
Caffe : 1.0.0
**the error log**:
src/caffe/util/io.cpp: In function ‘bool caffe::ReadImageToDatum(const string&, int, int, int, int, int, bool, const string&, caffe::Datum*)’:
src/caffe/util/io.cpp:172:7: error: ‘EncodeCVMatToDatum’ was not declared in this scope; did you mean ‘CVMatToDatum’?
172 | EncodeCVMatToDatum(cv_img, encoding, datum);
| ^~~~~~~~~~~~~~~~~~
| CVMatToDatum
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:197:35: error: ‘AnnotatedDatum_AnnotationType’ does not name a type
197 | const string& encoding, const AnnotatedDatum_AnnotationType type,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:199:5: error: ‘AnnotatedDatum’ has not been declared
199 | AnnotatedDatum* anno_datum) {
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::ReadRichImageToAnnotatedDatum(const string&, const string&, int, int, int, int, bool, const string&, int, const string&, const std::map<std::__cxx11::basic_string<char>, int>&, int*)’:
src/caffe/util/io.cpp:203:46: error: request for member ‘mutable_datum’ in ‘* anno_datum’, which is of non-class type ‘int’
203 | anno_datum->mutable_datum());
| ^~~~~~~~~~~~~
src/caffe/util/io.cpp:207:15: error: request for member ‘clear_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
207 | anno_datum->clear_annotation_group();
| ^~~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:212:10: error: ‘AnnotatedDatum_AnnotationType_BBOX’ was not declared in this scope
212 | case AnnotatedDatum_AnnotationType_BBOX:
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:216:16: error: ‘ReadXMLToAnnotatedDatum’ was not declared in this scope; did you mean ‘ReadRichImageToAnnotatedDatum’?
216 | return ReadXMLToAnnotatedDatum(labelfile, ori_height, ori_width,
| ^~~~~~~~~~~~~~~~~~~~~~~
| ReadRichImageToAnnotatedDatum
src/caffe/util/io.cpp:219:16: error: ‘ReadJSONToAnnotatedDatum’ was not declared in this scope; did you mean ‘ReadRichImageToAnnotatedDatum’?
219 | return ReadJSONToAnnotatedDatum(labelfile, ori_height, ori_width,
| ^~~~~~~~~~~~~~~~~~~~~~~~
| ReadRichImageToAnnotatedDatum
src/caffe/util/io.cpp:222:16: error: ‘ReadTxtToAnnotatedDatum’ was not declared in this scope; did you mean ‘ReadRichImageToAnnotatedDatum’?
222 | return ReadTxtToAnnotatedDatum(labelfile, ori_height, ori_width,
| ^~~~~~~~~~~~~~~~~~~~~~~
| ReadRichImageToAnnotatedDatum
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:260:5: error: ‘AnnotatedDatum’ has not been declared
260 | AnnotatedDatum* anno_datum) {
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::ReadXMLToAnnotatedDatum(const string&, int, int, const std::map<std::__cxx11::basic_string<char>, int>&, int*)’:
src/caffe/util/io.cpp:284:7: error: ‘Annotation’ was not declared in this scope
284 | Annotation* anno = NULL;
| ^~~~~~~~~~
src/caffe/util/io.cpp:284:19: error: ‘anno’ was not declared in this scope
284 | Annotation* anno = NULL;
| ^~~~
src/caffe/util/io.cpp:296:43: error: request for member ‘annotation_group_size’ in ‘* anno_datum’, which is of non-class type ‘int’
296 | for (int g = 0; g < anno_datum->annotation_group_size(); ++g) {
| ^~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:297:13: error: ‘AnnotationGroup’ was not declared in this scope
297 | AnnotationGroup* anno_group =
| ^~~~~~~~~~~~~~~
src/caffe/util/io.cpp:297:30: error: ‘anno_group’ was not declared in this scope
297 | AnnotationGroup* anno_group =
| ^~~~~~~~~~
src/caffe/util/io.cpp:298:29: error: request for member ‘mutable_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
298 | anno_datum->mutable_annotation_group(g);
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:312:13: error: ‘AnnotationGroup’ was not declared in this scope
312 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~~~~~~
src/caffe/util/io.cpp:312:30: error: ‘anno_group’ was not declared in this scope
312 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~
src/caffe/util/io.cpp:312:55: error: request for member ‘add_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
312 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:347:11: error: ‘NormalizedBBox’ was not declared in this scope
347 | NormalizedBBox* bbox = anno->mutable_bbox();
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp:347:27: error: ‘bbox’ was not declared in this scope
347 | NormalizedBBox* bbox = anno->mutable_bbox();
| ^~~~
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:363:5: error: ‘AnnotatedDatum’ has not been declared
363 | AnnotatedDatum* anno_datum) {
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::ReadJSONToAnnotatedDatum(const string&, int, int, const std::map<std::__cxx11::basic_string<char>, int>&, int*)’:
src/caffe/util/io.cpp:387:5: error: ‘Annotation’ was not declared in this scope
387 | Annotation* anno = NULL;
| ^~~~~~~~~~
src/caffe/util/io.cpp:387:17: error: ‘anno’ was not declared in this scope
387 | Annotation* anno = NULL;
| ^~~~
src/caffe/util/io.cpp:397:37: error: request for member ‘annotation_group_size’ in ‘* anno_datum’, which is of non-class type ‘int’
397 | for (int g = 0; g < anno_datum->annotation_group_size(); ++g) {
| ^~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:398:7: error: ‘AnnotationGroup’ was not declared in this scope
398 | AnnotationGroup* anno_group =
| ^~~~~~~~~~~~~~~
src/caffe/util/io.cpp:398:24: error: ‘anno_group’ was not declared in this scope
398 | AnnotationGroup* anno_group =
| ^~~~~~~~~~
src/caffe/util/io.cpp:399:23: error: request for member ‘mutable_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
399 | anno_datum->mutable_annotation_group(g);
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:413:7: error: ‘AnnotationGroup’ was not declared in this scope
413 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~~~~~~
src/caffe/util/io.cpp:413:24: error: ‘anno_group’ was not declared in this scope
413 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~
src/caffe/util/io.cpp:413:49: error: request for member ‘add_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
413 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:455:5: error: ‘NormalizedBBox’ was not declared in this scope
455 | NormalizedBBox* bbox = anno->mutable_bbox();
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp:455:21: error: ‘bbox’ was not declared in this scope
455 | NormalizedBBox* bbox = anno->mutable_bbox();
| ^~~~
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:467:22: error: ‘AnnotatedDatum’ has not been declared
467 | const int width, AnnotatedDatum* anno_datum) {
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::ReadTxtToAnnotatedDatum(const string&, int, int, int*)’:
src/caffe/util/io.cpp:476:5: error: ‘Annotation’ was not declared in this scope
476 | Annotation* anno = NULL;
| ^~~~~~~~~~
src/caffe/util/io.cpp:476:17: error: ‘anno’ was not declared in this scope
476 | Annotation* anno = NULL;
| ^~~~
src/caffe/util/io.cpp:479:37: error: request for member ‘annotation_group_size’ in ‘* anno_datum’, which is of non-class type ‘int’
479 | for (int g = 0; g < anno_datum->annotation_group_size(); ++g) {
| ^~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:480:7: error: ‘AnnotationGroup’ was not declared in this scope
480 | AnnotationGroup* anno_group = anno_datum->mutable_annotation_group(g);
| ^~~~~~~~~~~~~~~
src/caffe/util/io.cpp:480:24: error: ‘anno_group’ was not declared in this scope
480 | AnnotationGroup* anno_group = anno_datum->mutable_annotation_group(g);
| ^~~~~~~~~~
src/caffe/util/io.cpp:480:49: error: request for member ‘mutable_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
480 | AnnotationGroup* anno_group = anno_datum->mutable_annotation_group(g);
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:494:7: error: ‘AnnotationGroup’ was not declared in this scope
494 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~~~~~~
src/caffe/util/io.cpp:494:24: error: ‘anno_group’ was not declared in this scope
494 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~
src/caffe/util/io.cpp:494:49: error: request for member ‘add_annotation_group’ in ‘* anno_datum’, which is of non-class type ‘int’
494 | AnnotationGroup* anno_group = anno_datum->add_annotation_group();
| ^~~~~~~~~~~~~~~~~~~~
src/caffe/util/io.cpp:521:5: error: ‘NormalizedBBox’ was not declared in this scope
521 | NormalizedBBox* bbox = anno->mutable_bbox();
| ^~~~~~~~~~~~~~
src/caffe/util/io.cpp:521:21: error: ‘bbox’ was not declared in this scope
521 | NormalizedBBox* bbox = anno->mutable_bbox();
| ^~~~
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:532:30: error: ‘LabelMap’ has not been declared
532 | const string& delimiter, LabelMap* map) {
| ^~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::ReadLabelFileToLabelMap(const string&, bool, const string&, int*)’:
src/caffe/util/io.cpp:534:8: error: request for member ‘Clear’ in ‘* map’, which is of non-class type ‘int’
534 | map->Clear();
| ^~~~~
src/caffe/util/io.cpp:545:3: error: ‘LabelMapItem’ was not declared in this scope
545 | LabelMapItem* map_item;
| ^~~~~~~~~~~~
src/caffe/util/io.cpp:545:17: error: ‘map_item’ was not declared in this scope
545 | LabelMapItem* map_item;
| ^~~~~~~~
src/caffe/util/io.cpp:548:21: error: request for member ‘add_item’ in ‘* map’, which is of non-class type ‘int’
548 | map_item = map->add_item();
| ^~~~~~~~
src/caffe/util/io.cpp:563:21: error: request for member ‘add_item’ in ‘* map’, which is of non-class type ‘int’
563 | map_item = map->add_item();
| ^~~~~~~~
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:588:27: error: ‘LabelMap’ does not name a type
588 | bool MapNameToLabel(const LabelMap& map, const bool strict_check,
| ^~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::MapNameToLabel(const int&, bool, std::map<std::__cxx11::basic_string<char>, int>*)’:
src/caffe/util/io.cpp:593:27: error: request for member ‘item_size’ in ‘map’, which is of non-class type ‘const int’
593 | for (int i = 0; i < map.item_size(); ++i) {
| ^~~~~~~~~
src/caffe/util/io.cpp:594:30: error: request for member ‘item’ in ‘map’, which is of non-class type ‘const int’
594 | const string& name = map.item(i).name();
| ^~~~
src/caffe/util/io.cpp:595:27: error: request for member ‘item’ in ‘map’, which is of non-class type ‘const int’
595 | const int label = map.item(i).label();
| ^~~~
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:608:27: error: ‘LabelMap’ does not name a type
608 | bool MapLabelToName(const LabelMap& map, const bool strict_check,
| ^~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::MapLabelToName(const int&, bool, std::map<int, std::__cxx11::basic_string<char> >*)’:
src/caffe/util/io.cpp:613:27: error: request for member ‘item_size’ in ‘map’, which is of non-class type ‘const int’
613 | for (int i = 0; i < map.item_size(); ++i) {
| ^~~~~~~~~
src/caffe/util/io.cpp:614:30: error: request for member ‘item’ in ‘map’, which is of non-class type ‘const int’
614 | const string& name = map.item(i).name();
| ^~~~
src/caffe/util/io.cpp:615:27: error: request for member ‘item’ in ‘map’, which is of non-class type ‘const int’
615 | const int label = map.item(i).label();
| ^~~~
src/caffe/util/io.cpp: At global scope:
src/caffe/util/io.cpp:628:34: error: ‘LabelMap’ does not name a type
628 | bool MapLabelToDisplayName(const LabelMap& map, const bool strict_check,
| ^~~~~~~~
src/caffe/util/io.cpp: In function ‘bool caffe::MapLabelToDisplayName(const int&, bool, std::map<int, std::__cxx11::basic_string<char> >*)’:
src/caffe/util/io.cpp:633:27: error: request for member ‘item_size’ in ‘map’, which is of non-class type ‘const int’
633 | for (int i = 0; i < map.item_size(); ++i) {
| ^~~~~~~~~
src/caffe/util/io.cpp:634:38: error: request for member ‘item’ in ‘map’, which is of non-class type ‘const int’
634 | const string& display_name = map.item(i).display_name();
| ^~~~
src/caffe/util/io.cpp:635:27: error: request for member ‘item’ in ‘map’, which is of non-class type ‘const int’
635 | const int label = map.item(i).label();
| ^~~~
make: *** [Makefile:578: .build_release/src/caffe/util/io.o] Error 1