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

ValueError: need more than 1 value to unpack #37

Closed
wanghuok opened this issue Nov 3, 2017 · 8 comments
Closed

ValueError: need more than 1 value to unpack #37

wanghuok opened this issue Nov 3, 2017 · 8 comments

Comments

@wanghuok
Copy link

wanghuok commented Nov 3, 2017

Hello, when i run 'Run detection on example' section in "ResNet50RetinaNet - COCO 2017.ipynb", i encounter this error, what's wrong whit it?

ValueError Traceback (most recent call last)
in ()
----> 1 image_batch, outputs = next(test_generator)
2 image = image_batch[0, ...].copy()
3 image -= min(image.flatten())
4 image /= max(image.flatten())
5 image *= 255

/home/wh/.local/lib/python2.7/site-packages/keras_retinanet/preprocessing/coco.pyc in next(self)
138 # lock indexing to prevent race conditions
139 with self.lock:
--> 140 selection, _, batch_size = next(self.index_generator)
141
142 assert(batch_size == 1), "Currently only batch_size=1 is allowed."

ValueError: need more than 1 value to unpack

@hgaiser
Copy link
Contributor

hgaiser commented Nov 3, 2017

What version of keras are you running ?

print(keras.__version__)

@wanghuok
Copy link
Author

wanghuok commented Nov 3, 2017

print keras.version
2.0.9
python 2.7.13

@hgaiser
Copy link
Contributor

hgaiser commented Nov 3, 2017

You can try this PR, or install keras 2.0.8. I suspect that will help with your issue.

@wanghuok
Copy link
Author

wanghuok commented Nov 3, 2017

Thanks, when i reinstall keras 2.0.8. that error was disappeared.
if i only want to run "Run detection on example" section, whether should i run "Train on data" section first?

@hgaiser
Copy link
Contributor

hgaiser commented Nov 3, 2017

If you load a model in your notebook then training isn't necessary.

@wanghuok
Copy link
Author

wanghuok commented Nov 3, 2017

Yes, i load a model "resnet50_coco_best_v1.0.0.h5".
but, when i run "Run detection on example" code, i encounter this error: "AttributeError: 'NoneType' object has no attribute 'shape'" at this line "image_batch, outputs = next(test_generator)". it seems that it didn't find any image. but my test_generator initialized successfully. please see below:

create a generator for testing data

test_generator = keras_retinanet.preprocessing.coco.CocoIterator(
'/home/wh/Downloads',
'val2017',
test_image_data_generator,
)
it outputs :
loading annotations into memory...
Done (t=0.54s)
creating index...
index created!

@hgaiser
Copy link
Contributor

hgaiser commented Nov 3, 2017

What is the structure of your COCO dataset? It should be:

/path/to/COCO/
/path/to/COCO/annotations/
/path/to/COCO/images/train2017/
/path/to/COCO/images/val2017/

@wanghuok
Copy link
Author

wanghuok commented Nov 3, 2017

Yeah. it works. thank you.

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