I have been trying to create a neural network that can do a filtered back projection in R for image reconstruction however I'm running into an error using the neuralnet function.
I want to try to build a machine learning program that can do a filtered back projection of a sinogram. I have the image matrix data of the sinogram and the actual data as:
Load sinogram and image data
img1 <- readJPEG("raw_data/sino1.jpg")
img1 <- rotateFixed(img1, angle = 270)
img1 <- img1[1:867,,2]
img1 %>% str()
sino <- image(img1)
img2 <- readJPEG("raw_data/Rplot.jpg")
img2 <- rotateFixed(img2, angle =270)
img2 <- img2[,,2]
img2 %>% str()
pic <- image(img2)
I also ran this block to set seed although I don't know if it's necessary:
set.seed(245)
data_rows <- floor(0.80 * nrow(img1))
train_indices <- sample(c(1:nrow(img1)), data_rows)
train_data <- img1[train_indices,]
test_data <- img1[-train_indices,]
I set up the neural net block as:
model = neuralnet(
img2~img1,
data=train_data,
hidden=c(4,2),
linear.output = FALSE
)
however I receive the error :
Error in [.data.frame
(data, , model.list$variables) :
undefined columns selected
Does anyone know how to fix this or perhaps run a neural net function for image reconstruction?