Cov txheej txheem:

Kev Cai Tus Kheej Hauv Chav Ua Si: 4 Kauj Ruam
Kev Cai Tus Kheej Hauv Chav Ua Si: 4 Kauj Ruam

Video: Kev Cai Tus Kheej Hauv Chav Ua Si: 4 Kauj Ruam

Video: Kev Cai Tus Kheej Hauv Chav Ua Si: 4 Kauj Ruam
Video: “Ob Qho Kev Yug Los Ua Neeg Ua Rau Qhov Tseem Ceeb ntawm Kev Yug Los Ua Neeg Tiav Hlo” 2024, Hlis ntuj nqeg
Anonim
Image
Image
Kev Cai Lub Suab Hauv Chav Ua Si
Kev Cai Lub Suab Hauv Chav Ua Si

Txog peb qhov haujlwm kawg hauv kev sib tham sib tham hauv lub caij nplooj ntoo hlav no, peb tsim lub sijhawm tiag tiag rau kev txheeb xyuas thiab pom lub suab sib xws hauv chav ua noj siv Kev Pab Txhawb-Vector Tshuab kev faib tawm. Lub kaw lus suav nrog lub khoos phis tawj rau kev ntsuas suab/cais tawm, thiab Arduino/dot matrix zaub rau pom kev. Cov hauv qab no yog cov lus qhia rau kev tsim koj tus kheej ntawm cov kab ke no rau lub suab los ntawm koj tus kheej chav ua noj.

Peb cov ntaub ntawv siv thawj yog khoom siv rau chav ua noj ntawm cov lag ntseg thiab tsis hnov lus ntawm tus kheej, tab sis cov kab ke no tuaj yeem ua raws li kev xav los txheeb xyuas cov teeb tsa suab hauv ntau yam ntsiab lus. Chav ua noj yog qhov chaw zoo tshaj los pib, vim nws zoo li nyob ntsiag to thiab muaj qhov tsim nyog ntawm qhov yooj yim, txawv suab.

GitHub chaw cia khoom rau txoj haujlwm no tuaj yeem pom ntawm no.

Khoom siv

  • Arduino Leonardo Microcontroller nrog lub taub hau
  • KEYESTUDIO 16x16 Dot Matrix LED Zaub rau Arduino
  • Breadboard jumper hlau
  • Micro-USB rau USB 2.0 cable
  • Lub laptop nrog Jupyter Notebook (Anaconda teeb tsa)

    Ib tus pib phau ntawv qhia rau Jupyter Notebook tuaj yeem pom ntawm no

  • Muaj ntau qhov tsis sib xws ntawm LEGO cov cib rau lub tsev nyob

    (Tab sis tiag tiag koj tuaj yeem hloov cov no nrog txhua yam khoom DIY uas koj xav tau!)

Kauj Ruam 1: Sau Cov Qauv Hauv Chav Ua Si

Sau Cov Qauv Hauv Tsev Ua Si
Sau Cov Qauv Hauv Tsev Ua Si

Daim Duab Saum Ntuj Ceeb Tsheej: Cov ntaub ntawv suab tau los ntawm kev kaw lub diav rawg thiab rab riam sib txuas ua ke siv cov txheej txheem sau no

Txhawm rau txheeb xyuas lub suab lub sijhawm tiag, peb yuav tsum tau muab peb lub tshuab kev kawm qauv nrog cov piv txwv zoo rau kev sib piv. Peb tsim Jupyter phau ntawv rau cov txheej txheem no, uas tuaj yeem nkag mus rau ntawm no lossis dhau los ntawm peb txoj haujlwm GitHub chaw cia khoom. Cov chaw cia khoom tseem muaj cov qauv sau los ntawm ob chav ua noj sib txawv rau lub hom phiaj sim.

Kauj ruam 1.1: Luam theej duab CollectSamples.ipynb phau ntawv rau koj phau ntawv teev npe Jupyter phau ntawv ua haujlwm thiab qhib nws.

Kauj Ruam 1.2: Khiav txhua lub xovtooj ntawm ib tus, ua tib zoo saib xyuas cov ntawv uas peb tau muab hauv lub hauv paus. Nres thaum koj mus txog ib lub npe hu ua "Sample Recording".

