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

Segmentation error on page without structure #95

Closed
OBrink opened this issue Oct 19, 2023 · 0 comments
Closed

Segmentation error on page without structure #95

OBrink opened this issue Oct 19, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@OBrink
Copy link
Collaborator

OBrink commented Oct 19, 2023


ValueError Traceback (most recent call last)
c:\Users\Otto Brinkhaus\OneDrive - Friedrich-Schiller-Universität Jena\Dokumente\Arbeit\testetst\DECIMER-Image-Segmentation\DECIMER_Segmentation_notebook.ipynb Cell 7 line 1
----> 1 segments = segment_chemical_structures(
2 np.array(pages[0]), expand=True, visualization=True
3 )

File c:\Users\Otto Brinkhaus\OneDrive - Friedrich-Schiller-Universität Jena\Dokumente\Arbeit\testetst\DECIMER-Image-Segmentation\decimer_segmentation\decimer_segmentation.py:101, in segment_chemical_structures(image, expand, visualization)
99 masks, bboxes, _ = get_mrcnn_results(image)
100 else:
--> 101 masks = get_expanded_masks(image)
103 segments, bboxes = apply_masks(image, masks)
105 if visualization:

File c:\Users\Otto Brinkhaus\OneDrive - Friedrich-Schiller-Universität Jena\Dokumente\Arbeit\testetst\DECIMER-Image-Segmentation\decimer_segmentation\decimer_segmentation.py:230, in get_expanded_masks(image)
228 # Structure detection with MRCNN
229 masks, bboxes, _ = get_mrcnn_results(image)
--> 230 size = determine_depiction_size_with_buffer(bboxes)
231 # Mask expansion
232 expanded_masks = complete_structure_mask(
233 image_array=image,
234 mask_array=masks,
235 max_depiction_size=size,
236 )
...
83 else:
84 return reduction(axis=axis, out=out, **passkwargs)
---> 86 return ufunc.reduce(obj, axis, dtype, out, **passkwargs)

ValueError: zero-size array to reduction operation maximum which has no identity

@OBrink OBrink added the bug Something isn't working label Oct 19, 2023
@OBrink OBrink self-assigned this Oct 19, 2023
OBrink added a commit that referenced this issue Oct 19, 2023
…ctures-have-been-detected

fix: expansion crash when no structures have been detected #95
@OBrink OBrink closed this as completed Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant