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

Error reading B&W object #215

Open
LorenzG opened this issue Oct 10, 2018 · 0 comments
Open

Error reading B&W object #215

LorenzG opened this issue Oct 10, 2018 · 0 comments

Comments

@LorenzG
Copy link

LorenzG commented Oct 10, 2018

Hello

I'm getting the following error when trying to read a B&W image:

ValueError                                Traceback (most recent call last)
<ipython-input-11-d250c4835c35> in <module>()
----> 1 target,_ = generator.next()
      2 
      3 target_bounding_boxes, target_categories, target_images, target_masks, target_metadata = target
      4 
      5 target_bounding_boxes = numpy.squeeze(target_bounding_boxes)

~\Anaconda3\envs\tensorflow\lib\site-packages\keras_rcnn\preprocessing\_object_detection.py in next(self)
     87             selection = next(self.index_generator)
     88 
---> 89         return self._get_batches_of_transformed_samples(selection)
     90 
     91     def find_scale(self, image):

~\Anaconda3\envs\tensorflow\lib\site-packages\keras_rcnn\preprocessing\_object_detection.py in _get_batches_of_transformed_samples(self, selection)
    142         while True:
    143             try:
--> 144                 x = self._transform_samples(batch_index, image_index)
    145             except BoundingBoxException:
    146                 continue

~\Anaconda3\envs\tensorflow\lib\site-packages\keras_rcnn\preprocessing\_object_detection.py in _transform_samples(self, batch_index, image_index)
    197         dimensions = dimensions.astype(numpy.float16)
    198 
--> 199         scale = self.find_scale(image)
    200 
    201         dimensions *= scale

~\Anaconda3\envs\tensorflow\lib\site-packages\keras_rcnn\preprocessing\_object_detection.py in find_scale(self, image)
     90 
     91     def find_scale(self, image):
---> 92         r, c, _ = image.shape
     93 
     94         scale = self.minimum / numpy.minimum(r, c)

ValueError: not enough values to unpack (expected 3, got 2)

This is my code:

categories = {"sick": 1}

generator = preprocessing.ObjectDetectionGenerator()

generator = generator.flow_from_dictionary(
    dictionary=training_dictionary,
    categories=categories,
    target_size=(224, 224),
    color_mode='grayscale'
)

target,_ = generator.next()

and I'm using this image:
https://drive.google.com/open?id=1IufZFg8HmwwfIuzy4v5xkGKG3QTlv-WI

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

1 participant