5

In this code , line 13 is commented as Theano dimension ordering mode. What does this mean?

jlh
  • 103
  • 3
pseudomonas
  • 1,042
  • 3
  • 14
  • 32

1 Answers1

11

Let's say you're working with 128x128 pixel RGB images (that's 128x128 pixels with 3 color channels).

When you put such an image into a numpy array you can either store it with a shape of (128, 128, 3) or with a shape of (3, 128, 128).

The dimension ordering specifies if the color channel comes first (as with theano / "th") or if it comes last (as with tensorflow / "tf").

The code you've posted contains the following line:

inputs = Input((1, img_rows, img_cols))

It specifies the shape of the input as (1, img_rows, img_cols) - i.e. there's one color channel (gray scale) and it comes first. That's why it requires Theano's dimension ordering "th".

stmax
  • 1,647
  • 15
  • 18