-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: Cannot find field 'gt_masks' in the given Instances! #5276
Comments
Okay, looks like I found the issue: |
This seems to be true, annotations are applied with the same set of transforms: detectron2/detectron2/data/dataset_mapper.py Lines 124 to 130 in 2a420ed
So, I think annotations should also be automatically transformed in these cases. |
As for future people meeting this issue. I don't get this error with default trained but as soon as I use my aug trainer class AugTrainer(DefaultTrainer):
@classmethod
def build_train_loader(cls, cfg):
mapper = DatasetMapper(
cfg,
is_train=True,
use_instance_mask=True,
recompute_boxes=True,
augmentations=[
T.ResizeShortestEdge(
short_edge_length=cfg.INPUT.MIN_SIZE_TRAIN,
max_size=cfg.INPUT.MAX_SIZE_TRAIN,
sample_style=cfg.INPUT.MIN_SIZE_TRAIN_SAMPLING,
),
T.RandomApply(T.RandomFlip(vertical=True, horizontal=False), prob=0.5),
T.RandomApply(T.RandomFlip(vertical=False, horizontal=True), prob=0.5),
T.RandomRotation([0, 360]),
T.RandomApply(T.RandomContrast(0.3, 1.4), prob=0.7),
T.RandomApply(T.RandomBrightness(0.3, 1.4), prob=0.7),
T.RandomApply(T.RandomLighting(scale=0.5), prob=0.5),
],
)
return build_detection_train_loader(cfg, mapper=mapper)
@classmethod
def build_evaluator(cls, cfg, dataset_name, output_folder=None):
if output_folder is None:
output_folder = os.path.join(cfg.OUTPUT_DIR, "inference")
return COCOEvaluator(dataset_name, output_dir=output_folder)
WIth |
If you do not know the root cause of the problem, please post according to this template:
Instructions To Reproduce the Issue:
Check https://stackoverflow.com/help/minimal-reproducible-example for how to ask good questions.
Simplify the steps to reproduce the issue using suggestions from the above link, and provide them below:
Here's my model config, based on the mask rcnn config provided, with the mask heads removed:
Here's the model output during runtime:
Expected behavior:
The model should start training without issue. I referred to #485 , but I'm using a detection model with bbox annotations.
Not sure what is going on. The model weights from "detectron2://COCO-Detection/faster_rcnn_R_50_FPN_3x/137849458/model_final_280758.pkl" load fine, too.
A sample of my dataset:
Environment:
The detectron2 is locally built from a fork without any changes.
The text was updated successfully, but these errors were encountered: