facebookresearch / facebookresearch/detectron2
Exporting X101-FPN model to TorchScript fails unexpectedly
- Dominant language
- Python
- Stars
- 34.7k
- Forks
- 7.9k
- PR merge metrics
- No merged PRs in 30d
Description
1. Full runnable code or full changes you made:
```
# Train the model
from detectron2.engine import DefaultTrainer
from detectron2.config import get_cfg
from detectron2.checkpoint import DetectionCheckpointer
import os
import torch
cfg = get_cfg()
cfg.merge_from_file(
"./detectron2_repo/configs/COCO-Detection/faster_rcnn_X_101_32x8d_FPN_3x.yaml"
) # X101-FPN
cfg.DATASETS.TRAIN = ("stringing_train",)
cfg.DATASETS.TEST = () # no metrics implemented for this dataset
cfg.DATALOADER.NUM_WORKERS = 1
cfg.DATALOADER.SAMPLER_TRAIN = "RandomSubsetTrainingSampler"
cfg.DATALOADER.RANDOM_SUBSET_RATIO = 0.55
cfg.MODEL.WEIGHTS = "detectron2://ImageNetPretrained/FAIR/X-101-32x8d.pkl" # initialize from model zoo
cfg.SOLVER.IMS_PER_BATCH = 2
cfg.SOLVER.BASE_LR = 0.00025
cfg.SOLVER.MAX_ITER = (
50
) # 300 iterations seems good enough, but you can certainly train longer
cfg.MODEL.ROI_HEADS.BATCH_SIZE_PER_IMAGE = (
64
) # faster, and good enough for this toy dataset
cfg.MODEL.ROI_HEADS.NUM_CLASSES = 2 # 2 classes (thick_string, thin_string)
cfg.MODEL.DEVICE = 'cpu'
cfg.INPUT.MIN_SIZE_TRAIN = (768,)
cfg.OUTPUT_DIR = r"/content/gdrive/MyDrive/SURE/checkpoint"
os.makedirs(cfg.OUTPUT_DIR, exist_ok=True)
trainer = DefaultTrainer(cfg)
trainer.resume_or_load(resume=False)
trainer.train()
checkpointer = DetectionCheckpointer(trainer.model, save_dir=cfg.OUTPUT_DIR)
print(f"Output dir: {cfg.OUTPUT_DIR}")
checkpointer.save("stringing_detect_model")
%cd /content/detectron2_repo
!python /content/detectron2_repo/tools/deploy/export_model.py --config-file /content/gdrive/MyDrive/SURE/output.yaml --output /content/gdrive/MyDrive/SURE/checkpoint --export-method scripting --format torchscript MODEL.WEIGHTS /content/gdrive/MyDrive/SURE/checkpoint/stringing_detect_model.pth
# The YAML file above was saved in an earlier run using the following code:
# from detectron2.config import get_cfg
# cfg = get_cfg() # obtain detectron2's default config
# cfg.merge_from_list(["MODEL.WEIGHTS", "/content/gdrive/MyDrive/SURE/checkpoint/model_final.pth"])
# with open("/content/gdrive/MyDrive/SURE/output.yaml", "w") as f:
# f.write(cfg.dump()) # save config to file
```
2. What exact command you run:
3. __Full logs__ or other relevant observations: I ran this code on colab. I am trying to export my model to torchscript. Here's the error below:
```
/content/detectron2_repo
/usr/local/lib/python3.7/dist-packages/caffe2/__init__.py:5: UserWarning: Caffe2 support is not fully enabled in this PyTorch build. Please enable Caffe2 by building PyTorch from source with `BUILD_CAFFE2=1` flag.
warnings.warn("Caffe2 support is not fully enabled in this PyTorch build. "
/usr/local/lib/python3.7/dist-packages/caffe2/proto/__init__.py:17: UserWarning: Caffe2 support is not enabled in this PyTorch build. Please enable Caffe2 by building PyTorch from source with `BUILD_CAFFE2=1` flag.
warnings.warn('Caffe2 support is not enabled in this PyTorch build. '
[09/30 17:22:20 detectron2]: Command line arguments: Namespace(config_file='/content/gdrive/MyDrive/SURE/output.yaml', export_method='scripting', format='torchscript', opts=['MODEL.WEIGHTS', '/content/gdrive/MyDrive/SURE/checkpoint/stringing_detect_model.pth'], output='/content/gdrive/MyDrive/SURE/checkpoint', run_eval=False, sample_image=None)
[W init.cpp:753] Warning: Use _jit_set_fusion_strategy, bailout depth is deprecated. Setting to (STATIC, 1) (function operator())
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of proposal_generator.rpn_head.anchor_deltas.bias in checkpoint is torch.Size([12]), while shape of proposal_generator.rpn_head.anchor_deltas.bias in model is torch.Size([60]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: proposal_generator.rpn_head.anchor_deltas.bias will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of proposal_generator.rpn_head.anchor_deltas.weight in checkpoint is torch.Size([12, 256, 1, 1]), while shape of proposal_generator.rpn_head.anchor_deltas.weight in model is torch.Size([60, 1024, 1, 1]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: proposal_generator.rpn_head.anchor_deltas.weight will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of proposal_generator.rpn_head.conv.bias in checkpoint is torch.Size([256]), while shape of proposal_generator.rpn_head.conv.bias in model is torch.Size([1024]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: proposal_generator.rpn_head.conv.bias will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of proposal_generator.rpn_head.conv.weight in checkpoint is torch.Size([256, 256, 3, 3]), while shape of proposal_generator.rpn_head.conv.weight in model is torch.Size([1024, 1024, 3, 3]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: proposal_generator.rpn_head.conv.weight will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of proposal_generator.rpn_head.objectness_logits.bias in checkpoint is torch.Size([3]), while shape of proposal_generator.rpn_head.objectness_logits.bias in model is torch.Size([15]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: proposal_generator.rpn_head.objectness_logits.bias will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of proposal_generator.rpn_head.objectness_logits.weight in checkpoint is torch.Size([3, 256, 1, 1]), while shape of proposal_generator.rpn_head.objectness_logits.weight in model is torch.Size([15, 1024, 1, 1]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: proposal_generator.rpn_head.objectness_logits.weight will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of roi_heads.box_predictor.bbox_pred.bias in checkpoint is torch.Size([8]), while shape of roi_heads.box_predictor.bbox_pred.bias in model is torch.Size([320]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: roi_heads.box_predictor.bbox_pred.bias will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of roi_heads.box_predictor.bbox_pred.weight in checkpoint is torch.Size([8, 1024]), while shape of roi_heads.box_predictor.bbox_pred.weight in model is torch.Size([320, 2048]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: roi_heads.box_predictor.bbox_pred.weight will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of roi_heads.box_predictor.cls_score.bias in checkpoint is torch.Size([3]), while shape of roi_heads.box_predictor.cls_score.bias in model is torch.Size([81]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: roi_heads.box_predictor.cls_score.bias will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: Shape of roi_heads.box_predictor.cls_score.weight in checkpoint is torch.Size([3, 1024]), while shape of roi_heads.box_predictor.cls_score.weight in model is torch.Size([81, 2048]).
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: roi_heads.box_predictor.cls_score.weight will not be loaded. Please double check and see if this is desired.
WARNING [09/30 17:22:31 d2.checkpoint.c2_model_loading]: No weights in checkpoint matched with model.
Skip loading parameter 'proposal_generator.rpn_head.conv.weight' to the model due to incompatible shapes: (256, 256, 3, 3) in the checkpoint but (1024, 1024, 3, 3) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.conv.bias' to the model due to incompatible shapes: (256,) in the checkpoint but (1024,) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.objectness_logits.weight' to the model due to incompatible shapes: (3, 256, 1, 1) in the checkpoint but (15, 1024, 1, 1) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.objectness_logits.bias' to the model due to incompatible shapes: (3,) in the checkpoint but (15,) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.anchor_deltas.weight' to the model due to incompatible shapes: (12, 256, 1, 1) in the checkpoint but (60, 1024, 1, 1) in the model! You might want to double check if this is expected.
Skip loading parameter 'proposal_generator.rpn_head.anchor_deltas.bias' to the model due to incompatible shapes: (12,) in the checkpoint but (60,) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (3, 1024) in the checkpoint but (81, 2048) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (3,) in the checkpoint but (81,) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (8, 1024) in the checkpoint but (320, 2048) in the model! You might want to double check if this is expected.
Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (8,) in the checkpoint but (320,) in the model! You might want to double check if this is expected.
Some model parameters or buffers are not found in the checkpoint:
backbone.res2.0.conv1.norm.{bias, weight}
backbone.res2.0.conv1.weight
backbone.res2.0.conv2.norm.{bias, weight}
backbone.res2.0.conv2.weight
backbone.res2.0.conv3.norm.{bias, weight}
backbone.res2.0.conv3.weight
backbone.res2.0.shortcut.norm.{bias, weight}
backbone.res2.0.shortcut.weight
backbone.res2.1.conv1.norm.{bias, weight}
backbone.res2.1.conv1.weight
backbone.res2.1.conv2.norm.{bias, weight}
backbone.res2.1.conv2.weight
backbone.res2.1.conv3.norm.{bias, weight}
backbone.res2.1.conv3.weight
backbone.res2.2.conv1.norm.{bias, weight}
backbone.res2.2.conv1.weight
backbone.res2.2.conv2.norm.{bias, weight}
backbone.res2.2.conv2.weight
backbone.res2.2.conv3.norm.{bias, weight}
backbone.res2.2.conv3.weight
backbone.res3.0.conv1.norm.{bias, weight}
backbone.res3.0.conv1.weight
backbone.res3.0.conv2.norm.{bias, weight}
backbone.res3.0.conv2.weight
backbone.res3.0.conv3.norm.{bias, weight}
backbone.res3.0.conv3.weight
backbone.res3.0.shortcut.norm.{bias, weight}
backbone.res3.0.shortcut.weight
backbone.res3.1.conv1.norm.{bias, weight}
backbone.res3.1.conv1.weight
backbone.res3.1.conv2.norm.{bias, weight}
backbone.res3.1.conv2.weight
backbone.res3.1.conv3.norm.{bias, weight}
backbone.res3.1.conv3.weight
backbone.res3.2.conv1.norm.{bias, weight}
backbone.res3.2.conv1.weight
backbone.res3.2.conv2.norm.{bias, weight}
backbone.res3.2.conv2.weight
backbone.res3.2.conv3.norm.{bias, weight}
backbone.res3.2.conv3.weight
backbone.res3.3.conv1.norm.{bias, weight}
backbone.res3.3.conv1.weight
backbone.res3.3.conv2.norm.{bias, weight}
backbone.res3.3.conv2.weight
backbone.res3.3.conv3.norm.{bias, weight}
backbone.res3.3.conv3.weight
backbone.res4.0.conv1.norm.{bias, weight}
backbone.res4.0.conv1.weight
backbone.res4.0.conv2.norm.{bias, weight}
backbone.res4.0.conv2.weight
backbone.res4.0.conv3.norm.{bias, weight}
backbone.res4.0.conv3.weight
backbone.res4.0.shortcut.norm.{bias, weight}
backbone.res4.0.shortcut.weight
backbone.res4.1.conv1.norm.{bias, weight}
backbone.res4.1.conv1.weight
backbone.res4.1.conv2.norm.{bias, weight}
backbone.res4.1.conv2.weight
backbone.res4.1.conv3.norm.{bias, weight}
backbone.res4.1.conv3.weight
backbone.res4.2.conv1.norm.{bias, weight}
backbone.res4.2.conv1.weight
backbone.res4.2.conv2.norm.{bias, weight}
backbone.res4.2.conv2.weight
backbone.res4.2.conv3.norm.{bias, weight}
backbone.res4.2.conv3.weight
backbone.res4.3.conv1.norm.{bias, weight}
backbone.res4.3.conv1.weight
backbone.res4.3.conv2.norm.{bias, weight}
backbone.res4.3.conv2.weight
backbone.res4.3.conv3.norm.{bias, weight}
backbone.res4.3.conv3.weight
backbone.res4.4.conv1.norm.{bias, weight}
backbone.res4.4.conv1.weight
backbone.res4.4.conv2.norm.{bias, weight}
backbone.res4.4.conv2.weight
backbone.res4.4.conv3.norm.{bias, weight}
backbone.res4.4.conv3.weight
backbone.res4.5.conv1.norm.{bias, weight}
backbone.res4.5.conv1.weight
backbone.res4.5.conv2.norm.{bias, weight}
backbone.res4.5.conv2.weight
backbone.res4.5.conv3.norm.{bias, weight}
backbone.res4.5.conv3.weight
backbone.stem.conv1.norm.{bias, weight}
backbone.stem.conv1.weight
proposal_generator.rpn_head.anchor_deltas.{bias, weight}
proposal_generator.rpn_head.conv.{bias, weight}
proposal_generator.rpn_head.objectness_logits.{bias, weight}
roi_heads.box_predictor.bbox_pred.{bias, weight}
roi_heads.box_predictor.cls_score.{bias, weight}
roi_heads.res5.0.conv1.norm.{bias, weight}
roi_heads.res5.0.conv1.weight
roi_heads.res5.0.conv2.norm.{bias, weight}
roi_heads.res5.0.conv2.weight
roi_heads.res5.0.conv3.norm.{bias, weight}
roi_heads.res5.0.conv3.weight
roi_heads.res5.0.shortcut.norm.{bias, weight}
roi_heads.res5.0.shortcut.weight
roi_heads.res5.1.conv1.norm.{bias, weight}
roi_heads.res5.1.conv1.weight
roi_heads.res5.1.conv2.norm.{bias, weight}
roi_heads.res5.1.conv2.weight
roi_heads.res5.1.conv3.norm.{bias, weight}
roi_heads.res5.1.conv3.weight
roi_heads.res5.2.conv1.norm.{bias, weight}
roi_heads.res5.2.conv1.weight
roi_heads.res5.2.conv2.norm.{bias, weight}
roi_heads.res5.2.conv2.weight
roi_heads.res5.2.conv3.norm.{bias, weight}
roi_heads.res5.2.conv3.weight
The checkpoint state_dict contains keys that are not used by the model:
backbone.fpn_lateral2.{bias, weight}
backbone.fpn_output2.{bias, weight}
backbone.fpn_lateral3.{bias, weight}
backbone.fpn_output3.{bias, weight}
backbone.fpn_lateral4.{bias, weight}
backbone.fpn_output4.{bias, weight}
backbone.fpn_lateral5.{bias, weight}
backbone.fpn_output5.{bias, weight}
backbone.bottom_up.stem.conv1.weight
backbone.bottom_up.stem.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.shortcut.weight
backbone.bottom_up.res2.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.conv1.weight
backbone.bottom_up.res2.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.conv2.weight
backbone.bottom_up.res2.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.0.conv3.weight
backbone.bottom_up.res2.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.1.conv1.weight
backbone.bottom_up.res2.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.1.conv2.weight
backbone.bottom_up.res2.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.1.conv3.weight
backbone.bottom_up.res2.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.2.conv1.weight
backbone.bottom_up.res2.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.2.conv2.weight
backbone.bottom_up.res2.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res2.2.conv3.weight
backbone.bottom_up.res2.2.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.shortcut.weight
backbone.bottom_up.res3.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.conv1.weight
backbone.bottom_up.res3.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.conv2.weight
backbone.bottom_up.res3.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.0.conv3.weight
backbone.bottom_up.res3.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.1.conv1.weight
backbone.bottom_up.res3.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.1.conv2.weight
backbone.bottom_up.res3.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.1.conv3.weight
backbone.bottom_up.res3.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.2.conv1.weight
backbone.bottom_up.res3.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.2.conv2.weight
backbone.bottom_up.res3.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.2.conv3.weight
backbone.bottom_up.res3.2.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.3.conv1.weight
backbone.bottom_up.res3.3.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.3.conv2.weight
backbone.bottom_up.res3.3.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res3.3.conv3.weight
backbone.bottom_up.res3.3.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.shortcut.weight
backbone.bottom_up.res4.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.conv1.weight
backbone.bottom_up.res4.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.conv2.weight
backbone.bottom_up.res4.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.0.conv3.weight
backbone.bottom_up.res4.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.1.conv1.weight
backbone.bottom_up.res4.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.1.conv2.weight
backbone.bottom_up.res4.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.1.conv3.weight
backbone.bottom_up.res4.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.2.conv1.weight
backbone.bottom_up.res4.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.2.conv2.weight
backbone.bottom_up.res4.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.2.conv3.weight
backbone.bottom_up.res4.2.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.3.conv1.weight
backbone.bottom_up.res4.3.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.3.conv2.weight
backbone.bottom_up.res4.3.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.3.conv3.weight
backbone.bottom_up.res4.3.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.4.conv1.weight
backbone.bottom_up.res4.4.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.4.conv2.weight
backbone.bottom_up.res4.4.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.4.conv3.weight
backbone.bottom_up.res4.4.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.5.conv1.weight
backbone.bottom_up.res4.5.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.5.conv2.weight
backbone.bottom_up.res4.5.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.5.conv3.weight
backbone.bottom_up.res4.5.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.6.conv1.weight
backbone.bottom_up.res4.6.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.6.conv2.weight
backbone.bottom_up.res4.6.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.6.conv3.weight
backbone.bottom_up.res4.6.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.7.conv1.weight
backbone.bottom_up.res4.7.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.7.conv2.weight
backbone.bottom_up.res4.7.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.7.conv3.weight
backbone.bottom_up.res4.7.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.8.conv1.weight
backbone.bottom_up.res4.8.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.8.conv2.weight
backbone.bottom_up.res4.8.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.8.conv3.weight
backbone.bottom_up.res4.8.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.9.conv1.weight
backbone.bottom_up.res4.9.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.9.conv2.weight
backbone.bottom_up.res4.9.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.9.conv3.weight
backbone.bottom_up.res4.9.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.10.conv1.weight
backbone.bottom_up.res4.10.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.10.conv2.weight
backbone.bottom_up.res4.10.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.10.conv3.weight
backbone.bottom_up.res4.10.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.11.conv1.weight
backbone.bottom_up.res4.11.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.11.conv2.weight
backbone.bottom_up.res4.11.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.11.conv3.weight
backbone.bottom_up.res4.11.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.12.conv1.weight
backbone.bottom_up.res4.12.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.12.conv2.weight
backbone.bottom_up.res4.12.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.12.conv3.weight
backbone.bottom_up.res4.12.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.13.conv1.weight
backbone.bottom_up.res4.13.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.13.conv2.weight
backbone.bottom_up.res4.13.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.13.conv3.weight
backbone.bottom_up.res4.13.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.14.conv1.weight
backbone.bottom_up.res4.14.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.14.conv2.weight
backbone.bottom_up.res4.14.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.14.conv3.weight
backbone.bottom_up.res4.14.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.15.conv1.weight
backbone.bottom_up.res4.15.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.15.conv2.weight
backbone.bottom_up.res4.15.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.15.conv3.weight
backbone.bottom_up.res4.15.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.16.conv1.weight
backbone.bottom_up.res4.16.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.16.conv2.weight
backbone.bottom_up.res4.16.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.16.conv3.weight
backbone.bottom_up.res4.16.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.17.conv1.weight
backbone.bottom_up.res4.17.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.17.conv2.weight
backbone.bottom_up.res4.17.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.17.conv3.weight
backbone.bottom_up.res4.17.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.18.conv1.weight
backbone.bottom_up.res4.18.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.18.conv2.weight
backbone.bottom_up.res4.18.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.18.conv3.weight
backbone.bottom_up.res4.18.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.19.conv1.weight
backbone.bottom_up.res4.19.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.19.conv2.weight
backbone.bottom_up.res4.19.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.19.conv3.weight
backbone.bottom_up.res4.19.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.20.conv1.weight
backbone.bottom_up.res4.20.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.20.conv2.weight
backbone.bottom_up.res4.20.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.20.conv3.weight
backbone.bottom_up.res4.20.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.21.conv1.weight
backbone.bottom_up.res4.21.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.21.conv2.weight
backbone.bottom_up.res4.21.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.21.conv3.weight
backbone.bottom_up.res4.21.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.22.conv1.weight
backbone.bottom_up.res4.22.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.22.conv2.weight
backbone.bottom_up.res4.22.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res4.22.conv3.weight
backbone.bottom_up.res4.22.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.shortcut.weight
backbone.bottom_up.res5.0.shortcut.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.conv1.weight
backbone.bottom_up.res5.0.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.conv2.weight
backbone.bottom_up.res5.0.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.0.conv3.weight
backbone.bottom_up.res5.0.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.1.conv1.weight
backbone.bottom_up.res5.1.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.1.conv2.weight
backbone.bottom_up.res5.1.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.1.conv3.weight
backbone.bottom_up.res5.1.conv3.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.2.conv1.weight
backbone.bottom_up.res5.2.conv1.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.2.conv2.weight
backbone.bottom_up.res5.2.conv2.norm.{bias, running_mean, running_var, weight}
backbone.bottom_up.res5.2.conv3.weight
backbone.bottom_up.res5.2.conv3.norm.{bias, running_mean, running_var, weight}
roi_heads.box_head.fc1.{bias, weight}
roi_heads.box_head.fc2.{bias, weight}
Traceback (most recent call last):
File "/content/detectron2_repo/tools/deploy/export_model.py", line 222, in
exported_model = export_scripting(torch_model)
File "/content/detectron2_repo/tools/deploy/export_model.py", line 99, in export_scripting
ts_model = scripting_with_instances(ScriptableAdapter(), fields)
File "/content/detectron2_repo/detectron2/export/torchscript.py", line 55, in scripting_with_instances
scripted_model = torch.jit.script(model)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py", line 1287, in script
obj, torch.jit._recursive.infer_methods_to_compile
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 458, in create_script_module
return create_script_module_impl(nn_module, concrete_type, stubs_fn)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 520, in create_script_module_impl
script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py", line 615, in _construct
init_fn(script_module)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 498, in init_fn
scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 520, in create_script_module_impl
script_module = torch.jit.RecursiveScriptModule._construct(cpp_module, init_fn)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_script.py", line 615, in _construct
init_fn(script_module)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 498, in init_fn
scripted = create_script_module_impl(orig_value, sub_concrete_type, stubs_fn)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 524, in create_script_module_impl
create_methods_and_properties_from_stubs(concrete_type, method_stubs, property_stubs)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 375, in create_methods_and_properties_from_stubs
concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 876, in compile_unbound_method
create_methods_and_properties_from_stubs(concrete_type, (stub,), ())
File "/usr/local/lib/python3.7/dist-packages/torch/jit/_recursive.py", line 375, in create_methods_and_properties_from_stubs
concrete_type._create_methods_and_properties(property_defs, property_rcbs, method_defs, method_rcbs, method_defaults)
RuntimeError:
Module 'Res5ROIHeads' has no attribute 'mask_head' :
File "/content/detectron2_repo/detectron2/modeling/roi_heads/roi_heads.py", line 524
feature_list = [features[f] for f in self.in_features]
x = self._shared_roi_transform(feature_list, [x.pred_boxes for x in instances])
return self.mask_head(x, instances)
~~~~~~~~~~~~~~ <--- HERE
else:
return instances
'Res5ROIHeads.forward_with_given_boxes' is being compiled since it was called from 'Res5ROIHeads.forward'
File "/content/detectron2_repo/detectron2/modeling/roi_heads/roi_heads.py", line 499
else:
pred_instances, _ = self.box_predictor.inference(predictions, proposals)
pred_instances = self.forward_with_given_boxes(features, pred_instances)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
return pred_instances, {}```
## Expected behavior: Successful model export to torchscript
## Environment: Google Colab
Contributor guide
Research direction
Start with tools/deploy/export_model.py and compare the saved output.yaml with the training configuration and checkpoint used by the command. Trace the model-loading warnings showing incompatible shapes and then the TorchScript export path. Done means the reported X101-FPN checkpoint loads with the intended architecture and the export command completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- computer-vision, machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100