Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Mismatch between model and given anchor and class sizes" for tiny YOLO #2

Closed
xslittlegrass opened this issue Feb 18, 2017 · 3 comments

Comments

@xslittlegrass
Copy link

xslittlegrass commented Feb 18, 2017

I'm having a problem testing with the tiny YOLO:

./yad2k.py cfg/tiny-yolo-voc.cfg tiny-yolo-voc.weights model_data/tiny-yolo-voc.h5
./test_yolo.py model_data/tiny-yolo-voc.h5

Are the postprocessings different for the yolo and tiny yolo? Could you have a look? Thanks very much for your sharing of this project, it's very helpful!

@xslittlegrass xslittlegrass changed the title Mismatch between model and given anchor and class sizes for tiny YOLO "Mismatch between model and given anchor and class sizes" for tiny YOLO Feb 18, 2017
@allanzelener
Copy link
Owner

allanzelener commented Feb 18, 2017

If you're using one of the models that isn't trained on the COCO dataset then you have to use the --classes_path path flag to specify the classes the model is trained on. You can find the list of PASCAL VOC classes in model_data/pascal_classes.txt.

Also if you're using a model not trained on COCO then you need to give the --anchors_path to specify the anchor boxes the model was trained with. These are saved separately when you run yad2k.py, e.g. as model_data/tiny-yolo-voc_anchors.txt. (I believe all the COCO models use the same anchors and likewise for the VOC models.)

In the future I may try to get these saved as part of the model file itself. For now I've expanded the error message to inform the user about these flags.

(Also note that tiny-yolo-voc is a small model with poor performance so it will make mistakes on the included test images.)

@xslittlegrass
Copy link
Author

Thanks for the reply. It works by adding the path, but I get another error:

./test_yolo.py model_data/tiny-yolo-voc.h5 --classes_path model_data/pascal_classes.txt --anchors_path model_data/tiny-yolo-voc_anchors.txt

model was *not* compiled. Compile it manually.
  warnings.warn('No training configuration found in save file: '
model_data/tiny-yolo-voc.h5 model, anchors, and classes loaded.
Traceback (most recent call last):
  File "./test_yolo.py", line 186, in <module>
    _main(parser.parse_args())
  File "./test_yolo.py", line 107, in _main
    yolo_outputs = yolo_head(yolo_model.output, anchors, len(class_names))
  File "/Users/xslittlegrass/Deep_learning/YAD2K/yad2k/models/keras_yolo.py", line 100, in yolo_head
    conv_height_index = K.arange(0, stop=conv_dims[0])
AttributeError: module 'keras.backend' has no attribute 'arange'
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x12a0bd898>>
Traceback (most recent call last):
  File "/Users/xslittlegrass/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 581, in __del__
AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus' 

Do you have any ideas? Thanks.

@xslittlegrass
Copy link
Author

This problem is solved by upgrading keras.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants