EOGrady21 / vprr

Video Plankton Recorder Data Processing
https://eogrady21.github.io/vprr/
Other
2 stars 1 forks source link

vpr_autoid_check #71

Open kevinsorochan opened 2 months ago

kevinsorochan commented 2 months ago

Describe the bug the function read_aid_cnn is used within vpr_autoid_check where a "confidence" (i.e., roi probability score) is required. This results in error when processing autoid files without associated probability scores (e.g., threshold = NULL)

vpr_autoid_check(new_autoid = "new_autoid", original_autoid = auto_id_folder, cruise = "CAR2022299", dayhours = "d153.h20")

Error in names(aid_table) <- c("roi", "confidence") : 'names' attribute [2] must be the same length as the vector [1]

kevinsorochan commented 2 months ago

I suggest adding a conditional statement to read_aid_cnn(), such that if there are two columns the second is "confidence"

function(aid_file) {

' Read aid files produced by automated classification

'

' @param aid_file a file path to an aid file produced by automated classification (with ROI path and probability value)

'

' @return ROI path and probability values in a table

' @export

'

aid_table <- read.table(aid_file, sep = " ")

if (ncol(aid_table) > 1) {

names(aid_table) <- c('roi', 'confidence')

} else { names(aid_table <- c('roi')

}

return(aid_table) }