C4 week2 Transfer Learning

This question concerns the metric used in the fine-tuning part. I put

    metrics=tf.keras.metrics.Accuracy()

in the metric initialization. But system gives an error reading

    TypeError: 'Accuracy' object is not subscriptable

I think it makes sense because in the code (the assertion part) given, we have

    assert metrics[0] == 'accuracy', "Wrong metric"

I was wondering if it was my variable declaration wrong or it was the problem of the testing code. Thanks!

1 Like

Okay I solved the problem by setting

    metrics=['accuracy']

I did this by imitating the previous part. But this is actually weird and I don’t quite understand why this works but not the one I just posted.

Thanks!

3 Likes

You are invoking the “compile()” method of the Keras.Model class. Here’s the doc page for that.

You should take it in a list