Cov txheej txheem:

Kev Tshawb Nrhiav Lub Hom Phiaj Nrog Sipeed MaiX Boards (Kendryte K210): 6 Cov Kauj Ruam
Kev Tshawb Nrhiav Lub Hom Phiaj Nrog Sipeed MaiX Boards (Kendryte K210): 6 Cov Kauj Ruam

Video: Kev Tshawb Nrhiav Lub Hom Phiaj Nrog Sipeed MaiX Boards (Kendryte K210): 6 Cov Kauj Ruam

Video: Kev Tshawb Nrhiav Lub Hom Phiaj Nrog Sipeed MaiX Boards (Kendryte K210): 6 Cov Kauj Ruam
Video: Maiv Xyooj ~ "Vim Dab Tsi Txiav Kev Hlub" with Lyrics (Official Music Video) 2024, Hlis ntuj nqeg
Anonim
Image
Image

Raws li kev txuas ntxiv ntawm kuv tsab xov xwm dhau los txog kev lees paub cov duab nrog Sipeed MaiX Boards, Kuv txiav txim siab sau lwm qhov kev qhia, tsom mus rau cov khoom pom. Muaj qee qhov khoos phis tawj nthuav tawm tsis ntev los no nrog Kendryte K210 nti, suav nrog Pom AI Hat rau Kev Xeem Ntug, M5 pawg M5StickV thiab DFRobot's HuskyLens (txawm hais tias ib qho muaj cov khoom lag luam muaj tswv yim thiab ntau lub hom phiaj rau cov pib ua tiav). Vim tias nws pheej yig tus nqi, Kendryte K210 tau thov rau tib neeg, xav kom ntxiv lub zeem muag khoos phis tawj rau lawv cov haujlwm. Tab sis raws li ib txwm nrog Suav cov khoom lag luam kho vajtse, kev txhawb nqa thev naus laus zis tsis muaj thiab qhov no yog qee yam uas kuv tau sim txhim kho nrog kuv cov ntawv thiab yeeb yaj kiab. Tab sis nco ntsoov, tias kuv tsis nyob ntawm Kendryte lossis Sipeed cov tsim tawm pab pawg thiab tsis tuaj yeem teb txhua cov lus nug ntsig txog lawv cov khoom.

Nrog qhov xav hauv siab, cia pib! Peb yuav pib nrog qhov luv luv (thiab yooj yim dua) kev saib xyuas ntawm yuav ua li cas cov khoom lees paub CNN qauv ua haujlwm.

Hloov Kho Lub Tsib Hlis 2020: Pom li cas kuv kab lus thiab vis dis aus ntawm Kev Tshawb Nrhiav Lub Hom Phiaj nrog K210 cov laug cam tseem nrov heev thiab ntawm cov txiaj ntsig zoo tshaj plaws hauv YouTube thiab Google, Kuv txiav txim siab hloov kho kab lus kom suav nrog cov ntaub ntawv hais txog aXeleRate, Keras-based moj khaum rau AI ntawm Ntug kuv txhim kho. aXeleRate, qhov tseem ceeb, yog los ntawm kev sau cov ntawv sau uas kuv tau siv rau kev qhia paub lub ntsej muag duab/khoom ntsuas pom - ua ke rau hauv ib lub moj khaum thiab ua kom zoo rau kev ua haujlwm ntawm Google Colab. Nws yooj yim dua rau siv thiab ntau dua.

Txog qhov qub version ntawm tsab xov xwm, koj tseem tuaj yeem pom nws ntawm steemit.com.

Kauj Ruam 1: Kev Tshawb Fawb Cov Qauv Qauv Architecture Piav

Lub Hom Phiaj Tshawb Nrhiav Qauv Architecture Piav
Lub Hom Phiaj Tshawb Nrhiav Qauv Architecture Piav
Lub Hom Phiaj Tshawb Nrhiav Qauv Architecture Piav
Lub Hom Phiaj Tshawb Nrhiav Qauv Architecture Piav

Kev lees paub cov duab (lossis cais cov duab) ua qauv coj tag nrho cov duab los ua tswv yim thiab tso tawm cov npe ntawm qhov tshwm sim rau txhua chav kawm uas peb tab tom sim paub. Nws muaj txiaj ntsig zoo yog tias yam khoom uas peb xav tau nyob hauv ib feem loj ntawm daim duab thiab peb tsis quav ntsej ntau txog nws qhov chaw nyob. Tab sis yuav ua li cas yog tias peb txoj haujlwm (hais, lub ntsej muag taug qab lub koob yees duab) xav kom peb tsis tsuas yog muaj kev paub txog hom khoom hauv daim duab, tab sis kuj tseem muaj kev tswj hwm. Thiab dab tsi txog qhov haujlwm xav tau txhawm rau txheeb xyuas ntau yam khoom (piv txwv li suav)?

