Cov txheej txheem:

Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2: 16 Cov Kauj Ruam (nrog Duab)
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2: 16 Cov Kauj Ruam (nrog Duab)

Video: Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2: 16 Cov Kauj Ruam (nrog Duab)

Video: Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2: 16 Cov Kauj Ruam (nrog Duab)
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2
Puas Yog Tes? (Raspberry Pi Lub Koob Yees Duab + Neural Network) Ntu 1/2

Ob peb hnub dhau los, Kuv raug mob kuv sab tes xis ntawm lub gym. Tom qab txhua txhua lub sijhawm kuv siv kuv lub computer nas, nws ua rau mob heev vim yog lub dab teg ntxaum.

Qhov ntawd yog thaum nws tsoo kuv "yuav tsis zoo yog tias peb tuaj yeem hloov kho ib puag ncig mus rau hauv lub trackpad" thiab kuv tsis paub yog vim li cas tab sis vim li cas kuv thiaj xav txog nws, zaj yeeb yaj kiab HER, Kuv yuav qhia rau koj paub nws tawm. Nws yog qhov kev xav zoo siab tab sis kuv tsis paub yog tias kuv tuaj yeem ua nws, Kuv txiav txim siab muab nws sim.

Kab lus no hais txog dab tsi los ntawm nws.

Ua ntej peb pib kuv muaj qhov tsis lees paub-

'Qhov kawg ntawm tsab xov xwm no, Kuv tsis tuaj yeem hloov ib qho chaw mus rau hauv trackpad tab sis kuv tsis tau kawm ntau thiab ntxiv cov cuab yeej loj rau kuv cov khoom siv. Kuv vam tias yuav tshwm sim rau koj ib yam nkaus '

Cia peb pib.

Kauj ruam 1: Yees duab

Image
Image

Nov yog qhov me me 5 min vis dis aus npog txhua kauj ruam. Ua tib zoo saib.

Kauj ruam 2: Kho vajtse

Kho vajtse
Kho vajtse

Kuv teeb tsa raspberry pi nrog rau raspberry pi lub koob yees duab ntawm qhov siab txog 45 cm. Qhov no muab rau peb saib xyuas thaj tsam li 25x25 cm hauv qab lub koob yees duab.

Raspberry pi thiab raspberry pi lub koob yees duab tau yooj yim, tsuas yog google nws thiab koj yuav tsum muaj peev xwm nrhiav tau lub khw hauv ib cheeb tsam.

Ua tibzoo saib ntawm Qhov Txuas lossis ib qho ntawm kuv Raspberry pi playlist kom tau txais koj lub taub hau pi nce thiab khiav.

Ua raws li kev teeb tsa no, peb xav tau ib qho ntawm cov cai uas txiav txim siab yog tias muaj tes nyob hauv thaj chaw uas lub koob yees duab tau saib xyuas thiab yog li yog nws nyob qhov twg.

Kauj Ruam 3: Daim Cai

Daim Cai
Daim Cai
Daim Cai
Daim Cai

Daim lej uas tso cai rau peb txiav txim siab yog tias muaj tes nyob hauv thaj tsam ntawm kev txaus siab siv qee yam hu ua Neural Network. Lawv poob qis hauv qeb ntawm qhov kev zov me nyuam qhov uas peb tsis txhais cov cai los txiav txim siab tab sis peb qhia cov ntaub ntawv neural network txaus cov ntaub ntawv uas nws suav tawm cov cai ntawm nws tus kheej.

Hauv peb qhov xwm txheej, hloov pauv ntawm txhais tes zoo li cas peb qhia cov duab neural network raug ntes los ntawm raspberry pi uas muaj tes thiab uas tsis muaj tes. Cov theem no hu ua kev cob qhia ntawm neural network thiab cov duab siv tau hu ua cov ntaub ntawv qhia paub.

Kauj Ruam 4: Tau Duab

Tau Duab
Tau Duab

Kuv tau nkag mus rau hauv kuv tus raspberry pi thiab ntes cov duab siv cov lus txib hauv qab no.

