grimoire / mmdetection-to-tensorrt

convert mmdetection model to tensorrt, support fp16, int8, batch input, dynamic shape etc.
Apache License 2.0
589 stars 85 forks source link

error in deformable_im2col: a PTX JIT compilation failed #36

Open svmsunny opened 3 years ago

svmsunny commented 3 years ago

When running the mmdet2trt with my config file and checkpoint, I got the following warning:

root@f406c58d8080:~/space/mmdetection-to-tensorrt# mmdet2trt /home/config_ct2_full.py /home/epoch_24.pth /home/qcgd.trt
/usr/local/lib/python3.6/dist-packages/mmcv/utils/misc.py:304: UserWarning: "deformable_groups" is deprecated in `DeformConv2d.__init__`, please use "deform_groups" instead
  f'"{src_arg_name}" is deprecated in '
/usr/local/lib/python3.6/dist-packages/mmcv/utils/misc.py:304: UserWarning: "out_size" is deprecated in `RoIAlign.__init__`, please use "output_size" instead
  f'"{src_arg_name}" is deprecated in '
/usr/local/lib/python3.6/dist-packages/mmcv/utils/misc.py:304: UserWarning: "sample_num" is deprecated in `RoIAlign.__init__`, please use "sampling_ratio" instead
  f'"{src_arg_name}" is deprecated in '
INFO:mmdet2trt:Model warmup
INFO:mmdet2trt:Converting model
**Warning: Encountered known unsupported method torch.Tensor.new_tensor
Warning: Encountered known unsupported method torch.Tensor.new_tensor**
[TensorRT] INFO: Some tactics do not have sufficient workspace memory to run. Increasing workspace size may increase performance, please check verbose output.
[TensorRT] INFO: Detected 1 inputs and 4 output network tensors.
INFO:mmdet2trt:Conversion took 97.33503580093384 s
INFO:mmdet2trt:Saving TRT model to: /home/qcgd.trt

And then I tried to test the converted tensorrt model by using the tools/test.py, and I got the following errror:

root@f406c58d8080:~/space/mmdetection-to-tensorrt/tools# python3 test.py /home/config_ct2_full.py /home/qcgd.trt --ou         t /home/result.pkl
loading annotations into memory...
Done (t=0.00s)
creating index...
index created!
[                                                  ] 0/176, elapsed: 0s, ETA:error in deformable_im2col: a PTX JIT co         mpilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
error in deformable_im2col: a PTX JIT compilation failed
#assertion/root/space/amirstan_plugin/src/plugin/batchedNMSPlugin/batchedNMSPlugin.cpp,138
Aborted (core dumped)

The mmdet config file contains:

model = dict(
    type='FasterRCNN',
    pretrained='/home/resnet50.pth',
    backbone=dict(
        type='ResNet',
        depth=50,
        num_stages=4,
        out_indices=(0, 1, 2, 3),
        frozen_stages=1,
        norm_cfg=dict(type='BN', requires_grad=True),
        norm_eval=True,
        style='pytorch',
        dcn=dict(type='DCN', deformable_groups=1, fallback_on_stride=False),
        stage_with_dcn=(False, True, True, True)),
    neck=dict(
        type='FPN',
        in_channels=[256, 512, 1024, 2048],
        out_channels=256,
        num_outs=5),
    rpn_head=dict(
        type='RPNHead',
        in_channels=256,
        feat_channels=256,
        anchor_generator=dict(
            type='AnchorGenerator',
            scales=[8],
            ratios=[0.05, 0.1, 0.4, 0.8, 1.0, 1.25, 2.5, 10.0, 20],
            strides=[4, 8, 16, 32, 64]),
        bbox_coder=dict(
            type='DeltaXYWHBBoxCoder',
            target_means=[0.0, 0.0, 0.0, 0.0],
            target_stds=[1.0, 1.0, 1.0, 1.0]),
        loss_cls=dict(
            type='CrossEntropyLoss', use_sigmoid=True, loss_weight=1.0),
        loss_bbox=dict(type='L1Loss', loss_weight=1.0)),
    roi_head=dict(
        type='StandardRoIHead',
        bbox_roi_extractor=dict(
            type='SingleRoIExtractor',
            roi_layer=dict(type='RoIAlign', out_size=7, sample_num=0),
            out_channels=256,
            featmap_strides=[4, 8, 16, 32]),
        bbox_head=dict(
            type='Shared2FCBBoxHead',
            in_channels=256,
            fc_out_channels=1024,
            roi_feat_size=7,
            num_classes=5,
            bbox_coder=dict(
                type='DeltaXYWHBBoxCoder',
                target_means=[0.0, 0.0, 0.0, 0.0],
                target_stds=[0.1, 0.1, 0.2, 0.2]),
            reg_class_agnostic=False,
            loss_cls=dict(
                type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
            loss_bbox=dict(type='L1Loss', loss_weight=1.0))))
train_cfg = dict(
    rpn=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.7,
            neg_iou_thr=0.3,
            min_pos_iou=0.3,
            match_low_quality=True,
            ignore_iof_thr=-1),
        sampler=dict(
            type='RandomSampler',
            num=256,
            pos_fraction=0.5,
            neg_pos_ub=-1,
            add_gt_as_proposals=False),
        allowed_border=-1,
        pos_weight=-1,
        debug=False),
    rpn_proposal=dict(
        nms_across_levels=False,
        nms_pre=2000,
        nms_post=1000,
        max_num=1000,
        nms_thr=0.7,
        min_bbox_size=0),
    rcnn=dict(
        assigner=dict(
            type='MaxIoUAssigner',
            pos_iou_thr=0.5,
            neg_iou_thr=0.5,
            min_pos_iou=0.5,
            match_low_quality=False,
            ignore_iof_thr=-1),
        sampler=dict(
            type='RandomSampler',
            num=512,
            pos_fraction=0.25,
            neg_pos_ub=-1,
            add_gt_as_proposals=True),
        pos_weight=-1,
        debug=False))
test_cfg = dict(
    rpn=dict(
        nms_across_levels=False,
        nms_pre=1000,
        nms_post=1000,
        max_num=1000,
        nms_thr=0.7,
        min_bbox_size=0),
    rcnn=dict(
        score_thr=0.05,
        nms=dict(type='nms', iou_threshold=0.5),
        max_per_img=100))

The docker image is created by using the docker/Dockfile. Anybody can help to solve this problem? Thx

svmsunny commented 3 years ago

The cuda 10.2 is compatible with nvidia display driver >=440.33, updating the drvier solved this problem. image