I have successfully trained Object Detection with COCO based on your code. But when I continued to train instance segmentation --mask, I met the error:
segmentations = [obj["segmentation"] for obj in anno]
KeyError: 'segmentation'
My solution is adding if condition:
segmentations = [obj["segmentation"] for obj in anno if "segmentation" in obj]
But at the line:
masks = masks[keep]
There is new error:
IndexError: The shape of the mask [4] at index 0 does not match the shape of the indexed tensor [3, 480, 640] at index 0
So why does the first error appear? And How can I fix this error?
Thanks for your implementation,
I have successfully trained Object Detection with COCO based on your code. But when I continued to train instance segmentation
--mask
, I met the error:My solution is adding if condition:
segmentations = [obj["segmentation"] for obj in anno if "segmentation" in obj]
But at the line: masks = masks[keep]There is new error:
IndexError: The shape of the mask [4] at index 0 does not match the shape of the indexed tensor [3, 480, 640] at index 0
So why does the first error appear? And How can I fix this error?
Thank you a lot.