AlexTS1980/COVID-CT-Mask-Net

How did you generate mask segmentation?

SamihaSara opened this issue · 4 comments

Hello,

May I ask, how you generated mask results? I think the dataset annotation does not provide a mask? Thanks.

Do you mean mask outputs at inference?

Yes, that is correct. Also for mask inference, should not this model require mask annotations?

________________________________ From: Alex Ter-Sarkisov @.> Sent: Saturday, August 7, 2021 3:55 AM To: AlexTS1980/COVID-CT-Mask-Net @.> Cc: SamihaSara @.>; Author @.> Subject: Re: [AlexTS1980/COVID-CT-Mask-Net] How did you generate mask segmentation? (#5) Do you mean mask outputs at inference? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#5 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACJOQPXRTFLHEE6IPZ2FVVDT3RK5BANCNFSM5BWN4BXA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email.

Yes, it should: gt masks are provided in the dataset_segmentation.py interface:

mask = np.array(PILImage.open(self.fname))
# only GGO: merge C and background
# or merge GGO and C into a single mask
# or keep separate masks
if self.mask_type == "ggo":
mask[mask==3] = 0
elif self.mask_type == "merge":
mask[mask==3] = 2
# array (NUM_CLASS_IN_IMNG, H,W) without bgr+lungs class (merge Class 0 and 1)
# THIS IS IMPORTANT! CAN TRIGGER CUDA ERROR
mask_classes = mask == np.unique(mask)[:, None, None][2:]
# extract bounding boxes and masks for each object
for _idx, m in enumerate(mask_classes):
lab_mask = method_label(m)
regions = regionprops(lab_mask)
for _i, r in enumerate(regions):
# get rid of really small ones:
if r.area > self.area_th:
box_coords = (r.bbox[1], r.bbox[0], r.bbox[3], r.bbox[2])
list_of_bboxes.append(box_coords)
labels.append(_idx + 1)
# create a mask for one object, append to the list of masks
mask_obj = self.extract_single_mask(lab_mask, r.label)
list_of_masks.append(mask_obj)

Also, evaluation_mean_ap.py and compute_ap in utils.py interface extract objects' masks

@AlexTS1980 thanks, I will look into this. If I have more questions will reopen the issue.