Skip to content

Commit

Permalink
allow onehot with Nones
Browse files Browse the repository at this point in the history
  • Loading branch information
ianhi committed Nov 18, 2022
1 parent 63fdf18 commit 8f3aed4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mpl_image_labeller/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def list_to_onehot(labels, classes):
arr = np.zeros((len(labels), len(classes)), dtype=bool)
for i, l in enumerate(labels):

if isinstance(l, str) or not isinstance(l, Iterable):
if l is None:
continue
elif isinstance(l, str) or not isinstance(l, Iterable):
# str, or number, or something like that
arr[i, lookup[l]] = True
else:
Expand Down

0 comments on commit 8f3aed4

Please sign in to comment.