Giter VIP home page Giter VIP logo

tutorial_deteksi_wajah_pc_raspberry's Introduction

Face Detection

Cara mudah membuat pendeteksi wajah (tanpa fitur anti spoofing)
Demo File

How To Install

Saya menggunakan RaspberryPi3 untuk instalasi menggunakan cara dibawah ini :

sudo apt install cmake build-essential pkg-config git
sudo apt install python3-opencv
sudo apt-get install raspberrypi-ui-mods
sudo apt install ffmpeg python3-opencv
sudo apt install libxcb-shm0 libcdio-paranoia-dev libsdl2-2.0-0 libxv1  libtheora0 libva-drm2 libva-x11-2 libvdpau1 libharfbuzz0b libbluray2 libatlas-base-dev libhdf5-103 libgtk-3-0 libdc1394-22 libopenexr23
sudo apt install python3-dev python3-pip python3-numpy

Didalam praktek ini menggunakan python versi 3.7.3
Selanjutnya install paket library python seperti dibawah ini :
pip3 install -r requirements.txt

Untuk instalasi opencv-contrib-python akan memakan waktu lebih lama, jadi ketika instalasi biarkan beberapa jam, mungkin berbeda pada versi raspbery4 keatas.
Jika masih terjadi kendala, dimungkinkan ada kendala library yang kurang, dibawah ini :

Library yang harus di install di raspberry PI seperti dibawah ini :

sudo apt install cmake build-essential pkg-config git
sudo apt install libjpeg-dev libtiff-dev libjasper-dev libpng-dev libwebp-dev libopenexr-dev
sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev libdc1394-22-dev libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
sudo apt install libgtk-3-dev libqtgui4 libqtwebkit4 libqt4-test python3-pyqt5
sudo apt install libatlas-base-dev liblapacke-dev gfortran
sudo apt install libhdf5-dev libhdf5-103
sudo apt install python3-dev python3-pip python3-numpy

ATTENTION!!!

Jika instalasi paket ada yang gagal atau paket repository tidak lengkap atau tidak mendukung seperti libgtk,libtif dll gunakan cara kedua :


HOW TO INSTALL OPENCV

Jika menginstall opencv lewat script silahkan ikuti tahapan dibawah ini :

sudo nano /etc/dphys-swapfile
Ubah CONF_SWAPSIZE=100 menjadi CONF_SWAPSIZE=2048
Restart swabfile sudo systemctl restart dphys-swapfile

Cloning source code opencv
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \
-D ENABLE_NEON=ON \
-D ENABLE_VFPV3=ON \
-D BUILD_TESTS=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D OPENCV_ENABLE_NONFREE=ON \
-D CMAKE_SHARED_LINKER_FLAGS=-latomic \
-D BUILD_EXAMPLES=OFF ..

make -j$(nproc) (proses ini memakan waktu 1 jam lebih )
sudo make install
sudo ldconfig

Setelah proses diatas selesai kembalikan swabfile seperti semula :
sudo nano /etc/dphys-swapfile (ubah 2048 menjadi 100) nilai dari CONF_SWAPSIZE

Restart SwabFile service
sudo systemctl restart dphys-swapfile

Jika tahap-tahap diatas sudah selesai, selanjutnya silahkan install library face-recognitionnya :

pip install face-recognition
pip install imutils

Jika ada permasalahan instalasi dlib lewat PIP, alternatif lainnya install lewat source code seperti langkah-langkah di bawah ini :

HOW TO INSTALL DLIB (USING GPU)

Cara dibawah ini di instruksikan agar DLIB menggunakan GPU, jika tidak ada GPU dan hanya menggunakan CPU gunakan cara instalasi biasa

git clone https://github.com/davisking/dlib.git
cd dlib
mkdir build
cd build
cmake .. -DDLIB_USE_CUDA=1 -DUSE_AVX_INSTRUCTIONS=1
cmake --build .
cd ..
python setup.py install --set USE_AVX_INSTRUCTIONS=1 --set DLIB_USE_CUDA=1 --no DLIB_GIF_SUPPORT 

Mulai cloning programnya disini : git clone https://github.com/fajarlabs/absensi_wajah.git
Jalankan file python test_camera_basic.py untuk memeriksa apakah sudah bisa dijalankan OPENCVnya.

How to capture model photo

Jika sudah ok selanjutnya silahkan buat folder nama didalam folder "DATASET", didalam folder nama tersebut akan di isi foto wajah untuk ditraining.
dataset-1
Untuk melakukan pengisian dataset foto silahkan edit skrip ambil_foto_wajah.py di line 3 sesuaikan dengan lokasi nama folder foto didalam folder "DATASET".
sesi-ambil-foto
Jalankan python ambil_foto_wajah.py untuk melakukan sesi pengambilkan dan tekan SPACE untuk capture dan tekan ESC untuk keluar program.

How to train

Selanjutnya jika DATASET foto sudah OK selanjutnya melakukan training model dengan menjalankan skrip python train_model.py dan menghasilkan file "encodings.pickel"

How to detection

Selanjutkan untuk menjalankan deteksi wajah silahkan jalankan skrip

python deteksi_wajah.py

Capture

Literature

https://yunusmuhammad007.medium.com/2-raspberry-pi-install-opencv-pada-python-3-7-menggunakan-pip3-a2504dffd984
https://programmersought.com/article/57453207651/
https://www.tomshardware.com/how-to/raspberry-pi-facial-recognition

tutorial_deteksi_wajah_pc_raspberry's People

Contributors

fajarlabs avatar

Watchers

 avatar

Forkers

ezeegg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.