如何在数量的矩阵中删除矩阵?
我有一个 numpy数组 arr_seg_labs
具有以下形状:(1735,128,128)。 它包含1到10之间的像素掩模,还包含零和255(背景)。 我想删除不包含给定类别标识符(9)的那些(128,128)矩阵,并保留至少包含一个9的矩阵。 我为此做了一个蒙版(horse_mask
),但是我不知道如何继续此线程来过滤此numpy数组
CAT_IDX_HORSE = 9
horse_mask = arr_seg_labs == CAT_IDX_HORSE
I have a numpy array arr_seg_labs
which has the following shape: (1735, 128, 128).
It contains pixel masks between 1 and 10 and also contains zeros and 255 (background).
I want to remove those (128, 128) matrices which not contain the given category identifier (9) and to keep those which contain at least one 9.
I made a mask (horse_mask
) for this, but I don't know how can I continue this thread to filter this numpy array
CAT_IDX_HORSE = 9
horse_mask = arr_seg_labs == CAT_IDX_HORSE
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IIUC您可以使用口罩并索引为:
IIUC you can use masks and indexing as: