Cov txheej txheem:

Lub ntsej muag lees paub thiab cim npe - Arduino Face ID Siv OpenCV Python thiab Arduino.: 6 Kauj Ruam
Lub ntsej muag lees paub thiab cim npe - Arduino Face ID Siv OpenCV Python thiab Arduino.: 6 Kauj Ruam

Video: Lub ntsej muag lees paub thiab cim npe - Arduino Face ID Siv OpenCV Python thiab Arduino.: 6 Kauj Ruam

Video: Lub ntsej muag lees paub thiab cim npe - Arduino Face ID Siv OpenCV Python thiab Arduino.: 6 Kauj Ruam
Video: Tswv Yexus lub neej thaum pib txug thaum xaus 2024, Kaum ib hlis
Anonim
Image
Image

Kev lees paub lub ntsej muag AKA ntsej muag ID yog ib qho tseem ceeb tshaj plaws ntawm cov xov tooj ntawm tes niaj hnub no.

Yog li, kuv muaj lus nug "kuv puas tuaj yeem muaj lub ntsej muag id rau kuv qhov Arduino project" thiab cov lus teb yog yog …

Kuv cov lus pib raws li hauv qab no:

Kauj ruam 1: Nkag mus rau lub vev xaib

kauj ruam 2: Kev paub lub ntsej muag.

kauj ruam 3: Kev khaws cov ntaub ntawv

Kauj ruam 4: Kev cob qhia

kauj ruam 5: Lub ntsej muag paub

kauj ruam 6: Programming Arduino

Kuv yuav piav qhia txhua qib hauv qab no. Kuv vam tias qhov no yuav pab koj.

Kauj ruam 1: Nkag mus rau Webcam

Nkag mus rau Webcam
Nkag mus rau Webcam

Thawj kauj ruam rau kev lees paub lub ntsej muag yog kom nkag tau mus rau lub koob yees duab lossis khoos phis tawj pom kev. Txij li Is Nrias teb raug kaw qhov kev daws teeb meem uas pheej yig tshaj uas kuv pom yog siv kuv lub khoos phis tawj webcam uas kuv tau nkag mus nrog qhov program nab nab siv openCV module.

Koj yuav xav tias OpenCV yog dab tsi, puas yog?

OpenCV (Open Source Computer Vision Library) yog lub khoos phis tawj qhib lub zeem muag thiab tshuab kawm paub software lub tsev qiv ntawv. OpenCV tau tsim los muab cov txheej txheem ib txwm muaj rau kev siv lub khoos phis tawj lub zeem muag thiab ua kom nrawm dua kev siv lub tshuab kev nkag siab hauv cov khoom lag luam.

Yog tias Opencv tau teeb tsa hauv koj lub khoos phis tawj, koj zoo mus. Yog tsis yog ces ua raws cov kauj ruam no.

qhib qhov hais kom sai thiab ntaus "pip install opencv".

Ceeb Toom: Koj tuaj yeem tau txais qhov yuam kev vim "'pip' tsis raug lees paub tias yog lus txib sab hauv lossis sab nraud". uas koj yuav tsum tau ntxiv txoj hauv kev ntawm koj qhov kev teeb tsa pip rau koj PATH system sib txawv. Mus los ntawm kab ntawv no nws yuav pab tau koj.

stackoverflow.com/questions/23708898/pip-i…

Thaum OpenCV raug teeb tsa peb zoo mus… Txheeb xyuas yog tias nws tau teeb tsa raug qhib qhib koj tus neeg txhais lus Python thiab ntshuam lub tsev qiv ntawv. Saib daim duab saum toj no uas yuav tsum yog koj qhov tso tawm.

Rub tawm cov ntaub ntawv sej "AccessTo_webcam.py" thiab khiav nws. Kuv tau muab txhua cov lus pom tsim nyog nyob ntawd.

Koj mus, Tam sim no koj tau nkag mus rau lub vev xaib. Ua tau zoo cia peb mus rau kauj ruam 2.

Kauj Ruam 2: Kev Qhia Txog Lub Ntsej Muag

Kev Qhia Txog Lub Ntsej Muag
Kev Qhia Txog Lub Ntsej Muag

nrog kev pab ntawm tib yam OpenCV module, peb yuav tsum txheeb xyuas seb puas muaj lub ntsej muag ntawm cov vis dis aus lossis tsis yog.

OpenCV muab txoj hauv kev qhia lossis ua qauv ua ntej hu ua Cascade Classifier. Cov qauv kawm ua ntej tau nyob hauv cov ntaub ntawv tais ceev tseg hauv OpenCV kev teeb tsa. Kuv tab tom muab cov ntawv ntawd tsuas yog rub nws thiab muab tso rau hauv koj li phiaj xwm phiaj xwm. Lub nplaub tshev uas khaws cov ntaub ntawv "AccessTo_webcam.py". Yog tias koj tsis tau tsim ib qho ces ua nws.

Rub tawm "haarcascade_frontalface_default" thiab muab tso rau hauv daim phiaj xwm phiaj xwm tseem ceeb.

Rub tawm "Face_identification.py" thiab muab tso rau hauv daim phiaj xwm tseem ceeb. Txhua qhov kev piav qhia tau muab hauv nws.

Tam sim no koj tuaj yeem txheeb xyuas lub ntsej muag hauv cov vis dis aus. Yog li cia peb mus rau theem 3.

Kauj Ruam 3: Kev Sau Cov Ntaub Ntawv

Kev Sau Cov Ntaub Ntawv
Kev Sau Cov Ntaub Ntawv

Txhawm rau paub lub ntsej muag peb yuav tsum tau qhia peb qhov kev pab cuam nab nab. Rau qhov peb xav tau qee cov ntaub ntawv.

Kev khaws cov ntaub ntawv yog qhov yooj yim tshaj plaws hauv txoj haujlwm no. tsim daim nplaub tshev hu ua "image_data" hauv koj lub phiaj xwm phiaj xwm tseem ceeb. Sab hauv "duab_data" nplaub tshev tsim qee cov ntawv ntxiv nrog tus neeg lub npe, qhov uas peb yuav khaws cov ntaub ntawv. piv txwv:

Hauv daim ntawv "image_data" Kuv tau tsim ob daim nplaub tshev ntxiv hu ua "HRK" thiab "Yahiya". raws li qhia hauv daim duab saum toj no.

Tam sim no mus tom ntej tsim koj tus kheej cov ntawv thiab npe lawv.

Thaum cov ntawv tais ceev tseg raug tsim ces pib sau cov duab ntawm tus neeg tshwj xeeb ntawd. Kuv pom zoo khaws ze li 20 daim duab rau ib tus neeg. Koj tseem tuaj yeem ntxiv cov duab ntxiv tab sis saib rau nws cov ntaub ntawv khaws tseg rau txhua tus neeg muaj tib tus lej ntawm cov duab. Nws pab muab qhov tseeb.

yog tam sim no cia peb txav mus rau theem 4.

Kauj ruam 4: Kev cob qhia

Hauv qhov luv luv, peb yuav hla txhua daim nplaub tshev thiab cov duab uas muaj nyob hauv "image_data" nplaub tshev thiab tsim cov ntawv txhais uas yuav muaj daim ntawv lo ID thiab lub npe sib xws. Ib txhij peb yuav thauj cov duab kom pom lub ntsej muag hauv txhua qhov thiab txhua daim duab uas peb hu nws "Cheeb Tsam Txaus Siab" thiab tsim ".yml" cov ntaub ntawv uas muaj cov ntaub ntawv ntawd.

Piv txwv tias koj tau khaws cov ntaub ntawv rau tus neeg X thiab Y.

peb yuav sau tus neeg X li 1 uas yuav yog nws daim ID ID thiab lub npe yuav yog X tus kheej. Peb thauj cov duab kom pom nws lub ntsej muag piv txwv li Cheeb Tsam ntawm kev txaus siab thiab ntxiv cov ntaub ntawv rau hauv cov npe.

