---
title: "Yolo Example"
author: "Prof. Eric A. Suess"
format: html
---

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}
#| echo: 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 = "google_car.png", 
                          object = yolo_tiny_voc,
                          threshold = 0.19)
```