// CPU is used because cv2.resize only accepts numpy arrays.
segms = [chainer.backends.cuda.to_cpu(segm) for segm in segms]
bboxes = [chainer.backends.cuda.to_cpu(bbox) for bbox in bboxes]
labels = [chainer.backends.cuda.to_cpu(label) for label in labels]
masks = []
// To work around an issue with cv2.resize (it seems to automatically// pad with repeated border values), we manually zero-pad the masks by 1
After Change
xp = chainer.backends.cuda.get_array_module(*segms)
if xp != np:
raise ValueError(
"MaskHead.decode only supports numpy inputs for now.") masks = []
// To work around an issue with cv2.resize (it seems to automatically// pad with repeated border values), we manually zero-pad the masks by 1// pixel prior to resizing back to the original image resolution.