Nov yog thaum Cov Qauv Nrhiav Cov Qauv tuaj yeem ua ke. Hauv kab lus no peb yuav siv YOLO (koj tsuas yog saib ib zaug) kev kos duab thiab tsom mus rau qhov kev piav qhia ntawm kev siv tshuab sab hauv ntawm cov haujlwm tshwj xeeb no.

Peb tab tom sim txiav txim seb yam khoom muaj nyob hauv daim duab thiab dab tsi yog lawv qhov chaw nyob. Txij li kev siv tshuab tsis yog khawv koob thiab tsis yog "lub tshuab xav", tab sis tsuas yog cov txheej txheem uas siv cov txheeb cais los txhawm rau ua kom muaj txiaj ntsig zoo (neural network) los daws qhov teeb meem tshwj xeeb. Peb yuav tsum tau txhais cov teeb meem no kom nws "ua kom zoo dua". Ib qho kev paub tsis meej ntawm no yuav yog kom muaj lub algorithm txo qhov poob (qhov sib txawv) ntawm nws qhov kev twv ua ntej thiab kev tswj hwm qhov tseeb ntawm cov khoom. Qhov ntawd yuav ua haujlwm zoo nkauj, tsuav yog peb tsuas muaj ib yam khoom hauv daim duab. Rau ntau yam khoom peb siv qhov sib txawv - peb ntxiv kab sib chaws thiab ua rau peb lub network kwv yees qhov muaj (lossis tsis muaj) ntawm cov khoom (s) hauv txhua kab sib chaws. Suab zoo, tab sis tseem tshuav ntau qhov tsis paub meej rau lub network - yuav ua li cas tso tawm qhov kev twv ua ntej thiab yuav ua li cas thaum muaj ntau yam khoom nrog nruab nrab hauv ib lub xov tooj ntawm tes? Peb yuav tsum tau ntxiv ib qho kev txwv ntxiv - thiaj li hu ua thauj tog rau nkoj. Thauj tog rau nkoj yog qhov loj me me (dav, qhov siab) qee qhov uas (ze tshaj rau qhov loj me ntawm cov khoom) yuav raug hloov mus rau qhov khoom loj - siv qee qhov tso tawm los ntawm neural network (daim ntawv qhia kawg).

Yog li, ntawm no yog kev pom zoo tshaj plaws ntawm dab tsi tshwm sim thaum YOLO architecture neural network ua qhov ntsuas pom ntawm cov duab. Raws li cov yam ntxwv tau tshawb pom los ntawm cov cuab yeej rho tawm network, rau txhua kab sib chaws ntawm tes tau teeb tsa txoj kev twv ua ntej, uas suav nrog cov thauj tog rau nkoj offset, qhov yuav tshwm sim thiab thauj tog rau nkoj. Tom qab ntawd peb pov tseg qhov kev twv ua ntej nrog qhov tshwm sim qis thiab voila!

Kauj Ruam 2: Npaj Ib puag ncig

Npaj Ib puag ncig
Npaj Ib puag ncig

aXeleRate yog ua raws txoj haujlwm zoo los ntawm penny4860, SVHN yolo-v2 tus lej ntsuas. aXeleRate siv qhov kev siv ntawm YOLO lub ntsuas hluav taws xob hauv Keras mus rau qib tom ntej thiab siv nws cov txheej txheem yooj yim los ua kev qhia thiab hloov pauv ntawm kev lees paub duab/khoom pom thiab pom cov duab sib faib nrog ntau yam kev txhawb nqa.

Txhawm rau yog ob txoj hauv kev siv aXeleRate: khiav hauv zos ntawm Ubuntu tshuab lossis hauv Google Colab. Txhawm rau khiav hauv Google Colab, saib qhov piv txwv no:

PASCAL-VOC Lub Hom Phiaj Tshawb Nrhiav Colab Phau Ntawv

Kev cob qhia koj tus qauv hauv ib cheeb tsam thiab xa tawm nws los siv nrog kho vajtse nrawm kuj tseem yooj yim dua tam sim no.

Rub tawm lub installer ntawm no.

Tom qab kev teeb tsa tiav, tsim ib puag ncig tshiab:

conda tsim -n yolo nab hab sej = 3.7

