An R Shiny app to recognize flower species
[This article was first published on R – Longhow Lam's Blog, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Introduction
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.
Steps that I took
- Download labeled flower data from the Visual Geometry Group,
- Install Pytorch and download their transfer learning tutorial script,
- You need to slightly adjust the script to work on the flower data,
- Train and Save the model as a (*.pt) file,
- Using the R reticulate package you can call python code from within R so that you can use a pytorch models in R,
- Create a Shiny app that allows the user to upload an image and display the predicted flower species.
Some links
Github repo with: Python notebook to fine tune the resnet18 model, R script with Shiny App, data folder with images.
Live running shiny app can be found here.
Cheers, Longhow
To leave a comment for the author, please follow the link and comment on their blog: R – Longhow Lam's Blog.
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.