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

hg.match_pixels_image_2d fails when nothing matches between the two boundary maps #269

Closed
lapertor opened this issue Jul 21, 2023 · 0 comments · Fixed by #270
Closed

hg.match_pixels_image_2d fails when nothing matches between the two boundary maps #269

lapertor opened this issue Jul 21, 2023 · 0 comments · Fixed by #270

Comments

@lapertor
Copy link

lapertor commented Jul 21, 2023

When giving two boundary maps to hg.match_pixels_image_2d, but there are no boundaries that match, the function hg.cpp._get_bipartite_matching_graph_contour_image_2d (used inside the code of hg.match_pixels_image_2d) basically returns that nothing matched, notably with an empty weights on which a np.max operation is performed afterwards, causing the following error:

line 46, in dummy_function
    sources, targets = hg.match_pixels_image_2d(ucm_th, bmap, max_distance=params["max_dist"])
line 345, in match_pixels_match
    matched_edges = hg.bipartite_graph_matching((sources, targets, num_nodes1 + num_nodes2), (weights * 1000).astype(np.int64))
line 144, in bipartite_graph_matching
    very_large_weight = np.max(edge_weights) * 1000
line 2705, in amax
    return _wrapreduction(a, np.maximum, 'max', axis, None, out,
line 87, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
ValueError: zero-size array to reduction operation maximum which has no identity
@lapertor lapertor changed the title hg.match_pixels_image_2d fails when nothing matches between the two boundary maps hg.match_pixels_image_2d fails when nothing matches between the two boundary maps Jul 21, 2023
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

Successfully merging a pull request may close this issue.

1 participant