Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile with cmake #12

Open
camillalc opened this issue Mar 17, 2022 · 7 comments
Open

Compile with cmake #12

camillalc opened this issue Mar 17, 2022 · 7 comments

Comments

@camillalc
Copy link

Hello,

Nice!! Thanks for sharing the source code.

You provided in #10 one example of how to compile with g++, but how can i create a CMakeLists.txt to compile using cmake?

Rgrds,
Camilla

@Qengineering
Copy link
Owner

Qengineering commented Mar 20, 2022

To use CMake.
Assuming your in the 'main' directory.

.
├── bin
├── CMakeLists.txt
├── FaceRecognition.cbp
├── FaceRecognition.depend
├── FaceRecognition.layout
├── Graham Norton.jpg
├── img
├── include
├── LICENSE
├── models
├── Norton_2.mp4
├── Norton_A.mp4
├── obj
├── README.md
└── src

Create a build folder

$ mkdir build
$ cd build

Run CMake and Make

$ cmake ..
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "4.5.1") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/software/Face-Recognition-Raspberry-Pi-64-bits/build

$  make  -j4
Scanning dependencies of target FaceRecognition
[ 37%] Building CXX object CMakeFiles/FaceRecognition.dir/src/TMtCNN.cpp.o
[ 37%] Building CXX object CMakeFiles/FaceRecognition.dir/src/main.cpp.o
[ 37%] Building CXX object CMakeFiles/FaceRecognition.dir/src/TBlur.cpp.o
[ 50%] Building CXX object CMakeFiles/FaceRecognition.dir/src/TLive.cpp.o
[ 62%] Building CXX object CMakeFiles/FaceRecognition.dir/src/TRetina.cpp.o
[ 75%] Building CXX object CMakeFiles/FaceRecognition.dir/src/TWarp.cpp.o
[ 87%] Building CXX object CMakeFiles/FaceRecognition.dir/src/TArcface.cpp.o
[100%] Linking CXX executable ../FaceRecognition
[100%] Built target FaceRecognition

Find the executable in the 'main' folder (because of the other directories models and img).

$ cd ..
$ tree -L 1
.
├── bin
├── build
├── CMakeLists.txt
├── FaceRecognition
├── FaceRecognition.cbp
├── FaceRecognition.depend
├── FaceRecognition.layout
├── Graham Norton.jpg
├── img
├── include
├── LICENSE
├── models
├── Norton_2.mp4
├── Norton_A.mp4
├── obj
├── README.md
└── src

Run

$ ./FaceRecognition

Once FaceRecognition works, you may remove the build directory, since we don't need it any more.

$ sudo rm -rf build

@camillalc
Copy link
Author

Thank you!!

@roksage
Copy link

roksage commented Mar 29, 2022

Hello still can't find solution i followed these steps and stil strugle to run script. After running cmake .. as in example i tried to run make -j4 but nothing happens. Maybe im doing this step in wrong folder (tried running make -j4 everywhere i could)? Or make -j4 needs attributes?

I used fresh SD-image 64bit

Thank you for helping me. Want to run face recognition doors so much.

image

@Qengineering
Copy link
Owner

Look in the parent folder, not the build folder as it holds only temporarily files.
You make gives on errors so it succeeded.
So, from your location ..../build $ cd .. and you find FaceRecognition.

$ cd ..
$ tree -L 1
.
├── bin
├── build
├── CMakeLists.txt
├── FaceRecognition
├── FaceRecognition.cbp
├── FaceRecognition.depend
├── FaceRecognition.layout
├── Graham Norton.jpg
├── img
├── include
├── LICENSE
├── models
├── Norton_2.mp4
├── Norton_A.mp4
├── obj
├── README.md
└── src

@roksage
Copy link

roksage commented Mar 29, 2022

Once again i did fresh install. After fresh install i used commands "sudo apt update" ; "sudo apt install tightvncserver"

And then followed steps but still cant see the FaceRecognition file. Because make -j4 did nothing :/.

Maybe "sudo apt update" ruins everything?

Using 2gb raspb 4 version

Upade: tried once again on fresh install without "sudo apt update", no progress

image

@Qengineering
Copy link
Owner

For your convenience I've posted a video on Gdrive on how to install and compile the software.
I've used the Bullseye 64-bits OS in the video. The procedure is identical on a Buster 64-bit OS.

@roksage
Copy link

roksage commented Mar 30, 2022

Eh... Thank you a lot. I was using Face-Recognition pre-downloaded in SD-image. CMakeLists.txt wasn't there and I just created an empty file :)... named CMakeLists.txt. I thought what was way to go. Thank you a lot once again.

@Qengineering Qengineering reopened this Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants