title: Error in fine-tuning a pre-trained FasterRCNN instance segmentation model (Detectron2) on my custom dataset
body: <pre><code>from detectron2.engine import DefaultTrainer
  from detectron2.config import get_cfg
  import os
  
  cfg = get_cfg()
  cfg.merge_from_file(model_zoo.get_config_file(&quot;COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml&quot;))
  cfg.DATASETS.TRAIN = (&quot;microcontroller_train&quot;,)
  cfg.DATASETS.TEST = ()
  cfg.DATALOADER.NUM_WORKERS = 2
  cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(&quot;COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml&quot;)
  cfg.SOLVER.IMS_PER_BATCH = 2
  cfg.SOLVER.BASE_LR = 0.00025
  cfg.SOLVER.MAX_ITER = 1000
  cfg.SOLVER.STEPS = []        # do not decay learning rate
  cfg.MODEL.ROI_HEADS.NUM_CLASSES = 88
  
  os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
  trainer = DefaultTrainer(cfg) 
  trainer.resume_or_load(resume=False)
  trainer.train()
  </code></pre>
  <p>Error:</p>
  <pre><code>SizeMismatchError: Caught SizeMismatchError in DataLoader worker process 0.
  Original Traceback (most recent call last):
    File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py&quot;, line 287, in _worker_loop
      data = fetcher.fetch(index)
    File &quot;/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py&quot;, line 32, in fetch
      data.append(next(self.dataset_iter))
    File &quot;/usr/local/lib/python3.7/dist-packages/detectron2/data/common.py&quot;, line 201, in __iter__
      yield self.dataset[idx]
    File &quot;/usr/local/lib/python3.7/dist-packages/detectron2/data/common.py&quot;, line 90, in __getitem__
      data = self._map_func(self._dataset[cur_idx])
    File &quot;/usr/local/lib/python3.7/dist-packages/detectron2/utils/serialize.py&quot;, line 26, in __call__
      return self._obj(*args, **kwargs)
    File &quot;/usr/local/lib/python3.7/dist-packages/detectron2/data/dataset_mapper.py&quot;, line 155, in __call__
      utils.check_image_size(dataset_dict, image)
    File &quot;/usr/local/lib/python3.7/dist-packages/detectron2/data/detection_utils.py&quot;, line 204, in check_image_size
      + &quot; Please check the width/height in your annotation.&quot;
  detectron2.data.detection_utils.SizeMismatchError: Mismatched image shape for image Microcontroller Segmentation/train/image25.jpg, got (1080, 1527), expect (800, 600). Please check the width/height in your annotation.
  </code></pre>