Week 2 Fashion MNIST Classifier

While grading my submission for the week 2 assignment for course 1, the grader is giving error message as “Can’t compile the student’s code. Error when checking input: expected dense_Dense1_input to have 2 dimensions, but got array with shape (None, 28, 28, 1)”.

I would appreciate any insights or suggestions on how to troubleshoot and resolve this issue effectively. Thank you for your assistance!

1 Like

Hello @Abhay_Pancholi
This error says that there is issue in the input shape. Check the size of the input

1 Like

Hello @jenitta.jebaraj sir,
Thank you for your response,
The input shape that I have set for the first layer of the CNN is (28,28,1), are you prompting me to change this?

1 Like

Hello @Abhay_Pancholi

Kindly share a screenshot of the complete error you are encountering.

Regards
DP

1 Like

Hello @Deepti_Prasad ma’am.
I have attached the screenshot of the error here:

I have also provided the full error message earlier for your review.
I encountered The error message from the grader’s end after submitting the zip file containing the Model and its weights.

1 Like

@Abhay_Pancholi

its been long since I did this course, so can you confirm as far as I remember some part of the codes were already given.

Notice your input shape is in array form (None, 28, 28, 1) but the expected form is to create a 2D array in Python, you can use nested lists . EX: array = [[1, 2], [3, 4], [5, 6]] . This involves creating a list within a list, where each inner list represents a row in the 2D array.

If possible please share your notebook via DM to @Jamal022, he is the current mentor for this course. he will surely reply. If he doesn’t, then let me know, I will have a look, but yes as @jenitta.jebaraj stated your input shape needs correction.

Regards
DP

1 Like

@Deepti_Prasad
Yes ma’am most of the code is already provided, we have to just code the architecture of the model and some preprocessing steps.

Thank you for your continued support. I will share my notebook with @Jamal022 as you suggested. I appreciate your attention to the input shape issue, and I’ll continue working on resolving it. If I encounter any further difficulties, I’ll be sure to reach out.

2 Likes

@Abhay_Pancholi change the way you wrote input,

it should bemodel.add(tf.layers.conv2d({inputShape: [28, 28, 1],

notice the difference, you used ( ), I used [28, 28, 1 ]

Best regards
DP

1 Like

My apologies for the confusion @Deepti_Prasad ma’am.
In code, I ensured that the “inputShape” parameter is provided with the input in the list form [28,28,1], but while posting it I typed it in tuple format by mistake.

1 Like

Thanks for the mention, @Deepti_Prasad!

Hey, @Abhay_Pancholi, I’ve gone through your code, and it seems good. Did using the shape in square brackets “[28,28,1]” resolve your issue?

1 Like

Hello @Jamal022 Jamal,

It seems when he tried doing the assignment, his issue was resolved.

Regards
DP

3 Likes

i find js far easier than python -models are writing themselves - Well i mean Laurence is really thorough i dont know how u could miss with the in depth explanations - im having issues with the set up - the first html went smoothly and iris classifier too - im sure my code is good here on this week 2 assigment but im getting webgl error codes from the chrome browser - brackets was never my editor so im not certain im getting the most out of it - im on a m2 apple silicon macbook pro - using Chrome with simple web server - but so far i dont get it past the front page commsnd option j keps giving me the web gl problem