# Scripts Enabled On Diabetic Retinopathy

Now that the competition's over, I've added a small sample of the training set to our scripts environment. The `../input` directory now includes the first 1,000 training images as well as trainLabels.csv.

We hope you use this environment to share samples of preprocessing code and training code that you used in this competition, as well as examples of how the preprocessing code transformed the images. You won't be able to create submissions from this data, since it doesn't include any test data.

As a quick example, we'll plot an image from each class.

First, we'll load the necessary libraries, read the labels, and create a helper function for showing the images.

```{r}
library(gridExtra)
library(jpeg)
library(readr)

plotImage <- function (filepath) {
    grid.newpage()
    grid.raster(readJPEG(filepath))
}

labels <- read_csv("../input/trainLabels.csv")
```
## No diabetic retinopathy
```{r}
plotImage(paste0("../input/", labels$image[labels$level==0][1], ".jpeg"))
```

## Mild diabetic retinopathy
```{r}
plotImage(paste0("../input/", labels$image[labels$level==1][1], ".jpeg"))
```

## Moderate diabetic retinopathy
```{r}
plotImage(paste0("../input/", labels$image[labels$level==2][1], ".jpeg"))
```

## Severe diabetic retinopathy
```{r}
plotImage(paste0("../input/", labels$image[labels$level==3][1], ".jpeg"))
```

## Proliferative diabetic retinopathy
```{r}
plotImage(paste0("../input/", labels$image[labels$level==4][1], ".jpeg"))
```
