anhtuan85/Facial-expression-recognition

Where code to convert RGB to Grayscale Image on Preprocessing?

adhityabagasmiwa opened this issue · 6 comments

Hi,

I'm confused about converting RGB to Grayscale Image on your code, can you tell me the code to show convert RGB to Grayscale?

Thanks
Best

This is for a demo, but I asked if the dataset was converted to grayscale before training?

No. From each image in data, I create 2-D numpy array (h, w). Then I create tensor shape: (batch_size, 1, h, w) to trainning.

So, if using ToTensor in Pytorch for data image 2-D NumPy array always get 1 channel?

Yes.
t = np.ones((49, 49)) #(49, 49)
t = ToTensor()(t) #(1, 49, 49)

Thanks, i was understood