Closed sirnyls closed 3 years ago
Do you use TF1 or the TF2?
1.15.0
It says it's tested with 1.12, but it might also work with 1.13 or 1.14. (I set up a test later to see what works)
Your are right, I did not see that you are referring to imagenet_compare_networks.ipynb.
So the key --
is assigned by a function called get_class
which should load the images, and is supposed to indicate picking a random image, but here we need a specific one.
On the way I found that other examples are also not running... I myself never run all examples, so it could be a nice exercise.
So the problem is that the image loading function in examples/utils.py
loads all jpg images from examples/images/
and assumes they all have class labels in their name. Images not from ImageNet2012 dataset get the missing key tag --
. I guess the easiest way is to check directly for a non-default class label when loading the images.
images = [(load_image(os.path.join(base_dir, "images", f), size),
get_class(f))
for f in os.listdir(os.path.join(base_dir, "images"))
if (f.lower().endswith(".jpg") or f.lower().endswith(".jpeg")) and get_class(f) != "--"]
See commit
When I start running the analyses, I get the output "Creating analyses for network vgg16", but then comes the KeyError '--' for line 24: text.append(("%s" % label_to_class_name[y],