Cia peb qhib qhov chaw tshiab

conda qhib yolo

Cov ntawv ua ntej ua ntej koj lub plhaub bash yuav tshwm nrog lub npe ib puag ncig, qhia tias koj ua haujlwm tam sim no hauv ib puag ncig ntawd.

Nruab aXeleRate ntawm koj lub tshuab hauv zos nrog

pip nruab git+https://github.com/AIWintermuteAI/aXeleRate

Thiab tom qab ntawd ua qhov no txhawm rau rub cov ntawv koj yuav xav tau rau kev qhia thiab kev pom zoo:

git clone

Koj tuaj yeem ua qhov ntsuas nrawm nrog tests_training.py hauv aXeleRate nplaub tshev. Nws yuav khiav kev qhia paub thiab kev pom zoo rau txhua hom qauv, txuag thiab hloov cov qauv kev kawm. Txij li nws tsuas yog kev qhia rau 5 lub sijhawm thiab cov ntaub ntawv muaj tsawg heev, koj yuav tsis tuaj yeem tau txais cov qauv muaj txiaj ntsig, tab sis tsab ntawv no tsuas yog siv los tshuaj xyuas qhov tsis ua yuam kev.

Kauj Ruam 3: Qhia Tus Qauv Nrhiav Lub Hom Phiaj Nrog Keras

Qhia ib lub hom phiaj nrhiav tus qauv nrog Keras
Qhia ib lub hom phiaj nrhiav tus qauv nrog Keras

Tam sim no peb tuaj yeem khiav cov ntawv qhia nrog cov ntawv teeb tsa. Txij li Keras kev siv YOLO lub ntsuas qhov ntsuas yog qhov nyuaj heev, tsis txhob piav qhia txhua qhov cuam tshuam ntawm cov cai, Kuv yuav piav qhia yuav teeb tsa kev qhia li cas thiab tseem piav qhia cov qauv cuam tshuam, yog tias koj xav hloov qee yam rau lawv tus kheej.

Cia peb pib nrog cov khoom ua piv txwv thiab qhia lub racoon ntes. Muaj cov ntaub ntawv teeb tsa sab hauv ntawm /teeb tsa nplaub tshev, raccoon_detector.json. Peb xaiv MobileNet7_5 raws li kev tsim vaj tsev (qhov twg 7_5 yog alpha parameter ntawm thawj qhov Mobilenet siv, tswj qhov dav ntawm lub network) thiab 224x224 raws li qhov loj me. Cia peb saib qhov tsis tseem ceeb tshaj plaws hauv kev teeb tsa:

Hom yog qauv ua ntej - Classifier, Detector lossis SegnetArchitecture yog tus qauv backend (feature extractor)

- Yolo puv - Yolo me me - MobileNet1_0 - MobileNet7_5 - MobileNet5_0 - MobileNet2_5 - SqueezeNet - VGG16 - ResNet50

Yog xav paub ntxiv txog cov thauj tog rau nkoj, thov nyeem ntawm no

Cov ntawv lo yog cov ntawv cim nyob hauv koj cov ntaub ntawv. TSEEM CEEB: Thov, sau txhua daim ntawv lo uas muaj nyob hauv cov ntaub ntawv.

object_scale txiav txim siab ntau npaum li cas rau txim qhov kev twv ua ntej tsis raug ntawm kev ntseeg siab ntawm cov khoom kwv yees

no_object_scale txiav txim siab ntau npaum li cas rau txim rau qhov kev twv ua ntej tsis raug ntawm kev ntseeg siab ntawm cov khoom uas tsis yog kwv yees

coord_scale txiav txim siab ntau npaum li cas rau txim rau txoj haujlwm tsis raug thiab qhov kwv yees loj (x, y, w, h)

class_scale txiav txim siab ntau npaum li cas rau txim qhov kev twv ua ntej chav kawm tsis raug

augumentation - cov duab augumentation, hloov pauv, hloov pauv thiab ua rau cov duab tsis meej kom tiv thaiv kev ua kom dhau thiab muaj ntau yam sib txawv hauv cov ntaub ntawv.

train_times, validation_times - pes tsawg zaus los rov ua cov ntaub ntawv. Pab tau yog tias koj muaj augumentation

qhib

first_trainable_layer - tso cai rau koj kom khov qee cov txheej txheem yog tias koj tab tom siv cov phiaj xwm kev qhia ua ntej

