Where code to convert RGB to Grayscale Image on Preprocessing?
adhityabagasmiwa opened this issue · 6 comments
adhityabagasmiwa commented
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
adhityabagasmiwa commented
This is for a demo, but I asked if the dataset was converted to grayscale before training?
anhtuan85 commented
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.
adhityabagasmiwa commented
So, if using ToTensor in Pytorch for data image 2-D NumPy array always get 1 channel?
anhtuan85 commented
Yes.
t = np.ones((49, 49)) #(49, 49)
t = ToTensor()(t) #(1, 49, 49)
adhityabagasmiwa commented
Thanks, i was understood