<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/not-hotdog-a-shiny-app-using-the-custom-vision-api/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2018/09/not-hotdog-a-shiny-app-using-the-custom-vision-api.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>I had a great time at the <a rel="nofollow" href="https://earlconf.com/2018/london/" target="_blank">EARL Conference</a> in London last week, and as always came away invigorated by all of the applications of R that were presented there. I'll do a full writeup of the conference later this week, but in the meantime I wanted to share the materials from my own presentation there, &quot;<a rel="nofollow" href="https://1drv.ms/p/s!AmZ4s9FA7xRJjnR1-XUnlcWJ85JK" target="_blank">Not Hotdog: Image Recognition with R and the Custom Vision API</a>&quot;. I've embedded the slides below:</p>
<p><iframe width="500px" src="https://onedrive.live.com/embed?cid=4914EF40D1B37866&resid=4914EF40D1B37866%211908&authkey=AMWyuU0gRnmpWi0&em=2&wdAr=1.7779291553133516" height="316px">This is an embedded <a rel="nofollow" href="https://office.com/" data-mce-fragment="1" target="_blank">Microsoft Office</a> presentation, powered by <a rel="nofollow" href="https://office.com/webapps" data-mce-fragment="1" target="_blank">Office Online</a>.</iframe></p>
<p>In the presentation, I showed how easy it is to build a Shiny app to perform image recognition with the <a rel="nofollow" href="https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/home?WT.mc_id=Revolutions-blog-davidsmi" target="_blank">Custom Vision API</a> in Azure. I've provided all of the R code behind the app in this GitHub repository, and thanks to the <a rel="nofollow" href="https://github.com/r-lib/httr" target="_blank">httr package</a> it takes just a few lines of R code to interface with the API to upload images, train a transfer learning model, and classify new images. It's also handy to be able to use the <a rel="nofollow" href="https://customvision.ai/" target="_blank">customvision.ai</a> web portal to review your tagged images and model performance. </p>
<p>This was my first time building a Shiny app, and it was really easy to learn how to do it thanks to the <a rel="nofollow" href="https://shiny.rstudio.com/tutorial/" target="_blank">RStudio tutorials</a>. One feature that proved particularly useful was <a rel="nofollow" href="https://shiny.rstudio.com/tutorial/written-tutorial/lesson6/" target="_blank">reactive expressions</a>, which would cache the results of the prediction and prevent a call out to the API every time I touched the &quot;threshold&quot; slider. The prediction API is rate-limited, and this way it was only called when the user actually changes the image URL, a relatively rare event. In all, it took me less than a day to learn Shiny and create the application below. Here it is correctly classifying this <a rel="nofollow" href="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Hotdog_%284739769948%29.jpg/512px-Hotdog_%284739769948%29.jpg" target="_blank">image of a hotdog</a> (<a rel="nofollow" href="https://commons.wikimedia.org/wiki/File:Hotdog_(4739769948).jpg" target="_blank">source</a>), and correctly identifying that this <a rel="nofollow" href="https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/Hotdog_%284739769948%29.jpg/512px-Hotdog_%284739769948%29.jpg" target="_blank">hot dog</a> (<a rel="nofollow" href="https://commons.wikimedia.org/wiki/File:Hotdog_(4739769948).jpg" target="_blank">source</a>) is <em>not</em> a hotdog.</p>
<p><a rel="nofollow" href="http://a1.typepad.com/6a0105360ba1c6970c022ad39249a9200d-pi" target="_blank"><img border="0" alt="Hotdog" title="Hotdog" src="http://a1.typepad.com/6a0105360ba1c6970c022ad39249a9200d-800wi"></a></p>
<p><a rel="nofollow" href="http://a0.typepad.com/6a0105360ba1c6970c022ad3b1f568200b-pi" target="_blank"><img border="0" alt="Nothotdog" title="Nothotdog" src="http://a0.typepad.com/6a0105360ba1c6970c022ad3b1f568200b-800wi"></a></p>
<p>If you want to try this out yourself, all you'll need is an Azure subscription (new subscribers can also get <a rel="nofollow" href="https://azure.microsoft.com/free/?WT.mc_id=Revolutions-blog-davidsmi" target="_blank">$200 free credits</a>) and the R code in the repository below.</p>
<p>Github (revodavid): <a rel="nofollow" href="https://github.com/revodavid/nothotdog" target="_blank">Not Hotdog vision recognition using R and Custom Vision API</a></p>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2018/09/not-hotdog-a-shiny-app-using-the-custom-vision-api.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/VzJaRVLeOv8" height="1"></a></div>