The thing is that outputs is from a DefaultPredictor which provides only pred_masks (binary mask) which is a field in instances. But I want a score associated with each pixel.
Here is the example:

for img_name in img_list:
im = cv2.imread(os.path.join(TEST_DIR, img_name))
# if img_name == ‘438.jpg’:
#     pdb.set_trace()
# pdb.set_trace()
outputs = predictor(im)
mask = outputs[‘instances’].pred_masks.to(‘cpu’).numpy()
mask = mask.astype(np.uint8)
pdb.set_trace()
mask[mask > 0] = 255
(N, H, W) = mask.shape
if N == 1:
mask = mask.squeeze()
else:
# Many objects
mask1 = np.zeros((H, W), dtype=np.uint8)
for i in range(N):
mask1[mask[i, :] > 0] = 255
mask = mask1
cv2.imwrite(os.path.join(OUTPUT_DIR, img_name), mask)
num += 1