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.
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.