<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/an-r-shiny-app-to-recognize-flower-species/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://longhowlam.wordpress.com/2018/12/17/an-r-shiny-app-to-recognize-flower-species/"> R – Longhow Lam's Blog</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<figure class="wp-block-image"><img data-orig-file="https://longhowlam.files.wordpress.com/2018/12/Selection_114.png?w=456" data-orig-size="896,712" data-medium-file="https://longhowlam.files.wordpress.com/2018/12/Selection_114.png?w=456?w=300" data-attachment-id="2682" data-image-meta="{" data-image-description="" src="https://longhowlam.files.wordpress.com/2018/12/Selection_114.png?w=456" data-permalink="https://longhowlam.wordpress.com/selection_114/" data-large-file="https://longhowlam.files.wordpress.com/2018/12/Selection_114.png?w=456?w=440" alt="" data-image-title="Selection_114" sizes="(max-width: 440px) 100vw, 440px" data-comments-opened="1" class="wp-image-2682" data-recalc-dims="1"></figure>
<h2>Introduction</h2>
<p>Playing around with PyTorch and R Shiny resulted in a simple Shiny app where the user can upload a flower image, the system will then predict the flower species.</p>
<h2>Steps that I took</h2>
<ol>
<li>Download labeled flower data from the <a rel="nofollow" href="http://www.robots.ox.ac.uk/~vgg/data/flowers/17/index.html" target="_blank">Visual Geometry Group,</a></li>
<li>Install Pytorch and download their transfer learning <a rel="nofollow" href="https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html" target="_blank">tutorial</a> script,</li>
<li>You need to slightly adjust the script to work on the flower data,</li>
<li>Train and Save the model as a (*.pt) file, </li>
<li>Using the R <a rel="nofollow" href="https://github.com/rstudio/reticulate" target="_blank">reticulate package</a> you can call python code from within R so that you can use a pytorch models in R,</li>
<li>Create a Shiny app that allows the user to upload an image and display the predicted flower species.</li>
</ol>
<h3>Some links</h3>
<p><a rel="nofollow" href="https://github.com/longhowlam/flowermodel" target="_blank">Github repo</a> with: Python notebook to fine tune the resnet18 model, R script with Shiny App, data folder with images.</p>
<p>Live running shiny app can be found <a rel="nofollow" href="http://145.131.21.163:3838/sample-apps/flowermodel/" target="_blank">here</a>. </p>
<p>Cheers, Longhow</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://longhowlam.wordpress.com/2018/12/17/an-r-shiny-app-to-recognize-flower-species/"> R – Longhow Lam's Blog</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 alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/R5Epi5bODKo" height="1"></a></div>