sudo raspistill -w 640 -h 480 -rot 90 -t 250000 -t1 5000 -o thav duab%04d.jpg

Kuv ntes 80 cov duab nrog tes thiab 80 cov duab uas tsis muaj tes. 160 cov duab tsis txaus los qhia lub neural network kom raug tab sis yuav tsum txaus rau pov thawj ntawm lub tswv yim.

Dhau li ntawm 160 cov duab, Kuv tau ntes 20 cov duab ntxiv los sim peb lub network thaum nws tau kawm tiav.

Thaum cov ntaub ntawv tau npaj tiav Kuv pib sau cov cai rau neural network.

Kauj Ruam 5: Cov Cuab Yeej thiab Lus Siv

Cov Cuab Yeej thiab Cov Lus Siv
Cov Cuab Yeej thiab Cov Lus Siv
Cov Cuab Yeej thiab Cov Lus Siv
Cov Cuab Yeej thiab Cov Lus Siv

Kuv tau sau kuv li neural network hauv sej qhov chaw kawm sib sib zog nqus hu ua Keras thiab cov lej tau sau rau ntawm jupyter phau ntawv los ntawm anaconda navigator.

Kauj Ruam 6: Npaj Cov Ntaub Ntawv rau Kev Qhia

Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia
Npaj Cov Ntaub Ntawv rau Kev Qhia

