Skip to content

Commit

Permalink
Add new notebook with egsis and point annotator (#31)
Browse files Browse the repository at this point in the history
Fix behavior of `egsis.labeling.get_superpixel_label` by ignoring the
unlabeled pixels in the histogram to found the most ocurrent label.
  • Loading branch information
ryukinix authored Oct 19, 2023
1 parent 6d2c2f7 commit 99bbd8f
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 55 deletions.
7 changes: 4 additions & 3 deletions egsis/labeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def get_superpixel_label(
superpixels: numpy.ndarray,
superpixel: int,
):
"""Get the most ocurrent label in superpixel"""
histogram = numpy.bincount(label_matrix[superpixels == superpixel].flatten())
most_occurent_label_at_superpixel = numpy.argmax(histogram)
"""Get the most ocurrent label in superpixel, ignoring unlabeled"""
y = label_matrix[(label_matrix != 0) & (superpixels == superpixel)]
histogram = numpy.bincount(y.flatten())
most_occurent_label_at_superpixel = numpy.argmax(histogram) if histogram.size > 0 else 0

return most_occurent_label_at_superpixel

Expand Down
233 changes: 233 additions & 0 deletions notebooks/annotator_egsis.ipynb

Large diffs are not rendered by default.

104 changes: 52 additions & 52 deletions notebooks/model_egsis.ipynb

Large diffs are not rendered by default.

0 comments on commit 99bbd8f

Please sign in to comment.