Question

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

Was it helpful?

Solution

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".

Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange
scroll top