---
title: "Yolo Example"
output:
html_notebook: default
pdf_document: default
---
Finally found a way to identify objects in a picture. The neural network to do this is called Yolo. Here is a blog post about how to use Yolo in R.
[Object detection in just 3 lines of R code using Tiny YOLO](https://heartbeat.fritz.ai/object-detection-in-just-3-lines-of-r-code-using-tiny-yolo-b5a16e50e8a0)
I used the devtools install that is given in this blog post and it worked.
```{r, eval=FALSE}
devtools::install_github("bnosac/image", subdir = "image.darknet", build_vignettes = TRUE)
```
```{r}
library(image.darknet)
```
```{r}
yolo_tiny_voc <- image_darknet_model(type = 'detect', model = "tiny-yolo-voc.cfg",
weights = system.file(package="image.darknet", "models", "tiny-yolo-voc.weights"),
labels = system.file(package="image.darknet", "include", "darknet", "data", "voc.names"))
x <- image_darknet_detect(file = "/home/esuess/classes/2018-2019/02 - Spring 2019/Stat654/Final/google_car.png",
object = yolo_tiny_voc,
threshold = 0.19)
```
```{r, echo=FALSE}
knitr::include_graphics('/home/esuess/classes/2018-2019/02 - Spring 2019/Stat654/Final/predictions.png')
```
```{r}
x <- image_darknet_detect(file = "/home/esuess/classes/2018-2019/02 - Spring 2019/Stat654/Final/busax.jpg",
object = yolo_tiny_voc,
threshold = 0.25)
```
```{r, echo=FALSE}
knitr::include_graphics('/home/esuess/classes/2018-2019/02 - Spring 2019/Stat654/Final/predictions.png')
```