Week 2 MobielV2 Lab

Hello

May I ask in Exercise 2 why we plus (3,), what does it mean (3, )?
“input_shape = image_shape + (3,)”

1 Like

IMG_SIZE has only 2 dimensions i.e. (height, width). We want to specify channels as well as part of image_shape parameter (see here) and hence we add one more dimension by creating a new tuple with 3 values (height, width, num channels).

Please read up on tuple operations in python where you can combine multiple tuples to via + operator.
(3,) is a tuple of 1 element. (3) and 3 are the same and hence the need for an extra , in (3,).

1 Like