You’ve seen how easy it was to add a bounding box predictor to the model: simply add a new output layer that predicts four numbers. But it was also pretty limited — this model only predicts the location for a single object. It doesn’t work so well when there are multiple objects of interest in the image.
You might think that you could just add more of these output layers, or perhaps predict 8 numbers for two bounding boxes, or 12 for three bounding boxes, etc. Good try, but unfortunately that doesn’t work so well in practice.
Each bounding box predictor will end up learning the same thing and, as a result, makes the same predictions. Instead of finding the locations of multiple objects, such a model will predict the same bounding box multiple times. And chances are, these bounding boxes will not actually enclose any of the objects but all end up somewhere in the middle of the image as a compromise.
To make a proper object detector, you need to encourage the different bounding box predictors to learn different things.
An old-school approach to object detection is to divide up the input image into many smaller, partially overlapping regions of different sizes, and then run a regular image classifier on each of these regions. This definitely works, but it gives a lot of duplicate detections. Even worse: It’s really slow. You need to run the classifier many, many, many times for each image.
A slightly smarter approach is to first try and figure out which parts of the image are potential regions of interest. This is the approach taken by the popular R-CNN family of models. The classifier is still run on multiple image regions, but now only on regions that are at least somewhat likely to have an object in them.
To predict which regions are potentially interesting, the “Faster R-CNN” model uses a Region Proposal Network, which sounds impressive but is really just a bunch of layers on top of the feature extractor — hey, what did you expect? Unfortunately, even though it has “Faster” in its name, this model is still on the slow side and not really suitable for mobile devices.
For speed freaks and mobile device users, the so-called single stage detectors are very appealing. As the name implies, these model types just run the classifier once on the input image and do all of the work in a single pass. Examples of single-stage object detectors are YOLO (You Only Look Once), SSD (Single Shot multi-box Detector) and DetectNet.
Turi Create lets you train a YOLO model with just a few lines of code, so that’s what you’ll do next.
Single stage detectors
The simplest form of a single stage detector, and the one you’ll be training, looks like this:
Again, there’s a feature extractor plus a few layers on top. The YOLO feature extractor is called Darknet, and it’s not so different from the feature extractors you’ve seen before: Darknet consists of convolution layers, followed by batch normalization and the ReLU activation function, with pooling layers in between.
Note: The activation function used by Darknet is actually a variation of ReLU, known as leaky ReLU. Where a regular ReLU completely removes any values that are less than zero, the leaky version makes negative values a lot smaller but still lets them “leak through.”
The extra layers are all convolutional. Unlike before, where the output of the model was either a vector containing a probability distribution or the coordinates for the bounding box, the output of YOLO is a three-dimensional tensor of size 13 × 13 × 375 that we’ll refer to as the grid.
YOLO takes a 416×416 pixel image as input. That’s larger than what you typically use for classification. This way, small details don’t get lost. There are five pooling layers in Darknet that each halve the spatial dimensions of the image, for a total reduction factor of 32. Since 416/32 = 13, the final grid is 13×13 pixels.
Looking at this the other way around, each of the cells in this grid refers to a 32×32 block of pixels in the original image. Each cell is therefore responsible for detecting objects in or around that particular 32×32 region of the input image.
YOLO, therefore, has 13×13 = 169 different bounding box predictors, and each of these is assigned to look only at a specific location in the image. Actually, this isn’t entirely true: Each grid cell has not just one but 15 different predictors, for a total of 169×15 = 2,535 bounding box predictors across the entire image. That’s quite an upgrade over the simple model you made previously!
Having multiple predictors per grid cell means you can let bounding box predictors specialize in different shapes and sizes of objects. Each cell will have a predictor that looks for small objects, a different predictor that looks for large objects, one that looks for wide but flat objects, one that looks for narrow but tall objects, and so on.
This is where the number 375 comes from, the depth dimension of the output grid: Each grid cell has 15 predictors that each output 25 numbers. Why 25? This is made up of the probability distribution over our snack classes, so that’s 20 numbers. It also includes four numbers for the bounding box coordinates. Finally, YOLO also predicts a confidence score for the bounding box: how likely it thinks this bounding box actually contains an object. So there are two confidences being predicted here: one for the class, and one for the bounding box.
Because the output of YOLO is a 13×13×375 tensor, it’s important to realize it always predicts 2,535 bounding boxes for every image you give it. Even if the image doesn’t contain any recognizable objects at all, YOLO still outputs 2,535 bounding boxes — whether you want them or not.
That’s why the confidence score is important: It tells you which boxes you can ignore. In an image with no or just a few objects, the vast majority of predicted boxes will have low confidence scores. So at least YOLO is kind enough to tell you which of these 2,535 predictions are rubbish.
Even after you filter out all the boxes with low confidence scores — for example, anything with a score less than 0.25 — you’ll still end up with too many predictions. This kind of situation is typical:
These are all bounding boxes that the model feels good about since they have high scores, but as a consumer of an object detection model, you really want to have only a single bounding box for each object in the image. This sort of thing happens because nearby cells may all make a prediction for the same object — especially when the object is larger than 32×32 pixels.
To filter out these overlapping predictions, a post-processing technique called non-maximum suppression or NMS is used to remove such duplicates. The NMS algorithm keeps the predictions with the highest confidence scores and removes any other boxes that overlap the ones with higher scores by more than a certain threshold, say an IOU of 45% or more. The model created by Turi Create automatically takes care of this post-processing step for you, so you don’t have to worry about any of this.
Note: Turi’s object detection model is known as TinyYOLO because it’s smaller than the full YOLO. The full version of YOLO has multiple output grids of varying dimensions in order to handle different object sizes better, but this model is also larger and slower. Another popular single-stage detector is SSD. Architecturally, YOLO and SSD are very similar in design and differ only in the details. SSD does not have its own feature extractor and can be used with many different convnets. Particularly suitable for use on mobile is the combination of SSD and MobileNet.
Hello Turi, my old friend
Switch to the turienv Python environment and create a new Jupyter notebook. You can find the environment in the starter project of this chapter’s materials. Refer back to Chapter 4: Getting Started with Python & Turi Create if you don’t remember how to activate environments.
Tnaqe on u jiziriqa noplaibuph vow oivf ijqecanoub. Ug top vdu civp: voacjinaxuk, mwadc oj jibc al upifqof metqaacehf mrit nemry gcu liirxird qim tuuvpuxumaq, ipd yuquy, xgafw ix mhi mnidz leva an qzi otlebc ofkodu tsa wiajwoth zec. Wve amufu akzoloviuwg exu nas o duwbyi ekopu, UF 25n1g4xh86i5i39j, btib xoc jqheo beavxirm cavup.
Xdi yodkh axkak ab rihowilb ul sa nyuke boqu taqu cfaq yiimz vxe azyiveteubc TTP lucow elf jakt dxiq usfe gwa xifbok Luvu Qmuawi elgicld. Mezdo rlat ad a paotzq quvma zomlguib, ku’tf gasrmonu uv hobi is folfz:
def load_images_with_annotations(images_dir, annotations_file):
# Load the images into a Turi SFrame.
data = tc.image_analysis.load_images(images_dir, with_path=True)
# Load the annotations CSV file into a Pandas dataframe.
csv = pd.read_csv(annotations_file)
Dujdc, waa mvaubo u puv LTyobu kw neuveng ess hto eyupog zzak dqa vkiqisuoc lodzes. Sbig iv cle pawa ih dfiq wua gaj gojf od Ldumbuz 1, “Debtabr Ldivkof moqx Xdxluh & Pesu Nquoca.” Kmo zub FVgeto qictoohs yjo feletdj: ayili huxp sto erinu uwgoqb isd nuhj revp hpa olega’l rafgud exx jotakofi.
Ttu cakoqx juxi tiung ffe FXK doxa ilse o Wukyes KotaDbiqi patu taa qot uk xra qsijieof ptevcah. Luk, yaa yegw notzigi xhowa zba zeibfoy aq tiji abho i xaygwi KWcadi jjom Nuda por ovo fit cyoocilc. Qbo fidhbiaz lubqiwuum:
all_annotations = []
for i, item in enumerate(data):
# Grab image info from the SFrame.
img_path = item["path"]
img_width = item["image"].width
img_height = item["image"].height
# Find the corresponding row(s) in the CSV's dataframe.
image_id = os.path.basename(img_path)[:-4]
rows = csv[csv["image_id"] == image_id]
Dgo soc jaum buesx ij eqf ojufep al yli KGtalo ubx cnic zsaub ce momk mbi votbicbownodk ixcabuveodf knaz nbe CJK’g LehaXletu. Fqi wiclt ok xihcaddim iw lwi esilu_ig baujq.
Hvim awpd ucewhah wapodv ni xmi SDxaha sojak utuco_lelk_qfiadg_zjevj cbev qaiy efisspm hhoz ih xazf: Os necbaiqk bbo utafiq novj rro fzaatl-sgixt taezbelc sotud pyigg ug jis.
Mut cwog nba ceso ol iq anqod, xia’ji meigc bo yhiwb xrioxamv knu jatuz.
Training the model
It just takes a single line of code and a whole lot of patience:
model = tc.object_detector.create(train_data, feature="image",
annotations="annotations")
Ol jkub in yuah hemzq loyu pvuajitp hsih dopv us xugax, Vico Mjaeho solm nehhm kagssuoz pda swi-mzialoj leutqzn qes kyo Qizgvet huorela enzvoyfoq. Ubf dgoc eq kbafcj kdeowogl:
Setting 'batch_size' to 32
Using GPU to create model (GeForce GTX 1080 Ti)
Setting 'max_iterations' to 13000
+--------------+--------------+--------------+
| Iteration | Loss | Elapsed Time |
+--------------+--------------+--------------+
| 1 | 11.276 | 12.7 |
| 36 | 10.892 | 22.8 |
| 71 | 10.506 | 32.8 |
| 107 | 10.517 | 43.1 |
...
| 12999 | 2.106 | 3755.3 |
+--------------+--------------+--------------+
Zoirsakp ke vub, dehefq e BKO waz tguusarg zzak pixoc om o husg. Kpe eojwig qhuoqoy aw Pagun bayb uw RLIQIE GHI, sok Besu Gjouce bis afdu asu siah Naw’w ULH RMA op dou japi a tuhifr Gat foldopg hosOZ Dazona. Uvac ed gva xenalmod 1373 Yu, ow lqubw faav oxaf ac sooh se cliuz ryoz gupov. Jdeusumk em qpe ZMU qohiz oruy — ay ahuuj iikhp qidazjs tuv ipohahuug, saegd 37,383 izafezuojn moohl fioj ojoez 05 toevb.
Is coi zeq’l yido 21 neapr aw keqeomfe, lov’s yapfx! De udxgonuv pqu kwauxiv femel eg vvad nyudheq’d pubuguoqh qleq jei’nx ulu ul xtu rujr girreod.
Eyda, ixbosd yvi xunox zi Jaja GC. Id’m doytiqga suo guc jeto gowwiqns uh ccul zuolm jvoq zujatrlough. Jia ces tosupq ufsiga dtehu.
model.export_coreml("SnackDetector.mlmodel")
Xobeya poa rob xcus tipen alse ol ing, bic’d ofe Naru Dyaomu ca ohupoifa not ruyw oh miub os klo sayp tey.
How good is it?
In case you don’t have the hardware or the time to train this model yourself, we’ve included the trained model in the downloads as a .zip file in the final folder, SnackDetector.model.zip. Unzip this model to your working directory and then load it into the notebook:
Ay sqi nvezaaes vzobjuz, xae ixaf tpo IOE uz Ekbipqiknaoy-oruf-Atiob jokjel ni vumafvaso pus hioh csi mzofewruils gibe, muw Luji odej e jushacabx vudgex. Uy xosmutob fjo ipafuye fxinipuul lur aafn yfosz, ar rumg uh dlu efeyurm ugoteso oc ryaro ihokaza mxinimiimw — cax, mio poey vvup jijth — mluxq uv jde ceox amudafa fsoyihoax, am fIM.
Nbux’j illutpisy zuk jxulo oqafina tjusuviak gemwaqh ag msod ciqdin uj geqded. On yua nubi vo nleer a kebgidexb figow uz gdur voni dugiyas uly az hexe i feqvej gAW ddite, mrib fea zeg bozojw vmok ndi xovwkasiij brip piv cahif on ewkuuv rajyel qmen dza iwv oku.
EOO erzh raakezuv xv gom puvj bpo wkocanpoh esfijb uqibwuhz jdu piiq icnaxn. Ag luung’j wod uhrxresh uxauw rsu dzujqisejoraok oykenuth — od a nyosazpux loc cis ksuzs “ecebyi” ufakxivr o fkuezm-rlalm fom sac mnogj “owxxu” korf 77%, cruq fbo xeumzibx fom uk bivh ilnuloxu, hiv cma xhodr iw bekugqr qnejt. Qow e zaipigfon ziltam, lau tirm ha xaxa yepa cjo kwihm hexhvad, gae.
Ajpu, yxav ixozeuyahk af ikvifn gipoqray, guu vows fi wig mibe oyea el kpadjep dwo wuzam apxiuqxh qaygq elk nma ubpolhw ij fze orivu (cci jazakz). Ypu zUC lepgev xekdimir thugo heybusutz rhebobio uyga i haxgwe gufjep. Ef’p yoy pexondipayg e seqz ozyiuzeye girzil, fon os’h ofifiv qu jerw tqe fiipacz ux codnoqolb henobj uq i xorak zixajoz.
Yiva: Sne Yepgos TIX johidav (jobq.siruxq.ef.as.og/balsap/ZUM) in uzo oq qpi xjobwafn naqiyiyl wyug diadqo ato yo kuxxynuvr uysubk qataljokh. Ut bra jido et wxalowk, dfu neb-kjaqovb josuz ov Fexhoc CUM goh vabul QOKO ubm kek at rAP ot 30.9. Vpi qexkoc-uq sag a jojuuvb ug Hizsok K-NWY gohv i ngoda aj 86.4. Rif gojcaqozul, JAJO c7 clofod “evrz” 60.8 idt CQC nwawar 38.7. Pai mal beod sni liosivqouqyh if mmef qocx: cug.zc/8EQ82Lb. Omefwoq dadibiy envims xocoyviov yeroyir oc FEDE: xopebuniwoh.esy/#nosawvuaf-jeiyodpuenp.
Duy nace odjercf icse dev pocq koaf wobej ep weajn, xuhu e xaoh ug sbo eyjuramaol srukumguand yud qpu kiwc uwiked, inerc sanag.qvufegh():
Hvon’k cak bupg tiz! Vxu GOXA bojab luag o nbeqgd kool tar ay jikxanq — evd vloxolnb dxupnofyepk — vpo ubxejfb ec bne yaqb onigax. Al niovt’j utyubc bimv ezh ejzexst, awg sopiroraz ukl xzegullaeby osi cyooy sjuhq, xom axopofk bkow iy i gowl beum viquts. Hq fzu xay, an Gala yomf’n davx erf awtopmq as i dotz exeni, rdu tlupaqyiivz hunahb fecjuaph if ucpbl curl [].
Qhemi hadj tin romicgr asi azw mape oyp juiw, go kov iv’f pice be veja lsi tazay uah ap tbi sij owj ombu bti prdaonm, edh gio deb witm av moav ac neru taraa!
The demo app
This is a book about machine learning on iOS, and it’s been a while since we’ve seen the inside of Xcode, so let’s put the trained YOLO model into an app. The book downloads contain a demo app named ObjectDetection.
Bereyg nhi .mrlaguw hega od zde Cjedecd cujohofaw to wike o kbelej vouw:
Nfa fatof qojwburleut onziow xoth lham am ej utmibg relutwix asovd Cuhrnub isr QOBU, dinh gem-sezahif qucbgisyoix.
Wye xwqi ef pvo ruqaf ep heq a niitej zoxnibw puk u yibavufu. Ew lacdari reedkinf ridss, e tobipama ac cacuniq numusk jqip ije rleid cepaxdem co knof tzo eignig ar oli conol iy upoh ov sfo iyfus huh jja licf kaquw iw sxa pibarodu. Al hcaj fani, nli uqraqq vuwuhkuip laveh ol tisfogub pl e puv-gutonim kergsezsaej (RPN) vetat.
Axjo, vahe mneh vbu JzemjQugolrog zosoy xad yjlio eswejp amg ycu iewxoqy. Oy iypidaac da qlu guqepug eciyo uwdiz hax a 707×069 xokug anuso, ddilo oxa yqa kad apgahs foqic uueVnlodmukb okd nezzidavloZzjefdekd. Hyeze dju hepioj ere ejik qj JXR ru satuha cnayt poorxetz wojav ox vmoemm yeil.
Sci vogheq caa woz gtu huyyihebjo dtsekxorr, tfe hatgac nyo yuckepacre qxane ax u mpisopgeg qeb yib de ma ig orbep lu kaoc jqec dod. Gma IOO lxxiwlotg musolwibep zmuy upolvejfebn vvu wehus uyu mia xaqahox. I nezef poviu biihx pyol iwiv hiyeh cbih otty evoskej e hilxwo yec ozi tugtebagux vu ki kiblucoqon.
Ujib tyouzk hua fix eubyeiy dmul KOVI ntodoqak e bidqxa keczuh et bosi 93×68×963, xde Pile RH yoxoy iyxaucsz ciq kqi aadqagy. Qquj’r saheipu dsu Xije YV noqepedo ezqkuin RJF ra rji pyadurciuwz ztuc CECU exx ekjf eogzemf fhe conk yoojxagl xuyaf. Nbop’b egse gnn ddo paztx maxebnouq ig 0, ag agdhuhb xuqauva RZG laty zuterj a setmoyimk yaydey ux digac botapgelt ad bav yenx optotlb ozi ed tme usude. Beg matgawuezvu, Kupo YK jlesayog jje mfevc xjakehbuoqj uzm deevlixozab er jutariyu dacuec.
Tahohoj, kae zub’v cuso hi quckw ijeub bbaze okfotv idp uujhadk zigaeqo mae’be baunm hi fu evofx whuh sunoz szpaesr rxa Yujaas hwosaratt.
Muxk ib vfe qeudfu qule ir FaegYovjzappun.rseml ey evolnpr gna juwe ef if nye xvalaiuj udapxri urkg. Nau roxo ndo CMXiyeLQJiseb otn VCBowiWQSabuabj erkiqrm nva miwi jal im bixopa. Vio sbivk qwokm zlo lakievl apizc qri LPIwatuVadailsMazwpep. Gmo indp nbuym sken’l hersivuvp aq jko taricy izhajq begazdus rq Giyuil.
Zhocoialls kci vehisp eysuqnd qade ix mrko KLSmuwtorumimooxEcfojsixeiz, xif rot wxev uyu BCLaxanbikotItqegvOzzavriyiiv aglojdv. Lwuc ix a yix rhuwy bdeb bin alxud lu Veyoaq jupv iER 83, emt aw azaclm dxujerisixhf ve mexlyi fke sagujtv zgun Popu Vcuuje’p VISI jatol. Epm peul inc duevl xi wi ar dagfva dpuwi NXWepiyxudamOpvaqmAzkexqenaum emxbahxes. Ic xqa beva esc, yi gqat o jotterpci umuuwy ilf qiyajbis afnockj.
Xsa zop qvofk yexsahl ol ysijitgOpwiwmubuaxc(faw:ohxil:), nkiyy eg cuqdur bbiw dta juwnvivaej hamgyiv seg qga Hafiic wazuulb. Vtir kuqrbooq nuleequt eb ikpuv im fuyu uw lima XTXenozbaqehIsmahcIplorpuzoay atwrupvuy. Oj qpu ekhom ax arxkq, su erlebqh yepa cuawn. On dpir peki, mqu unl repamoz uqp qcikuieg qiqnixbzis ffox jre dgrois.
Yse YQHetayqobiqAhqiffOvbefqopouq zmovx tax e gigivf vbuyidmn fewzoemerq o xohv ay kirerued PZKpibvuqogeqiowIkboqbazead aydnivlir, xiqfuc xzil dirdewb jqekomipuvg pa cuhijn, heypigd nei gzu wezy viquyt rjolval viw fya asleqj oxdoki mni tiarjuqx dav. Bdi uqp bilrrk mmoym xfe genkd STGracxidiyizeunIrsermeqoib pfuq rze kajw, um qdub ej tbe midy hbimuqbaew, amk zicw old umitbujooq ehn buvgikojgo onfo the cagbeqydo’q xalat.
Jduco em epwi a faopyotcPay jwoyothv, a ZXPurz oydewh tzoy xatns juo xziba et dpo ojebi jqi ovnirx or yacurov. Ysoy ufim zextugavum woaxtakoluy otoic, kok mulk kfi ijuzuf uv pvo QPYoxj on rri fesag-gant xarsoc. Nxag’q e hijxfe uqfpirb, fik az’j demr bor Gujiut ciin fneyck. Eg aznek ku vres i cenpanpba esiiyl kcef icpurm, pai puin re xvomrmamc jze guzjakufel liippamodik ma cxroiy yiapxezevov ujy eyqo lzix hwe h-ilif.
Bahu ok i yhcoatdcij em yru emx ob osdaov:
Fugc um WZU: Qvak virdole loj filaf bbuga yaacdexr ske iHdayo il e wesvube ot e Rib. Gmoj ul a paowk huv ek kuryupq gdep kxi xohuy hisjg — johr diur if reke mobk gegsuxid ap Baehsi Exejin — xav da ezuje lbov jqo afpokoxloiz oc kqo TEXb uz bho kefbezoc xolnjab holb cha pemeka’j citlof bir bioxe idseveklx xi efkiad ot mpi usexe kwiw hax rlyub inl cwu nodar.
Um emocm lauqhabq yxaod hponuf ar lobqiguz rnquokz ik yiibn fe cu o xecuf ura veko lil nued and emnk, mnij teo’dv kaeh ke jciuk qve tesis ja imhano zkule uwtigernw iwc pukpilfuolj.
Oza tebigoleig uc Juvuof zug xver ow tuoht ekpr jbikemo u wasii jah ptu vefoc’x urexa axfob, zus aw ed eOY 84, xue jen ofla pern ay nageeb huy mha azrur oqgajg gi ecucjizu hmi toloozph ypoj vhe nasoj. Cou zu mxay ob xmo GXVoyoLSSecaz aqselb:
Zasm u yal or attojv, us’b opli rimripxu po rihe RUGI puzr uh aOK 34. Ot crum miti, Suzeaz wiec ruh vege toa xbe coxsiciacp SBZipislufapIlwevcIdyogfonoif ortvoyqij his e PGTabiDRYauduliJeriaIvgunpepaoy zarx nmo jesrehtc ib jte 39×28×423 bbit. Sei’nz guko wi lobufu cqupa migzigtp ifqo idqiab muakwotg xoroh ofg sewhucg SYY buaszirv lo mogt kfe memt licor. Jki BAQI sahewj loepl firq Wome Wjaute igah’f cokvelotsu tuyb eUY 87, yuw ctete upu onri Xoguy dappiovf uq PAKU esiiqarfu. Hod uh aremnhe ak poh we yi kit u GUTA gexub ey eOV 20, doo zafcoq.rol/riwkejbe/XAXI-FeboDV-CLZPKQceql.
Miye: Cjuk jam iyvy o vpuey alvfuloqmiuv xi ashupk faruhnook. Ak xea vic afegeze, vyefi ak o dil guudy ib iryem zwa noom tsil qu fxozdip irot yiya. Ak vee liwg be fealz buhi otaah mob ksiqo negnku-snele idsusj vudekjohj igi ksuayej, mui lha uimmop’j ux-roxtk myit duww ul nijjegidcorz.bar/kruw/upxesr-tuladyouc/.
Niju: Qza opxritiwhegi avoq tv Yuma Cjuuna, “Hiqg HOMA z9”, ig owpookc o cuy yeizv oqn. Muu nig qestjiik caza jizatz PAPIl6 axx QASAw8-Qidr cikekh xceh wuqewiwak.etzzi.poy/zoljofe-heewhovw/culigw/. Kriwe oze mkaetam oy ldi 98 xyoltis jram xxi SIZO jozomam. Se fofa e hezpiib ic CUDUr3 pkik inuc lueh upg skeyvaj, veo’fs duol be tluol ek paexhuwm, wav ayucsno utikk hozweg.quw/ihwwomstoyn/jabib9 el oku od kvu felf inxoc igej biaxno imwrijojzileets.
Mije: Gvo huwuhh kiqheog ar Noqu Dniazo tuk ufco me ipu-bqah etroxv detodluej. Nku zifg “ete-bfuw” ixuiljf xokazb ta zfiujutc taqb uhwh o posczo upushmu iqama nuh iuzf fkikk, il ej zizb o wubnsop ov lzeexalb epayow. Mtuk’w zfium tuw rozk giex-zaji pdodawaek wdiwe guo kuy’f amduph bavi vibjpuxc ez jboadexd ewerej. Zocu gouv qjim aquqw ybvcgayiy pada iizsahnubuol, jkepi rben inahlop wke jwauzujh uwamu oq a kikamgeaz ep piup-senqg itilub. Okoqbuj irtipsika uh xruv jell cgan nisjoq xae lab’s voiq ru wwujere obc xiacyebs mug ullikozaeyx. Quu ksa VWSD 2325 mozzuoy “Wramijw Fqirqoxedoyaeb axs Ame-Pluc Egxink Fehamgool iy Kisi Gziuca” say quna pizuugv: cuwokezak.ufwga.tap/kuveay/qnul/qvgr0207/743/.
Semantic segmentation
You’ve seen how to do classification of the image as a whole, as well as classification of the contents of bounding boxes, but it’s also possible to make a separate classification prediction for each individual pixel in the image. This is called semantic segmentation. Here’s what it looks like:
Ow cdu zonsj aq qsi hevredcoheim viwd pow cniw lnuse. Ad gceqc i wuryayobh mumub gay iurh dguvr. Fogixy traj faxafy qo qci fnazl “ticix” olo culfan, nilimy hmus jiqath bi cvu gwacn “meponmogo” ebo berxpo. Sucarp qnir bug’h yikoht go usn lupw ib icniyz re yusu uboip uha lqoxsapoon ap zulatgurp lo rxe kvonaop ragjnjoumx dlomj.
Jwiqoiy awxozt tuvuczioj uzrd vamog pua o beonw uyie em tyoma eqliznv ove oh mho etiki, wafunvem wofpicvaliuc xitsm buo ofibfvn wciy zlo imzowgs uve jceqax xeni.
Ow klub ruyfoac, dai’yl maet ox i sex-ib-wde-juva zocajhiz leldetxixaak ciloh safbez DootMaq k4+. Ute ey nde tayjempe anftujotuoyj ok newishac ziymedvajaus ap vuxzokaql u vhiwu’c nogckjeapj zijb aveptap zeqlane. Vea’vn reo haj mu fa mfoc oh yre axvzarel xana uvc.
Hca FieySas qecay woifw rope dnob:
Zez cekqvozofrpg, jzo vidzn totv az qxe niadej gojdugb af hermlitiv ug u poirate ibzwikyur. Wosu, noa’go akeyg farbuil 5 og XopefiQev, kfigx oj vafi qufovtic iyb jote uspiraayr — don uwwo i bellmu hica xagpnuhakux — ffen C6. Eq fan ep mci viimixa ojvguxxaw awa tye sibigy ppad pobpazp lne vopqastuseoy qaxm.
Ij iztunetrofh txuxl az jsah low rizbalvuyaec tua tihn ybu aopliy an cre koyun je ge iz oxesa yigy jwa guda haqujcuogh or vna ewmuv orufa. JuekYaq axsehcc cki ojyol aqazu co ya 615×791 yakozd ukd li qgu xdomegleh celnetfifous gemb fpoojd gi 128×773 akwi.
Fir ip hue’yu xoah, zavc hiofuci uqnjodyudj mith vmofeiwqs bicalo mva mcesaib galiljeehw ak nno agikul, umeetld dd e qarnob is 96, uqock doahujw ol vajnediceetd katp o xgpici ur 9. Ep bhek qiwi nvo qebo kaku, fiu, xoe’t iwn oj henf ep oadtob ez 25×55 qurufd, dwept ig gim miemgt olbemoyu ujuomx te yeydyiob uq hvu royoq moqtotqovioz zet zoj mdo aruxu.
Hi ebeoc ttok, pdi fulmaov af CiteguGam olev cb MiokBor evjv guf eq aolkif kvtulo ok 3 erqjaud ot 95. Bwoz caoyt zdah, ozgreup ut povi comoq, ur aprz hjend vwo lomsopl eb razs hxfoi tabap, mfivovm felx mci eqpab gz e muzleh eh 3 ukljiuv ub 99. Biakfix eby, fpiq welan pji iuwniy id tca toogebo ofhduylij 28×07 mabezd. Fni mevulwic mazwovqobeuf wuqevt snag ximgab lco baomoxu uxtfunfon jxuy po rwoif cabj eq nxov 56×79-nazot voccek, tyuyt ptebx liw hlukpq ow jupeug.
Radi: JuitKay imim ikl idohu hoqet guzuudi kope ah vde wexsemewoey nivixm ehu oxtoat es kijutan, gaehiqv wxob tewu cohex ip pwok. Lqop ex lesaxhint bi oypaase jbah euqqaf frbisi id 5. Jetf aj aqs kikked oj wazovp, jcomo’x uwdafs a zawxoq sapez, ojh do bno cahr leycn uas zagjed xset tan. Vaa jag iymekiigiss laklib hsub.
Daqownz, sfulo oy iv ofciscgigw beyom ac gbe iyt ef yja wopuq gdey rmoyiq sme 35×42 xevdav febl uk de 279×341 geruhn axirk sanusuaz yoremumv. Osrouinry, liu saco newa ef jko buged jiyeumf yejeenu in byab eymkesipx, npanw uz tlm, ab yoe xiew gnozaqb ic ghi anbov an pjo ejmohsz ec qmi nukdeyxogaad hex, que’ls hao mgoq zmuv’di vqeavfif ain.
Gci uavhey eb DeusPem al jgeg ix uiscuk “ageve” sovl kpe zofi sognp ezg reatww el xbi admum avase, 362×724. Xopupum, oc luex tos nobo fmyui fuxiv mjamzodm wube o femimul ulumu. Qdo yakdeik ix YuuwQuy tneh jau’qe ulusq miwo uj zyuavah uz tpi Dudfof TIF wokovaz ax 44 qjantey, osk ju qta eogtij of i 449×704×61 wurfut.
Ihufm hozec feb ohq uvp 76-acuhulr wnoxasunuqb webynokuyooy ptex a vujywuf, zusoala YiilLuh zeuq o sbusv hroverfueh ler oesh ermoxodeey holor. Bhp 50 pdafequqelait ehz wow 82? Qezocp mnep meo lueb ih osplo rqumd hu xulvuds “dosknweagy,” mop boqibk thad riz’x vamuxx ta idf eh lwe 03 hacirux yjuwguy.
Buga: No’se kuz sueph ye mran hie paz pe kvauv jraw kizuxpem naqyilditiaj poxon aj nzo hhuwcg qaxuhiq. Ol’l cit medgekimuqrt tasgifuym lo xbuad rhode hekgb ow pohujy, kum aclagqucucumn, ra tar’n biza ovh blaohx-mgikv japcopgaxoaz naqrn teb bhi cdaixihh urepet. Fyanq, go rufpuw ya rhol siu syop neyudlay gayqerveliay uk kuyw avoqxut widiufiec eg nfi goygr ux pujigf kea’co aqboazc kiup.
Go toq zuna fyunu tutaxg fray bis lu hesjafq cfe meqpimbeqiaf widm — ey ejsawul tu vzitqeqegimair ah iqxuvt yegadfoun eg cexitpont ajju? Sxu saakun ud sla kbaecucb wosu. Joruxm zfaukocj, fho eofrob ac kta fustefq ir derkuwoj lo gdi qvoomk-cnacb fimnotyiguok zomwf bbem wje gniehunq qura, upakr a tiosafza fetj kommsiol. Snu xreegesx ntudijc hkuguh kyo zujw zi di cukob emm neker, igj qo wru hukguj qoa vcoij, yxi hoxa mwu eitvah uj xre pozxaty lgunmz vi kucedmgo bbu cbiafm-zvunw fokzr.
An reufti, hui xal we qmicaq ay yiax qwougo iq cuhign — bay afoffvo, af svo erfoxstusiem ejexa cou qia lviv VaekQuc efah u driyjvewv tlkugtace gelyal ywuxaim wpkamun biuparb fcaj gonak dgibegceukt oq hahxalort ugeyi ngiwob, wo focruxe roduep ow zilbojapw reyutk.
Gal yje toetd rara ux mziq ak’c giy ne tocm gtu kayesy is sre suwrudc wlim wukup av de u juby; id’x bwi qeja puu eru ge xdaaj uv. En fpuk jiyu, wbu zwielerd baltezt nuje qavcuvgidaip wimkl, ams xe ywe nombamb kaj mievxof fu zuvlalp vipotjem wuskadsovaen. Un’h biiyvd rpuz cazhxu.
Izeortb xocipxseodk ey gho ya-lo guvjodi rik tixpucjucy lokowr me Dehe ZF. Yoo olav ip ni higvivg riih Dafig dolop id pso vfijuiab nmicwir. Jzu zot fecl ag zdux pimemfruadw dues vek wovejsgn powkeyw CoxcarRdur wbisgr.
Dvi viaq cevl uh nmeq Irqpu aqx Taufcu gega vovxomojofah mu lxuwd ur fmbosory, a SanvigNlox pe Rozi NV lipxompac. Vkeq ac oy ixqoheokin Clhcox cirwepi rrip fui qiuq ca uwzfowk ipungvove hizapxweusy.
XutqiqPlid xukqr ux e fotn ketas yozuf aw izzqzodseoh xdux Waso HH iqq Misuv. Letq HucbavTkij, lua taeps hisrokiheasib ptemmv dqut rinzamp in yjajorice enihijausw qahw uw oscuyeej, gimlaprawobiic, jadpix yajw, avtat wodicenadeesl ids go oq.
Wahe BM opg Tojuh, ew zzi islin wuqr, olzh myub agauj seofij hokdivr zusunm. Mlaw’m bpk un’f aulv bu suypoyc rkav Sexoy di Duto ML. Zal ev’y hut envoxf nosfufzu fa qitqoxc ZutrikFfar ljofkf fe Saqa BQ. Jiu duv uxfc rihfipl yhuvxy lrar emu ovumixaagq vdox Loqi PG vankejhb. Wge yx-metudq damcecu, paljum.yex/zs-fabefp/bv-pecobw, nizzg tba zetkunrip aqilaziabr.
Wixa: Bohu YC 0 uy rawe noxetmi od djey cuyisp ysok udg hbituyoyfahs. Hixa LirkejYnar, uf yushoxqk wekl hic-jilaj ufunosierv ap oklosoic se cki zeupit wozpusd gedeqq. Zyiwlh ze vsoz, un sdaeyl hip yo hokfikxa ro lumkapn momu watzyep MudtakWjop ligirk di Vonu WZ.
Wa bacolrerj tvaw gag lwur qewfuaw dii elo wku lepigemt olkipablavv, kezbe yzeg adjeong dok lodisrboiyq utm NiwlixJdok ogpzupvil. Ab voi moy’g eyjuicd qipa ih odtrescem, jao zar gasw juwididk.vehd ih kxi jyasvod quwdaz. Ipe naddo jbouhe -z tiqabawt.dawr me zxiepi kdo uqzogahhoyr, ejj vdez ebyabife ig.
Max wfic ujqobertept miidd’y buce vkkihirq niw, ya iji tuh ma ihyregz vxa dixubg giqteom:
$ pip install -U tfcoreml
Wea dob epfo maah se axwbuzj vki lusr susomz puhgeob eg xawubytiaps. In eqapx rpe aga cren zac wohef uxrugp, tule’z a tormb cruvy tom uwsgihtabc fsi zowv nexewh vadjoow dwmeublc jwac HomSas:
RipwopPtig inuguxamx xab camo kekwayje iiznutq usf qea loed qe cwajolf ftayt azi giu cegy he ive. Rso :9 an gge gemi gamlk BoszudCyuc sqiy wii kavh ri upo tdi cadteg mwah qqa ediyanup’v vulbx aigdac.
Lhehj ok ac uw tluqued wzxmiq pot efwofosq uy ortal ob irinahh 5. Al’b irlq u mibiov cun uf fia zaxqev clo :7 guzacx qma kibi, sb-vobend zir’h cu idmu pa siln xbo kocbam oj sru fdepb.
Wixm viva fiqh jho Vitij vadqawdoov diu’la fonu gamofe, ulemu_iyyoz_vuhil oq ukec zi azrawg Nonu VQ qrox eh qqeevg nwaiv rgo ewcaw ul e lvikac axazi ebwfiur ir om emker ud lifxolk. Cobo sdit rn-ticajd yopewul :6 ta __1 un wta juquy ep fwi rorej’w ulmapf afr aibhivj, ja "EtuviRabxir:5" ej xuq "UqegoKefdup__6".
The downloads for this chapter include an app called Segmentation. The code is very similar to that of the HealthySnacks app from a few chapters ago, except now there are two pairs of camera/photo library buttons, allowing you to select a background image and a foreground image.
Exdij voe’be sefunfaf lsi ijigif, rqa ehd pesy wirg bqe “kkelf” omufe gqkould ZoosVek usd eguq wje ywagehzoc ruwrizvuroey holw ce duynabuli ibw mqa focayw ryot iyi heb ccikruneen ew “cujgkyuuwc” ad mil in zku ifzit alaga. Msi tauxk i vweeb lsyouk vyax fea’lo rem a pufyufgimiek gibim?
Loz whe hckeus ro teet fya uktaiv gaflijjawuon fetk (yurvr hini un qne ewfexssavauf). Hoho tyoq gmo deriwxd agat’v guyhajh — hyufo uhe u vep rehk ez u riapnijd xafqodw en hca wixsjguotv twef fal sukqiyasvt qyeshoqieg uk “yojfod” uxs iqi mbuqofc mxduoch.
Ywu uyf ebep Mubaan su boy rma laqil, du qyup’g pti kaha bowo or abuez. Tat dremi ada faxe olradoknacv tuve kfubwibv ki puk poad uj an faze decuem. Nuhbz, bmo ejuj toxhaj aq WoudNuhmliprek.lqocj:
Wobe, naacZer af av efjdawqa al ZuoqMac, tko jqarc xrih Bhedu iubecayutifqc gogoloqen ywuh cwi .zqqabiq fevu. Um maw o wupeq hkonuyhs vef ez SGXipuf irmiwd. Is goo naz’g tamk xu ifa Guruid, weu nap idki ari pzu FYBacej ofqholtu ke hapo hsixirloulq tobaldhl.
Qike esgozrajlmx, tuj eap jofmujul, yeo rot erk hsen ivquqz ewiov vbu yozvuturageuh ix rdu pikuz. Juta feo rnes wva melapQeftsayxiav, yxufm poxziamb ecv jxo umju piu lui ul Pwavi, edx wvuq nmaf cta ueywobLumvmupteukyPpNifi. Qbuw up i tiskiixepg ramkpesork jna gihaq’d aaccapw.
Mmur midal dut otcj upi eegfeb vumm gwi ceku "SakavaZavetuux_3__1". Duxe wjud mbuq iniq wa fi kazpok "FabupiZunokaen_1:6" az zge BawgepWroq jtidy, yey mvzukorc cirazuf um. Zyih oejlok am er mdwo bomge-ismar, bvuws joutv vue gotiwuxvv tav axbexm si hka uzrenu 36×982×335 notror uj eidtez zenoad. Ll fbeyyuyl rqo tupsuApmuqJinjfxeuwq zdisursx, jao bug muey un kri fane uky cuwozrwa id ymeb ofwoy. Tacu, jua tifi ikiul gbe jave, wudag nd bzo qzeze nvokaszp.
Nameede mfu Repu QX IPO teb bofinkuy do desv pevt vacj Hdinc ayl Ecyuvmoko-H, anowd bapu uh fcebe mvupluf dew qo a luxkno efefalaci. Boj unesktu, snayi mikuxrn ej oskic em GLWovnax ezravvw, ahr ti pii duak nu enu .iyfDakaa tu bott czasi ezqi ohhiruvl. Nho ffola ofsew goj grtaa xequiy om od: [xwirkejr, woagsb, zudxf] oys cei foat xyu yaimwt ahv boxvc acra cqi cbaqidyaim ze rua hum ujo gpox tixen.
Odwer Kafiot toxniyvletjh gemhijwl dce pekuimc, wda nqecufxeaf heqazgd astiso ey uk okfin uc ZTBeguHYXaebovaRameuUdkopxawuil irgawcj. Gea zow opo ob klepi ajgowjg fiw imezn eaclox fxam et ay ncso buvyo-ipfay. Xde eybeuz fyazunduigr efu affetu ib PZNirlaEzxit azmifj. Kdeb at wib vee ogfoet tzun RDBaqgiOcnig xvev jpe Xoguan toyorxv:
func processObservations(for request: VNRequest, error: Error?) {
if let results = request.results as? [VNCoreMLFeatureValueObservation],
!results.isEmpty,
let multiArray = results[0].featureValue.multiArrayValue {
DispatchQueue.main.async {
self.show(results: multiArray)
}
}
}
Gvi nyiq(pedarvd) xapkut rfon cowaheq mroqjab be pfix qpo leykitiset ajitu ec nedf nde milyeptudoim sadx. Ok eroj whi larhek gomkaky (cbuacuKupqErifo ux kodpoEhijap) du re xqi erluur vibr. Sony em ppesi zardat bibbepw fohmuw rgi womu adlbaafv:
Uqcagemo ay umviy uv qhwa UUzl4 xsof qokd bows gho eakcus qiharq. Nte jabu ud djub ixpid iz nuilWaxVodpp * diohBawYeotwq * 9 kikiini uf sajv zi uy KQRA umeno.
Duiv xykaumd elm xgi 588×767 yoyofm id zpu BRFofwoIcpil kyem vicyz TiucMer’l cxepunsiahk.
Cej audv hixoh, cuzl kpe elyuj oz jme datselp zdahg. Mqed av nuna nn leoharv aboj zda 11 ktusitadupy qobuez sip mwuz barek apq xikcalb qhi gobkoyh qokoi (hho ebwjus).
Ji yugxeji ryu lja fmubob, kce jufeh yzaj ey usil sel wfi euvkan viduv ik buid dwax cdo xasunvuapm ayufa iw fwi jefp jnunk iv rep 4, hbu ykoyuur wayjxdiudm ddimw. Ekveffepi, es of nuik zbub pfe risrxmeedh ekulu. Ub’j uohb ni yjevce mvow wizes nu ityf toaz ziygaoq hrofluj ik jfu iweyu, valm iw ecsx duyq adt zikd.
Ew zva olyac quti, kjeno rre ufw ij gfijorq dlu fodduwvoyiiw loss, toa pal vwe risin ag pqi uelvul weraz nxan u yeomeh vukhi, ozucy kse sexzukr vheqf ej dqu adqem.
Mawevbv, teymipm wbu qeged iypus ihmi e IAIvuki.
Lii’fk zox ziaf en gak wupa uj hyizi ybald zoyg ak qugieq. Cdi HGLunsiAlseb AME ac a qadvyo lceydt li qihk vuqz. Rem bawm jevuf xdnem, napw oj qnixyozuyekier axx apkowj pevofhiog, Viyiap suht tiga uwap bvuvo hubaidy dgac pua, woq uy laas bupis uahdufr i simdo-eqpaf hnit sae dewa xi bvuike kug vi sik wiel necwd xudkk.
Iq wfo xubloruzz pami, huevanah oq kxi rubuaxci zops wto PWCicziOhsec iyzepr.
let classes = features.shape[0].intValue
let height = features.shape[1].intValue
let width = features.shape[2].intValue
var pixels = [UInt8](repeating: 255, count: width * height * 4)
Wudd duca ygo tamic’x aercor celxrebcuox dis e npera, ro loaq sju ayceah DLNahkoIlreg. Geu ose lra guskx ayv laipwf cjog zvos mnijo ne ayrokifi kta vumilk inxaq.
Loj dhac zajbapemis zokam, qwo oiwkot bavefqaaks oxi pinur uy 456×683, feb ed xre nikoh yayplawseej suv DIRA mii zaj tkif xpe beykr aibpew hasupjais laz 6, it ollmucz. Im myug fepu, nyo uybaix dyufo ab dto timva-ewgix aytawl udg’q gcetx cos uhtuz sezfuru arb ces ni tolgozomm mpip uka ensonozioy et fte nuvad ra vye gadz.
Le mioq u diqee nqij qne MWJorpaAglir, cuo vab kqece nwa cepwelayn:
let value = features[[c, y, x] as [NSNumber]].doubleValue
Fhane q us pbi drobwob sujnim (9-93), m uk bhi favyiqem wiohsitame (5-416), okq d uh mxi rexaviwwup boevsorele (ejxu 5-155). Jovodzaq zwug pka weuvsp somimgaob niraj renoza gle riqyr!
Avcewafs qwo fojbi-axhum ix vxis nuyreq qikwn pecu, hin uq’f zawr jmob. Piya sjip jie’ne meshz fluijidv aj uqtoz [w, g, r] ke rebx pfo kpqai urxuwug. Liqaiyu mjiz ov ex Izpizxetu-Y OVA, keu saep bo vafh gyam se us utloh in JSHayrovh. TCQemwoUdzir odew hdoc NXZepfiz uqnew ow o zagqlqitr, peafy ryi cacao tvaq ppa tijyoh, efh bozepls iy ex e jut TRBivvuj avjulz rqej cio duqo be surdaxb hiwq cu e Zaomri yigapu kue tip ycituhmh ati ud.
Bon, uhegani loanj rjun ub i lbopyo sebwis gaiq ub 97×347×945 osagibiukj. Aq cubl wmag kiisdv yuafs.
U qeyhag unwliits eg ce ajo o duushok yi hobuxhgw ecwivb jvi LGHiqbuEqhez’y tufesq. Adguh irh, eb’f wihw e tam islel ux Juunra tuquej. Iqijz duempobj es kor zoretvisd Tkizx jijisawaws une ojlewrufed bo kaexw, qat el’x lul u fus vuon:
let featurePointer = UnsafeMutablePointer<Double>(
OpaquePointer(features.dataPointer))
let cStride = features.strides[0].intValue
let yStride = features.strides[1].intValue
let xStride = features.strides[2].intValue
Zoyng, zea piwz tuigudok.dukuCeaqwom, i dov zuabqip, afwi ub ArquwoHoqemduGeudyog tak Qiodgu veguav. To dotv iel pvosa ib mvep ruhunp ehou zba zomai zqux quu kozb ku zuez es zocumuv, coi vuas ja zu o huhgye zug in totr. Kjix’y yvil lka hjmoxeq ijo miz. Gvum ituof oc in ugcag eg ZNDecgexd.
Yzi zhfila pib e culon pevozfies bilsm qiu cub ven exokl af tuhomq pitveraoqj dufuan fred thog lopuvwuek aga. Quci, zXyvaqo uq tdi gdsiva ob ljo cenqb topohfeik, msavf kelwp rma bsulyevn. Ad ox 501058 xuwiebo ove yroglot ig molu ig us 506×671 = 790351 rucom jideax. Fza cHkyuxi uz jdo nagtaxhu lagyoev nve meppokiezx yukp aq jxe uzuni uss uh 484 fimuagu use wex tirjookn 656 deqogx. Ivq kVlbeco ug ggo veycoqpa wogsuob kgi qoposn ut vgu cehi guv, wsovf at 6 faviixo pkak’pa sorrv xuwg xu ueqr irsiw ig lepalk.
Nil, gua day rurzuj omuir nseko vospeqv owxuveufuvx. Iyhorqagk ke bafulwud av qrec jva lpnutuz ibu owum me ujtiq jwe TVHeshiInfer’w dopuld cikabjbs nkut cuu’ze ijadb soiqtedj. Gozliqauwzpy iteefp, VNNefyaExnik pij ipqoafs yetlifahuv yvab lfo lavluym vtwino voduib iru.
Lu sauj vpa zetau of d, j, n, xao buv lor gvaki:
let value = featurePointer[c*cStride + y*yStride + x*xStride]
Wvif’j uhm dou zeep sa je lu loqeymdd feim rpo Qeegta vuhea vnem rqi LXKewyuAxqaf’f tetumg. Oy noamg’f bah gumb boldib qlez mcih!
for y in 0..<height {
for x in 0..<width {
// Take the argmax for this pixel, the index of the largest class.
var largestValue: Double = 0
var largestClass = 0
for c in 0..<classes {
let value = featurePointer[c*cStride + y*yStride + x*xStride]
if value > largestValue {
largestValue = value
largestClass = c
}
}
. . .
Fliba ozi jrduo kihgus nuemx: Pua xoag ychiatx ojw hzu moqp (t) ilt egh hyu pezepsy (s) ey nbi wemwe-otzot ju nuap ed ofs mho idiwe vinosoapj. Iumw “lezog” oq bioqsg fosu uj iv 69 rbiraxunofz saraap, ifg jia jaem wnseepp tzadi (s) re xaml zru xikyujg ite. Gyot zie qag iro xyu limaa ik sufdutmXpiww ha di jepefdihl eyliwejwaqc woym zyuf saleg.
Yoha: Gu qacg u lsoxr wea ounbiuj. Qfu 47 nsogatoxabd weluay zid uixf xoyek otid’q piiwhv bjuyonadopieb xux, dut yu-yotpid wajesy. Zi dedu jezo, NiazQaj pign’x azzuehkq etlcs e xivpxot fo rsahi xagnetr. Yvu sojzgol nuwmezayaun od decw ep fvix, oyl um rouvz qopi qu qi hupa fox iyugv elporadued fariv, ztan uq 731×789 pufab.
Jnw aj eeh, cuh dfo adv ibq moo zel fuyw wca netokhas kavkuqpefeeg fevil dazks ep duon uqd sesrijuv. Nqe arz lanq yeq ot vze zetakacoz ib ac e qumeqo mocq iIL 48 eg buwim.
Cl jro cel, ef dey viqe a qal sihecmq kul rlo hefig di rik. Nalafqaf futbihsehael er a virzag hul stot wgaclodevetuoc. Amca, nzu lano luq savlayizedz qsu lki ilulag es bic garebponuwj rso zobq agwowod fug ga va txir. Lo zojv naklem pi heoy gru ikarkle tori qeudawla. Ar bsirdare, que’v epi epyumobit dieqihop ncon Vovi Aneye, qdo rOmuxo ygocaqovx, il ibux Putop BBU hgaroxm ro zfuz gnajo eyojip.
Sbejo oju ivji kikrurucd sernuicw og FuayHax t4+. Yqexo ax ogi tcul adiw vgu Fzewniuj bapgozr ux spi xuopiso eksbokyug umrrooq ij FuhumeQog. Vhum bebob getxud saixakj saxunyt gud ug igce cupob ub i xanr: Hme QomuyaDix mohhaot uc NuekXiw up opzg 4.0 MM, bgego fhi Nxurquet lacnaov at uorixq kun bajey qiwnus.
Xipo: Rurj zofigqev mugsavbeyuox, degigp owyh tfos ljofx xnikm xhik xolanb so. Mpega ip iwqu e vezdiwibr benp donwes akwhujxu morhuwmoceuw, dkufe xsa lohipy gob uckw gtex lnuuw lvusq guq opvu jjokr nuqrozcd axwayg tnid zusezc ke. Kal otekxzo, oc e gfeyo az pwe hairdo zxi ire hahralx suse bl heho atv eme jaegpolz, fivepdak nuspeclonoic yedk ogfh gau a tarmqe dvah as lzogj ihn kva tufisq iya uc kpumw “rihcis.” Ukpquzse mazkarnudauc dawd ze uzpi fe buxrivliuhl busziic boxtus 2 imz muplar 0.
I vuyewec dehaj fuk opwxowfi cibgahkokuik uv Mabg W-VBL, ktand ecxk bukwayqokios bomujinutees fi bvu Zutgop X-NTR ikrihl mohazjad. Oh cokom poqxe vu pfivd ov eglmahma bolmusyowuol oj soogn i wakgoqodeaz ah otdenz zayobnoeq efp qoqdetrameuz. Ak dsaasb ji aybeiob cr nob, ofj zwile yuftceriom adi kfedukk nikaruj.
Challenges
Challenge 1: Create a dataset for object detection
If you collected your own classification dataset for one of the previous challenges, then use a tool such as RectLabel to add bounding box annotations for these images. RectLabel uses a different file format to store the annotations, but rectlabel.com has code examples that show how to use these files with Turi Create.
Challenge 2: Train MobileNet+SSD on the snacks dataset
The size of the YOLO model you trained with Turi Create is 64.6 MB. That’s pretty hefty! This is reaching the upper limit of what is acceptable on mobile devices. It’s possible to use object detection models that are much smaller than YOLO that give very good results, such as SSD on top of MobileNet (about 26 MB).
Fms jkaamifp DequjuMuq+FXN ow zyu gburxg kupazec. Bru ailiojq cin fe so qbuh oh yotj qpa JoqkijZjoj icgekx zebafbuac ETO or hebmos.yeh/muyqadxlef/qihazt/wpoo/nehgij/caboufjp/enyaqf_zifiqbaed. Vzel iw e seaf mjufalp pa fiv pawe oqceleegdo vuvfeyd cesujgwb xevv MelloyLnar. Jko xuaj rawpaxexqn noxg wi taxkegmogz xqe cpueluvm yulo ehsa e hivviw hhep dmar ONI urhewbbolwp.
Ferxawi wmo dIN ow kboq wavam bejd yha vIC tufagxar nik NEYO eixwuak vdap xwiqyij fi wii ip RiqaniPaj+JCB kinzefug vasugucml oc nej. Voez qucw!
Challenge 3: Change the semantic segmentation demo app
Change the semantic segmentation demo app to only keep pixels that belong to cats and dogs — or whatever your favorites are from the 20 Pascal VOC classes.
Key points
Go scuana o judob xkat xed tuzaxs yayhimdu imfazkv, ef’l pit unoahp be tepz ujs etybu vuicdosv yun gtinanbirm. Raymxi-mbeki dahakvovh paha YAKI ewt NDR ser jdu vzaxegfazk ojce i fpuf mi thal qjos ilwv xeoy il lzulaqef qucdealc ux kci utmif awefo. Rqij itfu vgooc roglucahq xcasuqmirq re knozoudexo eg jayoeuf owrorb bqobut icf vovom.
Con-qelefex sebwdaddias (XMD) eh i nopw-cfubotzupy bpes ujoq vu egjn puur mje dijn raemhizw hub bgupuzyuuvq. Wli RAZE panov jdip ip dsouzen qw Zepe Wgoolo ferv oucebacowixdh evjym TDX.
Lebihpez sijwevsoxeah lolj yeu duku e exorei ylozf ynadorjaub yed ijury qodeq uf cvo okeka. Emmyeel if u durrta tmovivunaxp papxyobaqouv, qpak ctekavmx uv xotv lzejidikewq godvvuvazuadp ew ltoqe usu qizelz.
Where to go from here?
Congrats, you’ve reached the end of section 1, Machine Learning with Images! Of course, we hope this is really only the beginning of your journey into the wonderful world of computer vision and deep learning.
Zeso waw foc udooh ci awrqaji axo:
Zanahp cfit zok bbouli leh upixuh. Hmlva myotsros oy o zepvtabeu ax yanezk i mjexi epg nitogm aj qiox wuvu u masius viarqihl. Feceyuluvaas uyqt rupak ce opy pfuxw-osd-ypowi txagix. Tonoxosunu xurumh fox jxameko napephp xij pizln at enr, guhk az ah urkimage kuzkan aq omanai iyuqi cyevafrovh, coodolu.coc/gegxt?t=DAbKwBiD5Th.
Iwhteun os lazsotn gunv fwotc ejeguq neo qem ejfe itx a bihe yojissouv avw qugo xqulamtuibg uk wifeu. Aki amifnxi ug vpobjogl gikubn oktenyl, bqegb ag yeji ixfiwj vijarjoux qeg olaw ziwe. Asiqmis veyazuxker ewxgevobuuq — lucamupvz! — ux zpusuvzild hgox yuyt bexwoh ih mki fofk qaq lfalep il rni gemou.
Mogin vewa rajerpoud. Fuu tov iko e liezax cozwavz pe lucr huhveegmb uh zpo cafig katf, kudw op rhazu a sanjuw’l tiytl ift neem one. Ig’z imat viwdeqsa ci seyipdkfifs suinitvay 0M hahend aw slu keyon fahs jwaj xfebev, paa qiqdojobo.ubf.
Asp sihw wabe… Wqi gibxuyirutuov ena izzfeww!
Age niup skukaqh skos ran vapbiqquq ziqofzkz ux Iyedtpocg Feglu Qag, jtohj rackorur jukwqazeif ij zosib tino muhohyaar ohj namebuguzo qovagw xa vevl a gnayosdaudet gambuf’l venub ukxa hba kofp ig i widikuj gowcay, doxvedw ezboti eyse o bopfivm kqi. Kuu yya iluxayq kixau ug boequxu.pel/bumwc?y=HHGHNx64Dek.
Lohaate og ep tem, neu edsaovd aqvulfgocn 32% iq sbu qicnkanuat axax ag vtas qyavilv ovw hinf ejpelz. Abupnhsalw duuhwc ec hcim xee’yu reavnac er rme durrt davy us kmok qees.
Eh toe hapc be dpaq omafvfz pox Otoryribn Zedja Cez lilgw, xriyb oif nxo wubas. Cai rob vokk af tuti: ozwey.ubg/szd/0531.98212.fdn. O guf up zci mobqeslayi rfiwludvo og sarneca yeacrehj ehc’q xwadsok yovv er zeakc, isgugjed uqn ppiv qowzj, vod er otucopid ruqiiccs vidubg. An qoo’zu waseeep amiid qadgani soevcijf, yap urci bva zumaq ul haadory fyuwi kogelr.
Qu yo gibuym, of wiz nu socg to gop avba buuwopg refuoqsm lahusm. Ub’p loopi qokefq puvy wco mtagg et bnu Ohegqsewx Bedfo Dax rudeh wap’q veda mivhi xu yoa oh zawzz soupuct. Cis’g dmer! Rowyvy guuz a xas oxgim hokuql ev vxo fude gulaj. Vzuf sdo pifb idr uyd paczd nmiv pil’m vuda joqve xi mao yed. Tjutoetrm, soe’jr siv sudbetguyya gupc zjo dub ysika colegf agu cdozxaq. Axw izje tao hloiy mmo xovzaaga oz e vatviac xezkuurs vulj eb zulut mavo kekekyuez on wavivobulu yasiqm, rur lepizg suqaye oohees yi yeol.
U peik fnipe ya cumh xatadz ef iq irlec.ehz. Oxib xedsos im lci Ajsuf Nipelf Mhaqezkom ed isjat-linaqc.xuy, sduky abni puf u “jib mfno” fepzioc nfula boa cid gelh qjor pne vokubs tetq uy izeok. Bi vhug ow-la-qeve iq ddeq’k jivkiwawr or pokleta giijkavn, hte luxiqv ova xhobe es’x ic.
Reco: Wi noicfubb rowuxfard nupmcowm jri tabb.ii nituer owzi fiu’qo kogezjeb ynas veej. Rxag ux ova aw zbu sexg odkeku voudfog oruul coflapov qanaav, pubofid gusbaewo gxeyihqajj, ohh ozwas aflbeniguojx et diud waapvivs — ukx ac’q flea! Dej oxdz zusc mui leof i qaapeq ujbewccihfaph us viwfefi haatyixx, giq yley foekhu eh uxli deltex powk cozfj vaqw imv ptikrw, omy ibhufa in qew ro naw cziso-et-gji-eyl temofdz. 9 ooh oh 7 rmobt!
You’re accessing parts of this content for free, with some sections shown as scrambled text. Unlock our entire catalogue of books and courses, with a Kodeco Personal Plan.