C2W4 Multiclass Classification Grader Error: Details: 'function' object has no attribute 'items'

I get the error “Details:
‘function’ object has no attribute ‘items’” whenever I submit my C2W4 notebook. I tried to use the original notebook name, remove some image manipulation layers, and use strings instead of functions to set the optimizer and loss functions. The grader still failed to get “items” from an object. It seems to be looking for a dictionary object, but I don’t know which. My charts are plotted properly so I doubt it is my history. How do I fix this? I already tried the basic troubleshooting steps.

Hello Joachim,

Can you share the screenshot of the error you are mentioning you are getting. Kindly only share the error you are getting and do not share any part of the code which will grade your assignment.


Yes. It’s from Convolutional Neural Networks, Week 4, Programming Assignment: Classification: Beyond two classes.

Hello Joachim,

can you try to re do the assignment with a fresh copy. save the copy of the notebook you have already done in the computer. Then delete the file in the Jupyter notebook in coursera environment. once you delete, you will find 404 error on browser. at this time, click help then reboot. once rebooting is done, click help again, then update lab and then Get the latest version for the fresh copy.

basically your error log is mentioning you haven’t downloaded the images. You could also try different browser or different computer and then try submission of assignment.

let me know if your issue is not resolved yet, then I need to look at your codes once.


Good day. I did this assignment in Colab without using the Coursera environment. Could that be the reason the images cannot be found? I thought there was no Coursera environment for this course because the link redirected to a Colab notebook instead of a Coursera Jupyter environment.


Link to notebook that I copied and worked on in Colab:
“Assignment Notebook”

if it is a colab environment assignment then you need to do in google colab only.

can you share your notebook via personal DM in download format ipynb. Click on my name and then message.

Hello Joachim,


  1. Your parse data from input grader cell are incorrect. Kindly go through the instructions given before the exercise cell on how to do the steps.

also I noticed you used first step correct for the csv reader but you didn’t run that code as you have put # for those steps.

First create the csv reader step with delimiter, then for create loop correctly for label and image. remember labels append to row[0] and image append to row[1:]

further use reshape the array using numpy for both images and labels.

Your codes completely incorrect for this cell.

  1. for your train val generator, there is a clear hint instructions given to use np.expand to use for adding another dimension to data but you have used np.reshape. Also you are not suppose to give new shape but only provide the correct axis to these steps.

  2. Your train datagen, seems to be incomplete with only rescaling and not using other data augmentation methods lik width_shift, fill_mode which could eventually have an effect on your model accuracy.

  3. Your creat_model grader cell. incorrect model codes used. Kindly refer the week4 videos and ungraded labs again. you are suppose to use models.Sequential. That cells codes are lot simpler than what you have written.

  4. Again in the same cell the model compile statement, use optimizer, loss and metric without tf.keras. Also you do not require that input_layer, output=x step for that code cell. No logits required. no learning rate required.

Extra hint, your model requires a sequential layering with convolution 2d layers and max pooling 2d layers, followed by flatten layer, then dense layers. Again for the last dense layer you have used correction activation but don’t use with tf.keras. Kindly refer ungraded labs. they will guide you.

In case you still encounter issue, let me know.


Thanks for reviewing my code. The fix was to use the CSV reader instead of the numpy method. Maybe my Numpy CSV reader code specifically fails the Coursera test cases, but using CSV reader and retaining every other change still worked for me. I used np.expand to add an extra dimension, used the functional API, and used tf.keras to import the loss function and metrics. I got 100 points again. It was either a mistake with my implementation of the Numpy CSV reader or just that the Coursera grader insists on using the CSV reader. It’s fixed now, thank you.