NCO TSEG: Ntau lub tsev qiv ntawv Python tau siv hauv phau ntawv no, thiab txhua tus xav tau kev teeb tsa ua ntej lawv tuaj yeem ua tiav ua tiav rau hauv txoj haujlwm. Koj zoo siab ua qhov no ntawm tus kheej, txawm hais tias phau ntawv qhia rau teeb tsa lub tsev qiv ntawv hauv Jupyter Phau Ntawv tuaj yeem pom ntawm no.

Kauj Ruam 1.3: Tsim cov npe khoob kom khaws koj cov qauv hauv koj phau ntawv teev npe ua haujlwm rau txoj haujlwm no.

Kauj Ruam 1.4: Kho qhov SAMPLES_LOCATION qhov sib txawv hauv "Sample Recording" cell kom phim koj cov npe uas tsis muaj chaw nyob.

Kauj Ruam 1.5: Ntxiv lossis tshem tawm ntau lub suab raws li koj nyiam rau SOUND_LABELS sib txawv.

Txhawm rau cov qauv sau cia ua haujlwm, txhua kab ntawm qhov sib txawv no yuav tsum raug cais los ntawm tus lej thiab ntawm daim ntawv hauv qab no:

'ts': Suab ("TargetedSound", "ts")

Kauj Ruam 1.6: Thaum tag nrho cov ntawv sau tau ntxiv, ntsuas "Cov Qauv Sau" ntawm tes nrog pib ua cov txheej txheem sau. Hauv xov tooj ntawm tes, koj yuav raug hais kom nkag mus rau cov lej luv uas koj cuam tshuam nrog txhua lub suab hauv cov ntawv (piv txwv li, "ts" rau TargetedSound). Tsis txhob ua qhov no xwb.

Kauj Ruam 1.7: Nqa koj lub laptop mus rau hauv chav ua noj thiab muab tso rau hauv thaj chaw uas koj yuav muaj feem ntau yuav tso qhov ua tiav. Qhov chaw no yuav tsum yog lub hauv paus rau kev khaws suab zoo, thiab qhuav thiab nyob deb ntawm qhov muaj peev xwm nchuav los tiv thaiv koj cov khoom siv hluav taws xob.

Kauj Ruam 1.8: Npaj koj thawj lub suab. Yog tias qhov no yog lub sijhawm ntsuas lub qhov cub, koj tuaj yeem teeb tsa lub sijhawm rau ib feeb thiab tos kom nws suav mus txog 20 vib nas this lossis ua ntej txuas ntxiv mus rau kauj ruam tom ntej.

Kauj Ruam 1.9: Ntaus tus lej cim rau hauv qhov hais kom sai (piv txwv li, "ts"), thiab nias Enter/Return.

Lub kaw lus yuav pib mloog rau lub suab tshwm sim txawv ntawm lub suab nrov ib puag ncig ntawm chav. Thaum hnov qhov suab tshwm sim no, nws yuav pib kaw kom txog thaum nws hnov suab hauv chav tau rov qab mus rau qhov chaw ib puag ncig. Tom qab ntawd nws yuav khaws lub suab ua 16-ntsis WAV cov ntaub ntawv rau hauv cov npe teev tseg hauv SAMPLES_LOCATION hauv hom ntawv:

TargetedSound _#_ captured.wav

# Feem ntawm cov ntaub ntawv npe no sib xws nrog tus naj npawb ntawm cov qauv ntawm lub hom phiaj suab uas koj tau sau. Tom qab cov ntaub ntawv WAV tau txais kev cawmdim, qhov kev hais kom sai yuav rov ua dua, tso cai rau koj khaws ntau qhov piv txwv ntawm tib lub suab hauv kev ua tiav ntawm tes.

TSIS TXHOB hloov lub npe no. Nws yog ib qho tseem ceeb rau qib tom ntej.

Kauj Ruam 1.10: Rov ua cov kauj ruam 1.8 thiab 1.9 kom txog thaum koj tau khaws 5-10 cov qauv ntawm txhua lub suab.

Kauj Ruam 1.11: Tawm tswv yim "x" thaum ua tiav kom tawm qhov kev ua tiav.

