unet icon indicating copy to clipboard operation
unet copied to clipboard

A potential issue when plotting unet predictions

Open Kalondepatrick opened this issue 1 year ago • 0 comments

In the example provided, the last part is slightly not working on my end. It seems we have to revise the code so that image should be a magick image object:

images <- tibble(
  image = batch[[1]] %>% array_branch(1),
  predicted_mask = predictions[,,,1] %>% array_branch(1),
  mask = batch[[2]][,,,1]  %>% array_branch(1)
) %>% 
  sample_n(2) %>% 
  map_depth(2, function(x) {
    as.raster(x) %>% magick::image_read()
  }) %>% 
  map(~do.call(c, .x))


out <- magick::image_append(c(
  magick::image_append(images$mask, stack = TRUE),
  magick::image_append(images$image, stack = TRUE), 
  magick::image_append(images$predicted_mask, stack = TRUE)
  )
)

plot(out)`

Kalondepatrick avatar Aug 22 '24 15:08 Kalondepatrick