Ua ntej (Duab #1) Kuv suav nrog txhua lub tsev qiv ntawv xav tau rau txoj haujlwm no, uas suav nrog PIL, matplotlib, lej, os thiab Keras. Hauv xov tooj ntawm tes thib ob ntawm nab nab (Duab #2) Kuv txhais txoj hauv kev rau cov ntaub ntawv thiab luam tawm cov qauv suav. Tam sim no peb yuav tsum thauj tag nrho cov duab rau hauv cov lej tsis sib xws, yog li ntawm peb lub xov tooj (Duab #2) Kuv tau tsim cov lej tsis sib xws ntawm 82 (tus lej ntawm cov qauv ntawm tes) +75 (tus naj npawb ntawm cov uas tsis yog tes) piv txwv li 157x100x100x3. 157 yog tus lej tag nrho ntawm cov duab uas kuv muaj, 100x100 yog peb cov duab hloov pauv qhov ntev thiab 3 yog rau txheej xim liab, ntsuab thiab xiav hauv cov duab.

Hauv cell thib plaub thiab thib tsib, peb thauj cov duab uas muaj tes ua raws cov duab uas tsis muaj tes nyob hauv cov lej zauv. Hauv cell thib rau, peb faib txhua tus nqi los ntawm 255 li no txwv tus nqi ntau ntawm 0 txog 1. (Duab #3)

Kuv thov txim yog tias cov duab txuas tsis zoo txaus. Nov yog qhov txuas rau GITHUB chaw cia khoom rau koj los saib cov cai. Tsis txhob hnov qab hloov cov npe kab npe nrog koj txoj hauv kev:).

Tsiv nrog.

Tom ntej no peb xav tau daim ntawv lo rau txhua daim duab, yog li, peb tsim ib qho lej numpy array ntawm 157 hauv qhov ntev. Thawj 82 nkag tau teeb tsa rau 1 thiab seem 75 nkag tau teeb tsa rau 0 xa cov neural network uas thawj 82 cov duab yog los ntawm ib chav kawm thiab seem yog los ntawm lwm qhov. (Duab #4)

Tam sim no cia peb tsim neural network.

Kauj Ruam 7: Neural Network

Neural Network
Neural Network
Neural Network
Neural Network

Hauv cuaj ntawm tes, peb txhais peb cov neural network. Nws muaj peb qhov rov ua dua ntawm txheej txheej txheej txheej tom qab los ntawm maxpool txheej nrog 8, 12 thiab 16 qhov kev hloov pauv hloov ua ntu zus. Ua raws li qhov ntawd peb muaj ob qhov tuab tuab neural nets. Muab ob daim duab rau theem no. Thawj yog snap ntawm cov cai uas tsim kom muaj neural network thiab thib ob yog cov duab sawv cev ntawm neural network nrog qhov tso tawm qhov ntev thiab cov haujlwm tau piav qhia.

Kauj Ruam 8: Kev cob qhia Neural Network

Kev cob qhia Neural Network
Kev cob qhia Neural Network

Hauv kaum lub xov tooj, peb teeb tsa neural network optimizer rau 'adam' thiab poob kev ua haujlwm rau 'binary_crossentropy'. Lawv ua lub luag haujlwm tseem ceeb hauv kev hloov kho qhov hnyav ntawm lub network. Thaum kawg thaum peb ua haujlwm thib kaum ntawm tes, neural network pib qhia. Thaum lub network tab tom kawm saib xyuas qhov ua haujlwm poob thiab nco ntsoov tias nws tau txo qis.

Kauj Ruam 9: Kuaj Neural Network

Xeem Neural Network
Xeem Neural Network

Thaum kawm txog neural network, peb yuav tsum npaj cov ntaub ntawv xeem. Peb rov ua cov txheej txheem tiav los npaj kev teeb tsa kev qhia hauv qib 3, 4, 5 thiab 6 ntawm kev ntsuas cov ntaub ntawv los tsim cov ntawv xeem. Peb kuj tseem npaj daim ntawv lo rau kev teeb tsa tab sis lub sijhawm no peb ua qauv ntawm cov ntaub ntawv teeb tsa no kom tau txais kev kwv yees thiab tsis mus qhia.

Kauj ruam 10: Qhov tshwm sim thiab Tshooj Tom ntej…

Tshwm sim thiab Tshooj Tom ntej…
Tshwm sim thiab Tshooj Tom ntej…

Kuv tau txais qhov ntsuas qhov tseeb ntawm 88% tab sis coj qhov no nrog cov ntsev ntsev raws li cov ntaub ntawv siv los qhia thiab sim cov qauv no me me heev thiab tsis txaus los qhia qhov qauv no.

Xijpeem kuv vam tias koj nyiam kab lus no. Kuv lub hom phiaj tom qab qhov kev tawm dag zog no tseem tsis tau tiav thiab saib xyuas rau ntu 2. Kuv yuav upload nws sai li sai tau.

Hauv ntu tom ntej, peb yuav cob qhia lwm lub paj hlwb uas yuav qhia peb txog qhov chaw nyob ntawm tes hauv txhais tes pom cov duab.

Txhua qhov lus nug raug txais tos.

Yog tias ib tus xav siv kuv cov ntaub ntawv me me qhia rau kuv paub hauv cov lus. Kuv yuav ua kom nws muaj.

Ua tsaug rau kev nyeem ntawv. Kuv yuav pom koj sai sai nrog ntu thib ob txog thaum ntawd vim li cas koj thiaj tsis tsim thiab cob qhia lub paj hlwb.

Kho kom raug:- Cov kauj ruam tom ntej yog rau ntu thib ob.

Kauj Ruam 11: Kev Tshawb Fawb Hom Phiaj

Kev Tshawb Nrhiav Yam Khoom
Kev Tshawb Nrhiav Yam Khoom

Hauv cov kauj ruam dhau los peb tsim NN uas qhia peb seb cov duab ntsuas puas muaj tes lossis tsis. Zoo dab tsi ntxiv? Yog NN cais cov duab raws li muaj tes peb xav paub qhov chaw ntawm txhais tes. Qhov no yog hu ua kev txheeb xyuas qhov pom hauv cov ntaub ntawv khoos phis tawj. Yog li cia peb qhia NN uas ua tau zoo ib yam.

Kauj ruam 12: Yees duab

Image
Image

Ib daim vis dis aus 3 feeb piav qhia txhua kauj ruam ntxiv. Ua tib zoo saib.

Kauj Ruam 13: Daim ntawv lo

Daim ntawv lo
Daim ntawv lo
Daim ntawv lo
Daim ntawv lo
Daim ntawv lo
Daim ntawv lo

Yog tias koj xav tau lub neural network kom tso tawm qhov chaw ntawm txhais tes, peb yuav tsum tau qhia nws hauv kev zam xws li tsis zoo li yav dhau los neural network uas txhua daim duab tau sau tias yog ob txhais tes thiab tsis muaj tes. Lub sijhawm no txhua daim duab nrog txhais tes yuav muaj plaub daim ntawv lo sib thooj rau kab sib chaws ntawm lub npov uas nyob ib ncig ntawm txhais tes hauv daim duab ntawd.

Cov duab txuas ntawm csv cov ntawv muaj daim ntawv lo rau txhua daim duab. Thov nco ntsoov tias kev tswj hwm tau ua haujlwm zoo ib yam nrog rau cov duab piv txwv li yog tias sab saud X ua haujlwm yog ntawm 320th pixel hauv cov duab nrog dav ntawm 640 pixels, peb yuav sau nws li 0.5.

Kauj Ruam 14: Sau GUI

Labeling GUI
Labeling GUI
Labeling GUI
Labeling GUI
Labeling GUI
Labeling GUI
Labeling GUI
Labeling GUI

Tej zaum koj yuav xav tsis thoob tias kuv tswj hwm daim ntawv teev npe tag nrho 82 cov duab, zoo li kuv tau sau GUI hauv nab hab sej uas tau pab kuv ua txoj haujlwm no. Thaum cov duab rub tawm hauv GUI. Kuv sab laug nyem ntawm kev sib koom sab saud thiab nyem sab xis ntawm kev sib koom tes qis dua ntawm lub thawv uas muaj peev xwm nyob ib puag ncig ntawm txhais tes. Cov kev sib koom tes no yog tom qab ntawv sau rau hauv cov ntawv hauv qab no uas kuv nyem lub pob tom ntej txhawm rau thauj cov duab tom ntej. Kuv rov ua cov txheej txheem no rau tag nrho 82 lub tsheb ciav hlau thiab 4 cov duab xeem. Thaum cov ntawv tau npaj tiav, nws yog lub sijhawm kawm.

Kauj Ruam 15: Cov Tsev Qiv Ntawv Xav Tau

Tsev qiv ntawv xav tau
Tsev qiv ntawv xav tau
Tsev qiv ntawv xav tau
Tsev qiv ntawv xav tau
Tsev qiv ntawv xav tau
Tsev qiv ntawv xav tau

Ua ntej peb yuav tsum thauj khoom txhua lub tsev qiv ntawv tsim nyog. Uas suav nrog

  • PIL rau kev tswj cov duab,
  • matplotlib rau kev npaj,
  • numpy rau kev ua haujlwm matrix,
  • os rau operating system vam khom lub luag haujlwm thiab
  • keras rau neural network.

Kauj Ruam 16: Tseem Muaj Cov Cells

Tseem Cells
Tseem Cells
Tseem tshuav Cells
Tseem tshuav Cells
Tseem Cells
Tseem Cells
Tseem Cells
Tseem Cells

Hauv 2, 3, 4 thiab 5 ntawm tes peb thauj cov duab rau hauv cov lej tsis sib xws thiab tsim plaub ntu sib luag los ntawm cov ntawv csv los ua cov ntawv cim. Hauv xov tooj ntawm tes 6 peb tsim peb lub paj hlwb. Nws cov architecture zoo ib yam rau neural network siv rau kev faib tawm tshwj tsis yog cov txheej txheej txheej tsim tawm uas yog 4 thiab tsis yog 1. Lwm qhov sib txawv los ntawm kev ua haujlwm poob uas txhais tau tias yog siv plaub npaug yuam kev. Hauv xov tooj ntawm tes 8 peb pib kawm ntawm peb cov neural network ib zaug tau kawm Kuv tau ua tus qauv no ntawm qhov kev ntsuas teeb tsa kom tau txais kev kwv yees rau lub thawv ciam teb ntawm kev sib tshooj ua ke ntawm cov thawv ciam lawv saib zoo nkauj.

Ua tsaug rau kev nyeem ntawv.

Pom zoo: