At first, I used K.get_session() and K.variables_initializer() but changed it to tf.compat.v1.keras.backend.get_session() and tf.compat.v1.variables_initializer(). However, now, I get an error saying that the session graph is empty. What does this mean and how should I fix it? Thank you!
My code for yolo_non_max_suppression ^
The error I get ^
Why are you calling tf.run() within your function? That should not be necessary and I will guess that is what is triggering that error message.
Well, it was not necessary the way I wrote the code, which was to use tf.gather
instead of K.gather
as you have.
Welcome to the community.
I think you are working on the old assignment which is Tensorflow v1 based.
V2 is basically running in the Eager execution mode that you can debug easily.
Not sure how you get the old one, but it is better for you to refresh to the new one.
This thread by Paul will help you on this.
Thanks for pointing this out, Nobu. Well, one way to get an old solution is to copy it from GitHub. Of course that is against the rules and it also doesn’t always work, since the courses were significantly revised in April of 2021.
Hmm, interesting. Thanks for the thread link!
Oh interesting. Is tf.run() not needed to evaluate the graph? I’ll try using tf.gather as well. Appreciate the help!
Is it against the rules to use an old solution that you’ve made? I took the CNN course around December 2020 on my father’s Coursera account, and I’m going through the entire Deep Learning specialization again to get the certificate so I figured I’d reference what I put for the CNN course last time for the course currently (since I’m on different accounts). That’s why when I ran into an error, I wasn’t sure why it was happening. If there’s any violation I’ll immediately stop, and apologies for the confusion.
As long as the old solution is one that you created yourself, that is fine. The only thing that is against the rules is submitting someone else’s code as your own solution.
If you started the courses in 2020, then you need to be aware that the courses were significantly revised in April 2021. Solutions from the earlier versions of the courses do not work in a lot of cases. You need to carefully compare the old and new notebooks to understand what has changed. In particular, as Nobu pointed out earlier on this thread, the old courses used TensorFlow v1 which did not support “eager” mode. In April 2021, all the courses that use TF were updated to use TensorFlow v2 with Eager Mode. That is a huge change (and a big improvement in terms of “ease of use”), so you can’t just copy forward changes from before April 2021 in any of the assignments that use TensorFlow. An important caveat to keep in mind …