Open rsingh2083 opened 2 years ago
Yes, no problems. I assume you have only different folder names.
Tried building but getting this error in ncnn
[ ARCH=x86_64, Ubuntu 20.10]
rp@rp-server:/home/rp$ g++ -Wall -Wno-unknown-pragmas -isystem -fPIE -fopenmp -pthread -D__aarch64__ -DNDEBUG -O2 -I/usr/include/opencv4 -I/usr/local/include/ncnn -Iinclude -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -c /home/rp/.face_recog/Face-Recognition-Jetson-Nano/src/main.cpp -o obj/Release/src/main.o
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TMtCNN.h:8,
from /home/rp/.face_recog/Face-Recognition-Jetson-Nano/src/main.cpp:3:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:857:17: error: ‘_c’ was not declared in this scope
"w"(_c) // %4
^~
/usr/local/include/ncnn/mat.h:857:17: note: suggested alternative: ‘c’
"w"(_c) // %4
^~
c
The g++ command still has Linux folders like /usr/local/.. They are not available on a Windows machine. Please look for the correct installation directories of OpenCV and ncnn.
Sir Im building this on a Linux machine. Ive double checked ncnn and opencv directories , they are correct.
Just unable to solve this /usr/local/include/ncnn/mat.h:857:17: error: ‘_c’ was not declared in this scope
Sorry @rsingh2083,
I though you were on a Windows machine. I will try to replicate the error on my x86_64 Ubunut 20.04 machine. It may take a few days, as I'm very busy with other projects.
Dear @rsingh2083,
How did you install ncnn on your machine?
I've used cmake -DCMAKE_BUILD_TYPE=Release -DNCNN_BUILD_EXAMPLES=ON ..
. Nothing more.
The GitHub RPi example without the mask detection works fine. Could you check this on your system?
Sir I had no issues with ncnn installation on Linux. But while building the RPi example Im getting this error :-
-------------- Build: Debug in FaceRecognition (compiler: GNU GCC Compiler)---------------
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp -o obj/Debug/src/main.o
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TArcface.cpp -o obj/Debug/src/TArcface.o
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TBlur.cpp -o obj/Debug/src/TBlur.o
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TLive.cpp -o obj/Debug/src/TLive.o
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TMtCNN.cpp -o obj/Debug/src/TMtCNN.o
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TRetina.cpp -o obj/Debug/src/TRetina.o
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TWarp.cpp -o obj/Debug/src/TWarp.o
g++ -o bin/Debug/FaceRecognition obj/Debug/src/main.o obj/Debug/src/TArcface.o obj/Debug/src/TBlur.o obj/Debug/src/TLive.o obj/Debug/src/TMtCNN.o obj/Debug/src/TRetina.o obj/Debug/src/TWarp.o -fopenmp -I/usr/local/include/opencv4 -L/usr/local/lib -lopencv_gapi -lopencv_stitching -lopencv_aruco -lopencv_barcode -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_cudabgsegm -lopencv_cudafeatures2d -lopencv_cudaobjdetect -lopencv_cudastereo -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -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_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_cudacodec -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_videostab -lopencv_cudaoptflow -lopencv_optflow -lopencv_cudalegacy -lopencv_videoio -lopencv_cudawarping -lopencv_wechat_qrcode -lopencv_xfeatures2d -lopencv_shape -lopencv_ml -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_dnn -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_cudaimgproc -lopencv_cudafilters -lopencv_imgproc -lopencv_cudaarithm -lopencv_core -lopencv_cudev -ldl -lpthread /usr/local/lib/ncnn/libncnn.a
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TArcface.h:7,
from /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TArcface.cpp:1:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:863:9: error: ‘nn’ was not declared in this scope; did you mean ‘yn’?
863 | if (nn > 0)
| ^~
| yn
/usr/local/include/ncnn/mat.h:874:17: error: ‘_c’ was not declared in this scope; did you mean ‘c’?
874 | "w"(_c) // %4
| ^~
| c
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TMtCNN.h:8,
from /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TMtCNN.cpp:1:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:863:9: error: ‘nn’ was not declared in this scope; did you mean ‘ncnn’?
863 | if (nn > 0)
| ^~
| ncnn
/usr/local/include/ncnn/mat.h:874:17: error: ‘_c’ was not declared in this scope; did you mean ‘c’?
874 | "w"(_c) // %4
| ^~
| c
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TRetina.h:6,
from /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TRetina.cpp:14:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:863:9: error: ‘nn’ was not declared in this scope; did you mean ‘yn’?
863 | if (nn > 0)
| ^~
| yn
/usr/local/include/ncnn/mat.h:874:17: error: ‘_c’ was not declared in this scope; did you mean ‘c’?
874 | "w"(_c) // %4
| ^~
| c
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TRetina.h:6,
from include/TWarp.h:3,
from /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TWarp.cpp:1:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:863:9: error: ‘nn’ was not declared in this scope; did you mean ‘yn’?
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TLive.h:4,
from /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/TLive.cpp:2:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:863:9: error: ‘nn’ was not declared in this scope; did you mean ‘yn’?
863 | if (nn > 0)
| ^~
| yn
/usr/local/include/ncnn/mat.h:874:17: error: ‘_c’ was not declared in this scope; did you mean ‘c’?
874 | "w"(_c) // %4
| ^~
| c
863 | if (nn > 0)
| ^~
| yn
/usr/local/include/ncnn/mat.h:874:17: error: ‘_c’ was not declared in this scope; did you mean ‘c’?
874 | "w"(_c) // %4
| ^~
| c
Process terminated with status 1 (0 minute(s), 0 second(s))
Process terminated with status 1 (0 minute(s), 0 second(s))
Process terminated with status 1 (0 minute(s), 0 second(s))
Process terminated with status 1 (0 minute(s), 0 second(s))
Process terminated with status 1 (0 minute(s), 0 second(s))
In file included from /usr/local/include/ncnn/blob.h:18,
from /usr/local/include/ncnn/net.h:18,
from include/TMtCNN.h:8,
from /home/test/.face_recog/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:3:
/usr/local/include/ncnn/mat.h: In member function ‘void ncnn::Mat::fill(float)’:
/usr/local/include/ncnn/mat.h:863:9: error: ‘nn’ was not declared in this scope; did you mean ‘yn’?
863 | if (nn > 0)
| ^~
| yn
/usr/local/include/ncnn/mat.h:874:17: error: ‘_c’ was not declared in this scope; did you mean ‘c’?
874 | "w"(_c) // %4
| ^~
| c
Process terminated with status 1 (0 minute(s), 1 second(s))
12 error(s), 0 warning(s) (0 minute(s), 1 second(s))
Were you able to run this on your X86 / X86_64 linux machine ?
I've run the GitHub RPi example so I don't have to install Paddle. It is not very clear where this kind of error lies. This type is usually caused by two different headers and/or function calls being interchangeable. This originally has to do with the installation of different software packages. Hence the question how you installed ncnn. So just the two parameters and no toolchain.
Sir I tried freshly compiling it on another Desktop and Im getting error: ‘class cv::String’ has no member named ‘erase’
error.
-------------- Build: Debug in FaceRecognition (compiler: GNU GCC Compiler)---------------
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp -o obj/Debug/src/main.o
g++ -o bin/Debug/FaceRecognition obj/Debug/src/main.o obj/Debug/src/TArcface.o obj/Debug/src/TBlur.o obj/Debug/src/TLive.o obj/Debug/src/TMtCNN.o obj/Debug/src/TRetina.o obj/Debug/src/TWarp.o -fopenmp -I/usr/include/opencv4 -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core -ldl -lpthread /usr/local/lib/ncnn/libncnn.a
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp: In function ‘int main(int, char**)’:
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:214:27: error: ‘class cv::String’ has no member named ‘erase’
214 | Str = Str.erase(0,n+1);
| ^~~~~
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:215:27: error: ‘class cv::String’ has no member named ‘erase’
215 | Str = Str.erase(Str.length()-4, Str.length()-1); //remove .jpg
| ^~~~~
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:241:23: error: ‘class cv::String’ has no member named ‘erase’
241 | Str = Str.erase(0,n+1);
| ^~~~~
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:243:31: error: ‘class cv::String’ has no member named ‘erase’
243 | if(n>0) Str = Str.erase(n,Str.length()-1); //remove # some numbers.jpg
| ^~~~~
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:244:31: error: ‘class cv::String’ has no member named ‘erase’
244 | else Str = Str.erase(Str.length()-4, Str.length()-1); //remove .jpg
| ^~~~~
Process terminated with status 1 (0 minute(s), 2 second(s))
5 error(s), 0 warning(s) (0 minute(s), 2 second(s))
What happens when #include <opencv2/core/cvstd.hpp> is included at the top of the page? cv::String is in fact a std::string as declared in cvstd.hpp typedef std::string cv::String. If that doesn't help replace cv::String with std::string in this case.
Now Im getting this error :-
-------------- Build: Debug in FaceRecognition (compiler: GNU GCC Compiler)---------------
g++ -O3 -Wall -fexceptions -Wno-unknown-pragmas -g -I/usr/local/include/opencv4 -I/usr/local/include/ncnn -Iinclude -c /media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp -o obj/Debug/src/main.o
g++ -o bin/Debug/FaceRecognition obj/Debug/src/main.o obj/Debug/src/TArcface.o obj/Debug/src/TBlur.o obj/Debug/src/TLive.o obj/Debug/src/TMtCNN.o obj/Debug/src/TRetina.o obj/Debug/src/TWarp.o -fopenmp -I/usr/include/opencv4 -lopencv_stitching -lopencv_alphamat -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_intensity_transform -lopencv_line_descriptor -lopencv_mcc -lopencv_quality -lopencv_rapid -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_highgui -lopencv_datasets -lopencv_text -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_dnn -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core -ldl -lpthread /usr/local/lib/ncnn/libncnn.a
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp: In function ‘int main(int, char**)’:
/media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:228:24: error: invalid initialization of reference of type ‘std::vector<cv::String>&’ from expression of type ‘std::vector<std::__cxx11::basic_string<char> >’
228 | cv::glob(pattern_jpg, NameFaces);
| ^~~~~~~~~
In file included from /usr/local/include/opencv2/core.hpp:3284,
from /usr/local/include/opencv2/opencv.hpp:52,
from /media/ntfs/Users/e3e4/Face-Recognition-Raspberry-Pi-64-bits/src/main.cpp:3:
/usr/local/include/opencv2/core/utility.hpp:178:59: note: in passing argument 2 of ‘void cv::glob(cv::String, std::vector<cv::String>&, bool)’
178 | CV_EXPORTS void glob(String pattern, std::vector<String>& result, bool recursive = false);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~
Process terminated with status 1 (0 minute(s), 1 second(s))
1 error(s), 0 warning(s) (0 minute(s), 1 second(s))
If this is working on your Desktop/Laptop , then I think it could be an issue with faulty opencv installation on my system.
Indeed. That's one of the reasons I don't like to post x86_64Linux repos. Too often, too easily, you get differences that cause problems. And these are very difficult to tackle simply because you are not sure how the person on the other end has their machine set up
SIr, Can you pls share your version of opencv, cuda, cudnn, ncnn of desktop ? Ill try with those version to build again. Also are you using c++ 17 or 14 ?
Dear @rsingh2083,
You always need OpenCV for image and file handling. It is simply the best choice here.
If you use Cuda and cuDNN depends on your framework. ncnn doesn't support Cuda. MNN, TensorFlow, Pytorch does. Keep in mind that Cuda and cuDNN makes a (huge) difference when deploying large deep learning models. The larger the number of floats, the more profitable Cuda is. On the other hand, with the (very) small DNN's we have with face recognition, there is not much to gain. Your interference time can even drop when using Cuda. (You have to transfer lost data between CPU and GPU before starting calculating. These transfers take more time than you gain with the Cuda acceleration). ncnn uses the GPU in a clever way by using the Vulkan video acceleration.
All the DNN on GitHub are selected for small edge devices. No neural sticks or internet connection is needed. Please note also that most TensorFlow lite models are quantized, as is the case in the face recognition app. In other words, they work with (small) integers. Using Cuda kills the speed in this case.
Desktops are per definition faster than a Jetson Nano or RPi. Even without Cuda.
The difference between C14 and C17 is minor.
Hi Sir,
Is it possible to install this on normal linux desktop ? Since both paddle and ncnn can be installed on desktop also, hence I suppose it might work on desktop also , right ?