Tam sim no peb yuav tsum rub cov ntaub ntawv teev tseg, uas kuv tau qhia tawm ntawm kuv Google Drive (cov ntaub ntawv tseem ceeb), uas yog cov ntaub ntawv tshawb pom racoon, muaj 150 daim duab piav qhia.

Nco ntsoov hloov kab hauv cov ntawv teeb tsa (train_image_folder, train_annot_folder) raws li thiab tom qab ntawd pib qhov kev qhia nrog cov lus txib hauv qab no:

nab nab axelerate/train.py -c configs/raccoon_detector.json

train.py nyeem cov ntawv teeb tsa los ntawm.json cov ntaub ntawv thiab cob qhia tus qauv nrog axelerate/networks/yolo/yolo_frontend.py tsab ntawv. yolo/backend/loss.py yog qhov kev cai ua haujlwm tsis tau ua tiav thiab yolo/backend/network.py yog qhov chaw tsim qauv (cov tswv yim, qhov tshwj xeeb rho tawm thiab nrhiav kom pom txheej ua ke). axelerate/networks/common_utils/fit.py yog tsab ntawv uas siv cov txheej txheem kev qhia thiab axelerate/networks/common_utils/feature.py muaj cov extractors. Yog tias koj npaj siab siv tus qauv kev kawm nrog K210 nti thiab Micropython firmware, vim nco kev txwv koj tuaj yeem xaiv ntawm MobileNet (2_5, 5_0 thiab 7_5) thiab TinyYolo, tab sis kuv tau pom MobileNet muab kev txheeb xyuas zoo dua.

Txij li nws yog cov khoom ua piv txwv thiab tsuas yog muaj 150 daim duab ntawm raccoons, cov txheej txheem kev qhia yuav tsum tau nrawm heev, txawm tias tsis muaj GPU, txawm hais tias qhov tseeb yuav nyob deb ntawm cov hnub qub. Txog txoj haujlwm ntsig txog kev ua haujlwm Kuv tau kawm paub tus cim kos npe tsheb thiab tus lej ntsuas, ob qho ntaub ntawv suav nrog ntau dua ob peb txhiab qhov kev qhia ua piv txwv.

Kauj ruam 4: Hloov nws mus rau.kmodel Format

Hloov nws mus.kmodel Format
Hloov nws mus.kmodel Format

Nrog aXeleRate, qauv kev hloov pauv tau ua tiav - qhov no yog qhov sib txawv loj tshaj los ntawm cov ntawv qub ntawm kev qhia sau ntawv! Ntxiv rau koj tau txais cov qauv ntaub ntawv thiab kev teeb tsa kev cob qhia khaws tseg zoo nyob hauv cov phiaj xwm phiaj xwm. Tsis tas li kuv tau pom tias vaiidation qhov tseeb qee zaum ua tsis tau los kwv yees tus qauv kev ua tau zoo tiag tiag rau kev txheeb xyuas qhov khoom thiab qhov no yog vim li cas kuv thiaj ntxiv mAP los ua qhov ntsuas qhov ntsuas tau rau cov qauv ntsuas pom. Koj tuaj yeem nyeem ntxiv txog mAP ntawm no.

Yog tias mAP, txhais tau tias qhov nruab nrab qhov tseeb (peb qhov ntsuas ntsuas tau zoo) tsis txhim kho rau 20 lub sijhawm, kev qhia yuav nres ua ntej ntxov. Txhua lub sijhawm mAP txhim kho, qauv raug khaws tseg hauv cov phiaj xwm phiaj xwm. Tom qab kev kawm tiav, aXeleRate tau hloov pauv tus qauv zoo tshaj plaws rau cov qauv tshwj xeeb - koj tuaj yeem xaiv, "tflite", "k210" lossis "edgetpu" raws li tam sim no.

Tam sim no mus rau theem kawg, ua tau tiag tiag khiav peb tus qauv ntawm Sipeed hardware!

Kauj ruam 5: Khiav ntawm Micropython Firmware

Khiav ntawm Micropython Firmware
Khiav ntawm Micropython Firmware

Nws muaj peev xwm ua kom muaj kev cuam tshuam nrog peb cov qauv ntsuas pom nrog C code, tab sis rau qhov yooj yim peb yuav siv Micropython firmware thiab MaixPy IDE hloov chaw.

Rub tawm MaixPy IDE los ntawm no thiab micropython firmware los ntawm no. Koj tuaj yeem siv cov ntawv nab npawb kflash.py los hlawv cov firmware lossis rub tawm cais GUI flash tool ntawm no.

