AI fo Medical Imaging, C1_W3_Assignment

I have problem to debug my codes. I don’t understand what is going on my codes. the output image is not match with answer.
I copy my answer and the Error here:
I appreciate you helping me.

(Solution code removed, as posting it publicly is against the honour code of this community)

1 Like

Hi @Zeinab_Masoomy,

Welcome to our community and thank you for taking our courses!

First off, it is against the honour code of our community to share the solution code publicly, which is why I have removed it from your post. Kindly do not post it in the future. When a mentor would feel the need to look at your code, they’d ask you to direct message them.

1 Like

Before we talk about your code, please note, I noticed you have made a lot of addition of code cells and code in your notebook which weren’t there before, which is understandable as you were trying to debug, but always remember to revert these changes back to the original version of the notebook, otherwise the autograder will not be able to grade your assignment and throw errors.

This is why, the assignment file you were working on, I have renamed it to previous_C1_W3_Assignment.ipynb so that your work isn’t lost, and I have added a fresh copy of the assignment, C1_W3_Assignment.ipynb. Please continue working in C1_W3_Assignment.ipynb from now on. You can take help as much as you want from the previous version, but when submitting please make sure you submit the C1_W3_Assignment.ipynb file.

1 Like

After looking at your Ex 1, these were you mistakes:

  • You are expected to add in your code between the tags ### START CODE HERE (REPLACE INSTANCES OF 'None' with your code) ### and ### END CODE HERE ###. Whatever the code outside of these tags, you are not supposed to touch it, whatever it may be. I’m saying this because there was this code outside of these tags:
# Initialize features and labels with `None`
X = None
y = None

But you had changed it (you weren’t suppose to change it, as this code did not lie between the start and end code tag), and the instructions clearly mentioned to initialise them with “None”:

# Initialize features and labels with `None`
X = image
y = label
  • For the start values of x, y and z, you were adding the values when you should have been subtracting them.

  • You were hard-coding the values of number of classes. As a rule of thumb, please remember to NEVER hard code any value in the graded functions, unless specifically asked to do so. The values you are expected to use are passed in as the function parameters. Use those instead of hard-coding them.

  • You were incorrectly changing the dimensions of X and Y.

You can find details of these in your notebook. And you should be able to run your notebook successfully till Ex 1.

Happy learning,
Mubsi

1 Like

thanks for reply. sorry for sharing unproperly.

1 Like

thanks and appreciate for answering my question precisely. it was really helpful and I learn new thing.

1 Like

Hi Mr. Mubsi,

i submitted my assignment. in my assignment there was no error. but i got 0 as a grade.
I appreciate you again helping me as usual.
lab Id: ctyiqwpz

1 Like

Hi @Zeinab_Masoomy,

What was the output of the grader ?

1 Like

it is 0%. as I said, it seems everything is okay because there is no error and tests passed!!!
please help me i have to pass it tilll 16 october.
thanks in advance.

1 Like

Hi @Zeinab_Masoomy,

If you press My submissions and then press on Show grader output, you should be able to see the output which the grader has provided. Could you share that ?

Thanks,
Mubsi

1 Like

Hi Mr. Mubsi,
it is what I saw there:

Cell #9. Can’t compile the student’s code. Error: AttributeError(“‘NoneType’ object has no attribute ‘dtype’”,)

1 Like

Hi @Zeinab_Masoomy,

The below screenshot is taken from your notebook:

As you can see, your cell #9 does not successfully run, as outputted by the autograder as well, and the reason for that is you have not attempted to complete your Ex 2. As you can see, your Ex 2 still has mentions of None in it, which is why the output by the grader was Error: AttributeError(“‘NoneType’ object has no attribute ‘dtype’”,).

Fill in your Ex 2.

Please know, in order to get the grade from the autograder, you have to attempt ALL of the exercises. If you attempt them one by one and submit it to the autograder, you’ll always get a zero.

Cheers,
Mubsi

1 Like

Hello Mr. Mumbai,
sorry, again I don’t know exactly what has happened, everything is none. but I made corrections and submitted it. Now I finished the assignment and got the certificate.
I have a special thanks to you for your time and help and, especially your patience.
have a great day and week.

2 Likes

Hello Mr. Mubsi,
sorry, again I don’t know exactly what has happened, everything is none. but I made corrections and submitted it. Now I finished the assignment and got the certificate.
I have a special thanks to you for your time and help and, especially your patience.
have a great day and week.

1 Like

Hello Mr. Mubsi
i am facing issues in my code aswell , whatever i do the test cases wont pass , it keeps giving assertion error it’s been 3 days on the same cell . the rest of the assignment is working properly . i urge you to please check my notebook

" 9 Tests passed
3 Tests failed

AssertionError Traceback (most recent call last)
in ()
8
9 sess = K.get_session()
—> 10 soft_dice_loss_test(soft_dice_loss, epsilon, sess)

~/work/W3A1/public_tests.py in soft_dice_loss_test(target, epsilon, sess)
412 ]
413
→ 414 multiple_test_dice(test_cases, target, sess)
415
416 ##############################################

~/work/W3A1/test_utils.py in multiple_test_dice(test_cases, target, sess)
183 print(‘\033[92m’, success," Tests passed")
184 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
→ 185 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))

AssertionError: Not all tests were passed for soft_dice_loss. Check your equations and avoid using global variables inside the function.
" this is the error i am getting

1 Like

Hello @bhavana
Is this the same assignment you made post separately? as I can see the error you shared here and on another post seems to be different. So kindly post at one place with full error image, so better response and help can be given. Kindly confirm, or share you codes via personal DM. Will respond to your created post there.

Regards
DP

1 Like

ma’am it is the same assignment , and the same cells you told me to ss . can i copy paste the code and the error here in the dms?

1 Like

the test cases passed but i am having trouble with the assertion error . that is the new error that was raised after i fixed the test cases failing .

1 Like

This is not DM, it is a public post. I am checking your codes. Give me some minutes. I will be responding further on the post you created.

Update responded on your other created post.

Regards
DP