CEEB TOOM: Kev ua tsis tiav ntawm lub xovtooj ntawm txoj hauv kev no tuaj yeem ua rau Notebook tsoo. Hauv qhov no, Phau Ntawv Phau Ntawv yuav tsum tau rov pib dua thiab txhua lub xov tooj rov ua haujlwm dua los ntawm sab saud.

Kauj Ruam 1.11 (Tsis teb los tau): Txheeb xyuas WAV cov ntaub ntawv ntawm tus kheej cov ntaub ntawv hauv "Quick Sound Visualization" cell kom ntseeg tau tias koj tau txais txhua cov ntaub ntawv xav tau.

Qee cov lus qhia:

  • Sau thaum koj chav ua noj nyob ntsiag to.
  • Sau tsuas yog ib lub suab ib zaug. Lub kaw lus tsis tuaj yeem paub qhov sib tshooj ntawm cov suab.
  • Sim ua txhua qhov kev sim suab kom zoo ib yam li ua tau. Qhov no yuav pab kom qhov tseeb ntawm qhov qhia kom paub.
  • Rov ntsuas dua Cov Ntawv Teev Npe yuav rov kho tus # tus nqi hauv lub npe thiab rov sau dua cov ntaub ntawv uas twb muaj lawm uas phim qhov #. Peb pom nws yooj yim tshaj plaws los sau txhua qhov piv txwv ntawm ib lub suab ib zaug, tom qab ntawd tso tseg Cov Ntawv Teev Npe ntawm tes.
  • Yog tias lub kaw lus tsis khaws koj lub suab lub hom phiaj, sim txo qis THRESHOLD tus nqi (teeb tsa rau 30 kom pib) thiab rov tshuaj xyuas lub xov tooj.
  • Yog tias cov ntaub ntawv kaw los ntawm lwm lub suab sab nraud ntawm lub hom phiaj, sim nce THRESHOLD tus nqi (teeb tsa rau 30 kom pib) thiab rov tshuaj xyuas lub xov tooj.

Kauj Ruam 2: Npaj Arduino/Matrix Display

Npaj Arduino/Matrix Zaub
Npaj Arduino/Matrix Zaub
Npaj Arduino/Matrix Zaub
Npaj Arduino/Matrix Zaub
Npaj Arduino/Matrix Zaub
Npaj Arduino/Matrix Zaub

Tom ntej no, peb tab tom teeb tsa qhov muag pom kev siv Arduino Leonardo thiab KEYESTUDIO 16x16 LED dot matrix zaub. Qhov no yog txhawm rau tso tawm cov qauv kev faib tawm qhov kwv yees ntawm cov suab pom. Raws li ua ntej, peb tau muab txhua cov ntaub ntawv xav tau ntawm no thiab hauv qhov project GitHub chaw cia khoom.

Kauj ruam 2.1: Hlau Arduino thiab LED matrix raws li daim duab saum toj no. KEYESTUDIO suav nrog cov xov hlau los txuas rau lawv cov lej teev tseg, tab sis lub khob cij txuas rau lub khob yuav tsum xav txuas cov xov hlau no mus rau Arduino

Kauj ruam 2.2: Qhib "arduino_listener.ino" siv Ardunio IDE thiab xa nws mus rau Leonardo. Yog tias txuas tau zoo, koj yuav tsum pom lub cim "mloog" (zoo li Wi-nkaus) raws li qhia hauv daim duab saum toj no.

Kauj Ruam 2.3: Npaj cov cim koj xav pom rau txhua lub hom phiaj koj lub suab. Txhawm rau paub cov LEDs twg kom pom kev, lub cim yuav tsum raug xa los ntawm Arduino mus rau qhov sib piv raws li kab lus byte. Piv txwv li, peb lub khob kas fes lub cim (hauv daim duab saum toj no) raug xa mus rau qhov sib piv hauv hom ntawv no:

{

0xff, 0xff, 0xff, 0xff, 0xfc, 0xfb, 0xbb, 0xbb, 0x5b, 0xeb, 0xfb, 0xfb, 0xfb, 0xfc, 0xfc, 0xfe, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xfb, 0xfb, 0xfb, 0xfb, 0xfb, 0xf7, 0x0f, 0xdf, 0x1f, 0xff, 0xff};

