Ask Your Question
0

Undefined symbols for architecture x86_64

asked 2020-10-25 10:36:50 -0600

updated 2020-10-25 12:10:19 -0600

berak gravatar image

Hi there,

I'm trying to build traincascade in VSC using MacOS. I managed to get the annotation tool to work perfectly fine, but when I go to actually train my positive and negative images, I keep receiving the following error:

Undefined symbols for architecture x86_64:
[build]   "CvCascadeParams::scanAttr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
[build]       _main in traincascade.cpp.o
[build]   "CvCascadeParams::CvCascadeParams()", referenced from:
[build]       _main in traincascade.cpp.o
[build]       CvCascadeClassifier::CvCascadeClassifier() in traincascade.cpp.o
[build]   "CvHOGFeatureParams::CvHOGFeatureParams()", referenced from:
[build]       std::__1::__compressed_pair_elem<CvHOGFeatureParams, 1, false>::__compressed_pair_elem(std::__1::__value_init_tag) in traincascade.cpp.o
[build]   "CvLBPFeatureParams::CvLBPFeatureParams()", referenced from:
[build]       std::__1::__compressed_pair_elem<CvLBPFeatureParams, 1, false>::__compressed_pair_elem(std::__1::__value_init_tag) in traincascade.cpp.o
[build]   "CvCascadeClassifier::train(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, int, int, int, int, int, CvCascadeParams const&, CvFeatureParams const&, CvCascadeBoostParams const&, bool, double)", referenced from:
[build]       _main in traincascade.cpp.o
[build]   "CvHaarFeatureParams::CvHaarFeatureParams()", referenced from:
[build]       std::__1::__compressed_pair_elem<CvHaarFeatureParams, 1, false>::__compressed_pair_elem(std::__1::__value_init_tag) in traincascade.cpp.o
[build]   "CvCascadeBoostParams::scanAttr(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
[build]       _main in traincascade.cpp.o
[build]   "CvCascadeBoostParams::CvCascadeBoostParams()", referenced from:
[build]       _main in traincascade.cpp.o
[build]   "CvCascadeImageReader::NegReader::NegReader()", referenced from:
[build]       CvCascadeImageReader::CvCascadeImageReader() in traincascade.cpp.o
[build]   "CvCascadeImageReader::PosReader::PosReader()", referenced from:
[build]       CvCascadeImageReader::CvCascadeImageReader() in traincascade.cpp.o
[build]   "CvCascadeImageReader::PosReader::~PosReader()", referenced from:
[build]       CvCascadeImageReader::CvCascadeImageReader() in traincascade.cpp.o
[build]       CvCascadeImageReader::~CvCascadeImageReader() in traincascade.cpp.o
[build]   "CvCascadeParams::printDefaults() const", referenced from:
[build]       _main in traincascade.cpp.o
[build]   "CvCascadeBoostParams::printDefaults() const", referenced from:
[build]       _main in traincascade.cpp.o
[build]   "vtable for CvParams", referenced from:
[build]       CvParams::~CvParams() in traincascade.cpp.o
[build]   NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
[build] ld: symbol(s) not found for architecture x86_64
[build] clang: error: linker command failed with exit code 1 (use -v to see invocation)
[build] make[2]: *** [opencv_traincascade] Error 1
[build] make[1]: *** [CMakeFiles/opencv_traincascade.dir/all] Error 2
[build] make: *** [all] Error 2

Really not sure what's going on here. When I run pkg-config --cflags --libs opencv4 I get:

-I/usr/local/Cellar/opencv/4.5.0_1/include/opencv4 -L/usr/local/Cellar/opencv/4.5.0_1/lib -lopencv_gapi -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_sfm -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core

Help please!

edit retag flag offensive close merge delete

Comments

what are you trying to detect ? (in 90% cases it's the wrong tool, anyway...)

berak gravatar imageberak ( 2020-10-25 12:17:45 -0600 )edit
1

from your previous question "I'm trying to use opencv_traincascade for a project to detect whether someone is sleeping while driving.". i think you should find another idea.

sturkmen gravatar imagesturkmen ( 2020-10-25 12:18:59 -0600 )edit
1

to detect whether someone is sleeping while driving.

i also think, you're on the wrong track, then. this probably requires facial landmark detection and training an eyes open/closed classifier, not cascades or any other "object detection"

berak gravatar imageberak ( 2020-10-25 12:45:45 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2020-10-25 12:24:06 -0600

berak gravatar image

with opencv4, a lot of c-api code was removed, and thus the traincascade app does no more build.

(it's not your cmdline or pkg configuration, it's just impossible atm)

you might:

  • try to train a HOGDetector instead (similar quality, but similar problems, too)
  • look into more modern object detection cnns, like yolo, SSD, squeezenet

  • fall back to opencv3.4, where you still can build the cascade training tools properly

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-10-25 10:36:50 -0600

Seen: 505 times

Last updated: Oct 25 '20