cov kauj ruam zoo sib xws yuav ua raws rau tus neeg Y. Thiab thaum kawg, peb yuav tsim cov ntawv ".yml".

Rub tawm "face_trainer.py" cov ntaub ntawv thiab muab tso rau hauv cov phiaj xwm phiaj xwm tseem ceeb. Txhua qhov kev piav qhia tsim nyog tau muab hauv cov ntawv ntawd.

Thaum koj ua qhov haujlwm no nws yuav hla txhua daim duab thiab tsim ob daim ntawv hu ua "labels.pickle" thiab "trainner.yml". Tam sim no koj tau kawm koj tus kheej cov qauv. yog li cia peb mus rau kauj ruam 5.

Kauj Ruam 5: Kev Pom Lub ntsej muag

Lub ntsej muag lees paub
Lub ntsej muag lees paub

Yog tias koj tau dhau los ntawm txhua qib kom raug ces koj yuav tau tsim koj tus kheej cov ntaub ntawv kawm. Tam sim no peb yuav siv cov ntaub ntawv ntawd rau lub ntsej muag paub.

Yeej peb yuav thauj peb cov qauv kev kawm rau hauv cov ntaub ntawv nab nab, Nkag mus rau peb lub vev xaib, thiab txheeb xyuas Cov ntsej muag hauv cov vis dis aus thiab ua qhov sib piv lossis kwv yees ntawm lub ntsej muag tam sim no uas tau txheeb xyuas hauv cov vis dis aus, thiab tus qauv uas tau kawm. yog tias cov ntaub ntawv sib phim ces peb hais tias tus neeg tau lees paub nws tsuas yog qhov yooj yim …

Rub tawm "face_recognise.py" thiab khiav nws. Txhua yam ntaub ntawv tsim nyog tau muab hauv nws. Tam sim no koj lub ntsej muag yuav tau lees paub. yog tias qhov tseeb tsis zoo ces sim hloov kho cov ntaub ntawv. yog tias koj txhua tus zoo mus ces cia mus txuas ntxiv mus rau qib 6/

Kauj Ruam 6: Programming Arduino

Kawg thiab kawg yog txheej txheem Arduino, Thiab muab hom kev sib txuas lus ntawm nab hab sej Arduino. Txog kev sib txuas lus, Kuv siv "Kev Sib Txuas Lus". Mus los ntawm cov vis dis aus uas kuv tau txuas saum toj no txhawm rau nrhiav kev sib txuas lus li cas ua haujlwm thiab tsim kom tau ib qho. Koj yuav pom txhua cov ntaub ntawv xav tau hauv cov lus piav qhia video.

Yog tias koj tau hla dhau daim vis dis aus ces cia kuv piav qhia rau koj tias kuv tau ua dab tsi. Thaum kuv lub ntsej muag raug lees paub ces daim ntawv lo ID muab yog 2. Thaum daim ID ID yog 2 Kuv yuav xa '1' raws li cov ntaub ntawv txuas mus rau kuv Arduino. Uas yuav tig rau kuv LED chaser Circuit. Yog tias daim npav ID tsis yog lwm qhov 2 ces kuv yuav xa '0' raws li cov ntaub ntawv xov xwm, uas yuav tua kuv LED chaser Circuit.

Rub cov ntawv "ard_chaser.ino". Nws yog qhov yooj yim LED chaser program uas siv kev sib txuas lus txuas.

Simillerly rub tawm "face_recogniser1.py" uas yuav tsim kom muaj kev sib txuas lus ntawm Arduino thiab program nab.

Koj mus. Kuv vam tias koj tau kawm qee yam tshiab. Sau npe yuav ua rau kuv tus youtube channel rau ntau yam khoom ntsig txog sej thiab Arduino. Qhia tawm qhov no yog tias koj nyiam nws. Txhawb nqa ntxiv.

Ua tsaug.

Pom zoo: