Hello,
currently I am working with RCNN and so I have been given a code of which I have to make some sense. I have 270 pictures which ran through a neural network and 270 .cvs-files on which the corresponding mask is noted on. Below is an extract of the code I'm working with:
library("imager")
library("OpenImageR")
library("stringr")
library("foreach")
library("openxlsx")
csvs <- list.files("C:\\Users\\ M N\\Bachelor\\RCNN_mushroom_test\\RCNN_mushroom_test\\customImages\\val2\\predict_results", full.names = T)
lITV <- list()
for(i in 1:270){
print(i)
mask <- read.csv2(csvs[i])
im <- load.image(paste0("C:/Users/M N/Bachelor/imagos/Amanita_muscaria"
, str_extract_all(csvs[i], "\\d+")[[1]][2], ".jpg"))
im_hsl <- imager::RGBtoHSL(im)
l <- im_hsl[,,,3]
lITV[[i]] <- cbind.data.frame(lightness = c(l[mask == 0], l[mask == 1]),
type = c(rep("background", length(l[mask == 0])), rep("mushroom", length(l[mask == 1]))),
ID = str_extract_all(csvs[i], "\\d+")[[1]][2])
lITV[[i]] <- do.call(cbind, lapply(split(lITV[[i]], factor(lITV[[i]]$type)), function(x) x[sample(nrow(x), 100), ]))
lITV[[i]] <- lITV[[i]][, c(1, 3, 4)]
}
When I run it I get following error:
Error in file(file, "rt") : invalid 'description' argument
traceback()
gives me following reports.
3: file(file, "rt")
2: read.table(file = file, header = header, sep = sep, quote = quote,
dec = dec, fill = fill, comment.char = comment.char, ...)
1: read.csv2(csvs[i])
I have looked up the error but didn't find any useful solutions. If further information is needed I'm more than happy to provide it. I'm fairly unexperienced with R, so please excuse if the answer was obvious.
Thanks in advance