convert tibble to array data that will be used in keras

Hi, I have obtain the hyperspectral data (see attachment, pixel 15*5 with 256 channels) from thousand figures using envi software. I am trying to use keras to do deep learning in Rstuio. How can I convert the hyperspectral data to assay, add label, and combined all labled hyperspectral data to build DP models?
9.pdf (600.7 KB)

I have followed the script below, but it's to be wrong.

dataX <- read.csv("9.csv", header =T) #I have save the CSV file to pdf file which was uploaded.
dataX2 <- dataX %>% pivot_longer(cols = c(3:ncol(.)), names_to = "Wavelength", values_to = "Value") %>% mutate(across(everything(), as.numeric))
dataX3 <- dataX2 %>% select(Value) %>% array(dim = c(15, 5, 256))

Does this work for the last step?

dataX3 <-  array(dataX2$Value, dim = c(15, 5, 256))

Yes, it works. However, the result is not what I wand.

Well, what do you want? Giving an example of what you expect the end-result to look like increases the likelihood of the community being able to provide you with help.

Thanks for your reply. This is what I want.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.