I'm trying to convert a dataset of dimensions (32, 32, 3, 10000) dimension dataset to a grayscale dataset, where I would have (32, 32, 1, 10000) dimensions, but I need to have that 1 channel because I will input this to a Neural Network. I tried using numpy.average, but the shape becomes (32, 32, 10000) which the TensorFlow unit is not taking as an input. I even tried to manually average it, but it had the same result. Could you guys help me with this?
Asked
Active
Viewed 210 times
1
-
Does this answer your question? [How to convert RGB images to grayscale, expand dimensions of that grayscale image to use in InceptionV3?](https://stackoverflow.com/questions/65179822/how-to-convert-rgb-images-to-grayscale-expand-dimensions-of-that-grayscale-imag) – Dhana D. Aug 19 '21 at 11:01
2 Answers
0
It is possible to add that extra dimension you need after getting (32, 32, 1000)
as shape.
You could try np.expand_dims
with the axis
parameter to define where you want that extra "1" to appear.

Bedir Yilmaz
- 3,823
- 5
- 34
- 54