Peb kos peb lub cim siv Dot2Pic cov cuab yeej online, nrog 16 kab, 16 kab, thiab "monochromatic, 8 pixels ib byte, teeb tsa ntsug" xaiv los ntawm cov ntawv qhia zaub mov nco. Peb tuaj yeem pom nyob hauv "sample_icon_bytes.txt" array.

NCO TSEG: Tej zaum kuj tseem muaj cov cuab yeej online uas tuaj yeem ua qhov no tau txais nrog cov ntaub ntawv rub tawm.

Kauj Ruam 2.4: Kos txhua lub cim. Thaum ua tiav daim duab, xaiv "Hloov mus rau kab".

Kauj ruam 2.5: Hloov cov cim tsis tsim nyog tau hais tseg nyob rau sab saum toj ntawm "arduino_listening.ino" code raws li xav tau. Nco ntsoov ntxiv cov lus piav qhia lub cim kom koj nco qab uas yog qhov twg!

Kauj ruam 2.6: Tshaj tawm cov cai tshiab rau Arduino. Tsis txhob kaw cov ntaub ntawv tseem tsis tau tiav, peb yuav xav tau nws rau qib tom ntej.

Kauj Ruam 3: Khiav Classifier thiab Txheeb Suab

Khiav lub Classifier thiab Txheeb Suab
Khiav lub Classifier thiab Txheeb Suab
Khiav lub Classifier thiab Txheeb Suab
Khiav lub Classifier thiab Txheeb Suab

Tam sim no nws yog lub sijhawm los muab cov kab ke ua ke. Kev faib cov raj xa dej, kev sib txuas lus Arduino, thiab kaw suab kaw suab yog txhua yam ua tiav los ntawm ib phau ntawv Arduino, uas tau muab rau ntawm no lossis tuaj yeem nkag mus tau los ntawm peb txoj haujlwm GitHub chaw cia khoom.

Kauj Ruam 3.1: Luam daim ntawv FullPipeline.ipynb rau koj phau ntawv teev npe Jupyter phau ntawv ua haujlwm thiab qhib nws.

Kauj Ruam 3.2: Khiav txhua lub cell ib los ntawm ib qho, ua tib zoo saib xyuas cov ntawv uas peb tau muab hauv kab lus. Tsis xav tias yuav tso tawm. Nres thaum koj mus txog ntawm lub xovtooj hu ua "Load the Training Data".

Kauj Ruam 3.3: Kho qhov SAMPLES_LOCATION_ROOT sib txawv hauv "Load the Training Data" cell mus rau niam txiv phau ntawv teev npe ntawm koj cov ntawv piv txwv yav dhau los qhov chaw nyob. Tom qab ntawd, hloov SAMPLES_DIR_NAME sib txawv rau lub npe ntawm koj cov npe. Yog li yog tias koj tau teeb tsa qhov chaw hauv CollectSamples.ipynb rau:

SAMPLES_LOCATION = "/Users/xxxx/Documents/KitchenSoundClassifier/MySamples/NewDir"

Tam sim no koj yuav teeb tsa cov kev hloov pauv no rau:

SAMPLES_LOCATION_ROOT = "/Users/xxxx/Documents/KitchenSoundClassifier/MySamples/" SAMPLES_DIR_NAME = "NewDir"

Peb tau ua qhov no tso cai hloov pauv sai sai rau tus neeg faib khoom thaum muaj qhov tsis raug. Koj tuaj yeem hloov pauv ntawm cov qauv sib txawv sau los kho koj cov ntaub ntawv.

Kauj Ruam 3.4: Ntsuam xyuas lub cell. Koj yuav tsum pom txhua qhov khoom thauj khoom ua tiav.

Kauj Ruam 3.5: Txuas mus txuas ntxiv txhua lub cell ib los ntawm ib qho, ua tib zoo saib xyuas cov ntawv uas peb tau muab hauv kab lus.

Kauj Ruam 3.6: Nres thaum koj mus txog "Xa Xov Arduino" ntawm tes. Txheeb xyuas qhov chaw nres nkoj uas koj lub computer yuav siv rau kev sib txuas lus nrog Arduino hauv PORT_DEF sib txawv. Qhov no tuaj yeem pom hauv Arduino IDE thiab mus rau Cov Cuab Yeej> Chaw Nres Nkoj.

Cov ntaub ntawv ntxiv tuaj yeem pom ntawm no.

Kauj Ruam 3.8: Rov qhib koj li Arduino IDE. Hauv qhov chaw uas koj tau hloov pauv rau cov cim, sau ib tsab ntawv ntawm ib sab ntawm tus nqi array, tab sis TSIS TXHOB hloov nws. Hauv qhov piv txwv hauv qab no, qhov no yog "g".

// pov tseg pov tseg pov tseg tsis tau kos npe g [1] [32] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf8, 0xf7, 0xf7, 0xf7, 0xfb, 0xff, 0xfe, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x2f, 0x27, 0xc3, 0x03, 0xc3, 0x27, 0x2f, 0xff, 0xef, 0xdf, 0xdf, 0xbf, 0xff, 0xff,};

Kauj Ruam 3.7: (Rov qab mus rau "Xa Ntawv Arduino" ntawm tes ntawm Phau Ntawv) Hloov cov ntawv lo rau hauv tus kheej.sounds phau ntawv txhais lus kom phim cov ntawv koj tau siv hauv kev sau koj cov qauv, ua kom ntseeg tau tias txhua daim ntawv lo sib xws rau ib tsab ntawv uas koj tau sau tseg hauv yav dhau los kauj ruam "Cov ntaubntawv povthawj" thiab "Mloog" yog ob qho ntawm cov haujlwm tseem ceeb hauv lub system thiab yuav tsum tsis hloov pauv. TSIS TXHOB hloov tsab ntawv thib ob tshwj tsis yog tias koj ntseeg siab ua qee qhov kev hloov pauv ntxiv rau Arduino code ib yam, vim nws yuav cuam tshuam kev sib txuas lus nrog Arduino/matrix lwm yam.

Kauj ruam 3.8: Khiav lub luag haujlwm tseem ceeb! Txoj cai yuav rub cov ntaub ntawv kev kawm, rho tawm nws cov yam ntxwv tseem ceeb, pub lawv rau hauv cov raj xa dej, tsim cov qauv kev faib tawm, tom qab ntawd pib mloog rau cov xwm txheej suab. Thaum nws nkag siab ib qho, koj yuav pom cov lej hloov pauv mus rau lub cim kaw (xwmfab nrog lub voj voog sab hauv) thiab nws yuav faib cov ntaub ntawv no thiab pub nws rau hauv tus qauv. Xijpeem tus qauv kwv yees yuav nthuav tawm ob peb feeb tom qab ntawm cov duab matrix.

Koj tuaj yeem ua raws nrog hauv cov xov tooj ntawm tes hauv qab no. Saib qhov tseeb koj tuaj yeem tau txais nws li cas!

Kauj Ruam 4: Tsim Lub Tsev LEGO

Tsim LEGO Vaj Tsev
Tsim LEGO Vaj Tsev
Tsim LEGO Vaj Tsev
Tsim LEGO Vaj Tsev
Tsim LEGO Vaj Tsev
Tsim LEGO Vaj Tsev

Nov yog qhov lom zem! Koj tau ua tiav txhua qhov kev kawm tshuab loj thiab tau txais tag nrho qhov kawg-rau-qhov system nce thiab khiav, thiab tam sim no koj tau ua si nrog LEGOs raws li khoom plig. Tsis muaj ntau txoj hauv kev los nthuav qhia ntawm no. Peb tsuas yog ntxiv cov thaiv peb nyiam ntawm no thiab nyob ntawd yam tsis muaj kev txhawj xeeb ntau txog qhov tsim qauv tag nrho, thiab peb tau xaus zoo siab nrog txoj kev nws tig los.

Tso cai rau peb cov duab los ua kev tshoov siab rau koj tus kheej lub tsev muaj tswv yim tshwj xeeb rau koj chav ua noj. Peb tau tso Arduino thiab feem ntau ntawm cov kab hluav taws xob nyob hauv qhov khoob, tom qab ntawd ua kom ruaj ntseg cov duab teeb tsa saum toj no nrog overhangs. Peb tau ntxiv me ntsis ntawm daim ntawv hla cov zaub kom nthuav lub teeb me ntsis uas peb xav tias ua cov cim kom meej dua.

Pom zoo: