Cov txheej txheem:

AI Lub Koob Yees Duab rau Raspberry Pi/Arduino: 7 Kauj Ruam
AI Lub Koob Yees Duab rau Raspberry Pi/Arduino: 7 Kauj Ruam

Video: AI Lub Koob Yees Duab rau Raspberry Pi/Arduino: 7 Kauj Ruam

Video: AI Lub Koob Yees Duab rau Raspberry Pi/Arduino: 7 Kauj Ruam
Video: Saib Mis paub Poj niam (hluas nkauj) tus yam ntxwv lub siab 2024, Kaum ib hlis
Anonim
Image
Image

Yog tias koj tau ua raws cov xov xwm tsis ntev los no, muaj qhov tawg ntawm pib-pib tsim cov chips rau nrawm ML (kev kawm tshuab) algorithms inference thiab kev qhia. Txawm li cas los xij feem ntau ntawm cov chips tseem tab tom txhim kho thiab tsis yog qee yam uas koj tus kws tsim khoom nruab nrab tuaj yeem tau txais tes. Tsuas yog qhov tshwj xeeb tshwj xeeb kom deb li deb yog Intel Movidius Neural Compute Stick, uas muaj rau kev yuav khoom thiab los nrog SDK zoo. Nws muaj qee qhov tsis zoo tseem ceeb - uas yog tus nqi (ib ncig 100 USD) thiab qhov tseeb nws los hauv USB hom ntawv. Nws zoo heev yog tias koj xav siv nws nrog lub khoos phis tawj lossis Raspberry PI, tab sis yuav ua li cas yog tias koj xav ua qee qhov kev paub txog duab nrog Arduino? Puas yog Raspberry Pi Zero?

Kauj Ruam 1: Sipeed MAix: AI ntawm ntug

Sipeed MAix: AI ntawm Ntug
Sipeed MAix: AI ntawm Ntug

Tsis ntev dhau los kuv tau txais kuv txhais tes ntawm Sipeed M1w K210 pawg thawj coj loj, uas muaj dual-core RISC-V 64bit CPU thiab khav theeb on-board KPU (Neural Network Processor), tshwj xeeb tsim los rau nrawm CNN rau kev ua duab. Koj tuaj yeem nyeem cov ntsiab lus ntxiv ntawm no.

Tus nqi ntawm pawg thawj coj no ua rau kuv ceeb, nws tsuas yog 19 USD rau kev ua tiav AI-on-the-edge board nrog kev txhawb nqa Wi-nkaus! Muaj qhov kev ceeb toom txawm hais tias (tau kawg muaj): micropython firmware rau lub rooj tsavxwm tseem tab tom txhim kho, thiab tag nrho nws tsis zoo rau cov neeg siv zoo li tam sim no. Tib txoj hauv kev kom nkag mus rau tag nrho nws cov haujlwm tam sim no yog sau koj tus kheej kos C code lossis hloov kho qee qhov ua piv txwv uas twb muaj lawm.

Cov ntawv qhia no piav qhia yuav siv Mobilenet 20 chav kawm paub tus qauv li cas txhawm rau txheeb xyuas cov khoom thiab xa cov khoom ntsuas pom los ntawm UART, los ntawm qhov twg nws tuaj yeem tau txais los ntawm Arduino/Raspberry Pi.

Tam sim no, qhov kev qhia no xav tias koj tau paub nrog Linux thiab cov hauv paus ntawm kev suav sau C code. Yog tias tau hnov cov kab lus no ua rau koj kiv taub hau me ntsis:) tom qab ntawd tsuas yog hla mus rau Kauj Ruam 4, qhov uas koj tso kuv cov ntawv ua ntej ua binary rau Sipeed M1 thiab hla qhov suav sau.

Kauj Ruam 2: Npaj Koj Ib puag ncig

Npaj Koj Ib puag ncig
Npaj Koj Ib puag ncig

Kuv siv Ubuntu 16.04 rau C sau ua ke thiab xa tawm. Nws muaj peev xwm ua qhov ntawd hauv Windows, tab sis kuv tus kheej tsis tau sim nws.

Rub tawm RISC-V GNU Compiler Toolchain, nruab txhua qhov tsim nyog vam khom.

git clone-ua tau zoo

sudo apt-tau nruab autoconf automake autotools-dev curl libmpc-dev libmpfr-dev libgmp-dev gawk tsim-qhov tseem ceeb bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev

Luam cov toolchain rub tawm rau /opt directory. Tom qab ntawd khiav cov lus txib hauv qab no

./configure --prefix =/opt/kendryte-toolchain -with-cmodel = medany

ua

Ntxiv/xaiv/kendryte-toolchain/bin rau koj PATH tam sim no.

Tam sim no koj tau npaj sau cov cai!

Kauj Ruam 3: Sau Cov Cai

Sau Cov Cai
Sau Cov Cai

Rub tawm cov cai los ntawm kuv qhov chaw cia khoom github.

Rub tawm Kendryte K210 standalone SDK

Luam /kpu nplaub tshev los ntawm kuv qhov chaw cia khoom github rau /src nplaub tshev hauv SDK.

Khiav cov lus txib hauv qab no hauv SDK nplaub tshev (tsis /src nplaub tshev!)

mkdir tsim && cd tsim

cmake.. -DPROJ = project_name -DTOOLCHAIN =/opt/kendryte -toolchain/bin && ua

qhov project_name yog lub npe ntawm koj qhov haujlwm (ntawm koj) thiab -DTOOLCHAIN = yuav tsum taw tes rau qhov chaw ntawm koj li risc -v toolchain (koj rub tawm nws hauv qib lst, nco ntsoov?)

Zoo kawg! Tam sim no cia siab tias koj yuav pom kev suav sau ua tiav yam tsis muaj qhov yuam kev thiab koj muaj.bin cov ntawv koj tuaj yeem rub tawm.

Kauj Ruam 4: Xa cov ntaub ntawv.bin

Kev xa cov ntaub ntawv.bin
Kev xa cov ntaub ntawv.bin

Tam sim no txuas koj Sipeed M1 rau lub khoos phis tawj thiab los ntawm /tsim nplaub tshev khiav cov lus txib hauv qab no

sudo python3 isp_auto.py -d /dev /ttyUSB0 -b 200000 kpu.bin

Qhov twg kpu.bin yog lub npe ntawm koj cov ntaub ntawv.bin

Kev xa tawm feem ntau yuav siv sijhawm li 2-3 feeb, tom qab nws ua tiav koj yuav pom pawg thawj coj saib xyuas 20 chav kawm. Kauj ruam kawg rau peb yog txuas nws mus rau Arduino mega lossis Raspberry Pi.

!!! Yog tias koj nyuam qhuav los ntawm Kauj Ruam 2 !

Khiav cov lus txib hauv qab no los ntawm daim nplaub tshev uas koj tau cloned kuv qhov chaw cia khoom github

sudo python3 isp_auto.py -d /dev /ttyUSB0 -b 200000 kpu_bin.bin

Kev xa tawm feem ntau yuav siv sijhawm 2-3 feeb, tom qab nws ua tiav koj yuav pom pawg thawj coj saib 20 chav kawm paub. Kauj ruam kawg rau peb yog txuas nws mus rau Arduino mega lossis Raspberry Pi.

Kauj ruam 5: Txuas mus rau Arduino

Txuas mus rau Arduino
Txuas mus rau Arduino
Txuas mus rau Arduino
Txuas mus rau Arduino
Txuas mus rau Arduino
Txuas mus rau Arduino

Kuv siv Arduino Mega nrog Seeed Studio Mega Shield, qhov no yog vim li cas kuv thiaj li siv Grove txuas rau Sipeed M1 board. Txawm li cas los xij koj tsuas tuaj yeem siv cov hlua txuas txuas thiab txuas Sipeed M1 ncaj qha rau Arduino Mega, ua raws daim duab kab hluav taws xob no.

Tom qab ntawd upload lub koob yees duab.ino thiab qhib Serial monitor. Thaum koj taw lub koob yees duab rau cov khoom sib txawv (daim ntawv teev npe ntawm 20 chav kawm yog nyob rau hauv daim duab) nws yuav tsum tso tawm lub npe ntawm chav kawm hauv cov ntawv xov xwm!

Nrog koj zoo siab! Tam sim no koj muaj lub luag haujlwm nrhiav duab rau koj Arduino!

Kauj Ruam 6: Txuas rau Raspberry Pi

Txuas rau Raspberry Pi
Txuas rau Raspberry Pi
Txuas rau Raspberry Pi
Txuas rau Raspberry Pi

Kuv siv Grove Pi+ lub kaus mom rau Raspberry Pi 2B, tab sis ntxiv, zoo li nrog Arduino koj tuaj yeem ncaj qha txuas Sipeed M1 rau Raspberry Pi's UART interface tom qab daim duab kab hluav taws xob no.

Tom qab ntawd tshaj tawm camera_speak.py thiab taw lub koob yees duab rau cov khoom sib txawv, lub davhlau ya nyob twg yuav tso cov ntawv hauv qab no "Kuv xav tias nws yog" thiab tseem yog tias koj muaj tus hais lus txuas nrog, nws yuav hais cov kab lus no nrov nrov. Zoo nkauj txias, tsis yog nws?

Kauj Ruam 7: Xaus

Nov yog lub sijhawm tawm mus heev uas peb nyob, nrog AI thiab kev kawm tshuab nkag mus rau txhua qhov ntawm peb lub neej. Kuv tab tom nrhiav rau txoj kev txhim kho hauv cheeb tsam no. Kuv tab tom sib txuas nrog pab pawg Sipeed, thiab kuv paub tias lawv tau nquag txhim kho micropython qhwv rau txhua txoj haujlwm tsim nyog, suav nrog CNN nrawm dua.

Thaum nws tau npaj txhij Kuv yuav zoo li yuav tshaj tawm cov lus qhia ntxiv txog yuav siv koj li CNN tus qauv li cas nrog micropython. Xav txog txhua qhov kev thov zoo siab uas koj tuaj yeem muaj rau pawg thawj coj uas tuaj yeem ua haujlwm koj tus kheej ua cov duab neural tes hauj lwm rau tus nqi no thiab nrog tus hneev taw no!

Pom zoo: