Parameters and regularization note

My image looks identical to the content image. The only thing I see in this lab that could cause trouble is the note, " Take note that you will not need a regularization parameter in this exercise so we only provided the style and content weights as arguments."

Should I be setting the unused parameters to “None”? Should I put in variable names that don’t exist?

Why is the tf.add_n still the same if part of what is being passed into it is nothing?

I’ve checked my outputs and they seem appropriate. But the gradient and loss functions are a black box and I can’t see how they’re acting.

Hi,

Not sure if I understand the question, or the problem, but if you are refering to the call to the Gradient function you only shoud pass the loss and the image.

The problem is that it isn’t learning.
get_style_content_loss is called by calculate_gradients, which is called by update_image_with_style

The note I quoted above is in the intro to “calculate_gradients” . I don’t know what is going wrong, but there are clearly parameters that are not used in the function call.

tf.add_n uses zip to bring in one of the values, which is then 0 when it is actually called.

I can’t find any place that I could be changing anything for the worst (and I’ve checked repeatedly) other than in these functions related to the gradient.

@Dan_Wigodsky If you want send-me your notebook, but I’m leaving now and I can’t revise it until tomorrow night. I’m going to mention the other Mentors just in case any can assist you sooner than me.

@Deepti_Prasad @gent.spah @Wendy just in case you have time. Sorry to mention you directly.

Pere.

Hi Dan,

Can you send your notebook via personal DM. Click on the name of the mentor and then message.

In case you are facing any error or your model training is showing not the required accuracy you can share the screenshot here.

The last week of this course is a bit tough, so don’t worry, you will get the solution.

The only matter I am not able to understand with your explanation till now if you are facing an error or you are not getting the required or expected output.

Can you please let us know which one of these is your issue.

Thank you

Regards
DP

Hi Pere,

No problem.

Happy to help!!!

Thank you for notifying other mentors as you took off.

You have a good night.

Regards
DP

1 Like

Hi Dan,

as far as I understood you question, I suppose your content loss is not getting updated as per your code function call

Then please look into the below grader cell
def get_content_image_features(image):
“”" Get the content image features

Make sure you have followed these instructions

  • You can follow a similar process as you did with get_style_image_features.
  • For the content image, you will not calculate the gram matrix of these style features.

Otherwise, please let us know in brief, where are getting trouble, or share a screenshot of your error.

Regards
DP

Hi Dan,

ERRORS IN YOUR NOTEBOOK ASSIGNMENT

  1. def inception_model(layer_names):

Load InceptionV3 with the imagenet weights and without the fully-connected layer at the top of the network

THIS CODE RECALLED INCORRECTLY, YOU HAVE USED tmp directory file name.

Create the model that outputs the content and style layers

THERE IS AN ERROR FOR THIS CODE LINE. IT SHOULD BE tf.keras.models.Model

  1. Why have you left these NONE ( it is looking a particular code here, hint check the code line you wrote in the def calculus_gradient section just before this code, you will know what to write in place of this none)

in def calculate_gradients

get the style and content loss

loss = CORRECT CODE(CORRECT CODE, None(YOU FORGOT TO WRITE CODE, CORRECT CODE,
                              None(YOU FORGOT TO WRITE CODE, CORRECT CODE, CORRECT CODE)
  1. def fit_style_transfer
    I think you still have not completed your assignment as this section codes are yet to be written

START CODE HERE

  # Update the image with the style using the function that you defined


  ### END CODE HERE

Do these corrections, let us know once resolved.

Regards
DP

Thanks. I got it. The big thing was the section in fit_style_transfer that I couldn’t see.