Luam tus qauv.kmodel rau lub hauv paus ntawm daim npav SD thiab ntxig daim npav SD rau hauv Sipeed Maix Bit (lossis lwm yam cuab yeej K210). Xwb, koj tuaj yeem hlawv.kmodel rau lub cuab yeej flash nco. Kuv cov ntawv piv txwv nyeem.kmodel los ntawm lub cim xeeb nyem. Yog tias koj siv daim npav SD, thov hloov kab no

ua haujlwm = kpu.load (0x200000)

rau

ua hauj lwm = kpu.load ("/sd/model.kmodel")

Qhib MaixPy IDE thiab nias lub pob txuas. Qhib raccoon_detector.py tsab ntawv los ntawm piv txwv_scripts/k210/ntes nplaub tshev thiab nias Start khawm. Koj yuav tsum tau pom cov kwj tawm los ntawm lub koob yees duab nrog cov thawv ib ncig … zoo, raccoons. Koj tuaj yeem nce qhov tseeb ntawm tus qauv los ntawm kev muab ntau yam kev qhia ua piv txwv, tab sis nco ntsoov tias nws yog tus qauv zoo nkauj me me (1.9 M) thiab nws yuav muaj teeb meem tshuaj xyuas cov khoom me me (vim kev daws teeb meem qis).

Ib qho ntawm cov lus nug kuv tau txais hauv cov lus rau kuv tsab xov xwm dhau los ntawm kev lees paub cov duab yog yuav xa cov txiaj ntsig tshawb pom dhau UART/I2C mus rau lwm lub cuab yeej txuas nrog Sipeed development boards. Hauv kuv qhov chaw khaws ntaub ntawv github koj yuav tuaj yeem nrhiav lwm qhov piv txwv tsab ntawv, raccoon_detector_uart.py, uas (koj kwv yees nws) tshawb pom raccoons thiab xa cov chaw sib koom ua ke ntawm cov thawv hla UART. Nco ntsoov, cov pins siv rau UART kev sib txuas lus sib txawv ntawm cov laug cam sib txawv, qhov no yog yam koj yuav tsum tau tshuaj xyuas koj tus kheej hauv cov ntaub ntawv.

Kauj Ruam 6: Cov ntsiab lus

Kendryte K210 yog cov khoom tawv rau lub khoos phis tawj lub zeem muag, hloov pauv tau, txawm hais tias tsis muaj lub cim xeeb muaj. Txog tam sim no, hauv kuv cov lus qhia peb tau siv nws siv los lees paub cov khoom siv tshwj xeeb, txheeb xyuas cov khoom siv thiab ua haujlwm qee qhov OpenMV raws lub khoos phis tawj pom kev ua haujlwm. Kuv paub qhov tseeb tias nws tseem tsim nyog rau kev lees paub lub ntsej muag thiab nrog qee qhov tinkering nws yuav tsum muaj peev xwm ua kom pom pom thiab cais cov duab (koj tuaj yeem siv aXeleRate los qhia cov qauv kev faib ua ntu, tab sis kuv tseem tsis tau siv qhov kev pom zoo nrog K210). Xav tias dawb los saib ntawm aXeleRate cov teeb meem chaw cia khoom thiab ua PR yog tias koj xav tias muaj qee qhov kev txhim kho uas koj tuaj yeem pab txhawb!

Nov yog qee cov kab lus kuv siv hauv kev sau ntawv qhia no, saib yog tias koj xav kawm paub ntau ntxiv txog kev txheeb xyuas cov khoom nrog cov leeg neural:

Cov khoom ntsuas lub thawv ntim khoom: nkag siab YOLO, Koj Saib Ib Leeg

Nkag siab YOLO (lej ntau dua)

Cov lus qhia maj mam ua li cas YOLO Lub Hom Phiaj Kev Ua Haujlwm nrog Keras (Ntu 2)

Kev Tshawb Xyuas Lub Sijhawm Tiag nrog YOLO, YOLOv2 thiab tam sim no YOLOv3

Vam tias koj tuaj yeem siv kev paub uas koj muaj tam sim no los tsim qee qhov haujlwm txaus nrog lub zeem muag tshuab! Koj tuaj yeem yuav Sipeed boards ntawm no, lawv yog cov kev xaiv uas pheej yig tshaj rau ML ntawm cov kab ke.

Ntxiv rau kuv ntawm LinkedIn yog tias koj muaj lus nug dab tsi thiab sau npe rau kuv YouTube channel kom tau txais kev ceeb toom txog cov phiaj xwm nthuav dav uas cuam tshuam nrog kev kawm tshuab thiab neeg hlau.

Pom zoo: