diff --git a/configs/dota/s2anet_1x_spine.yml b/configs/dota/s2anet_1x_spine.yml index 6ebe668c8c23298b3a2870716a2e16e62faa5ea2..5cf215b54d7633d75225608b0fd4ab45ecd1edd0 100644 --- a/configs/dota/s2anet_1x_spine.yml +++ b/configs/dota/s2anet_1x_spine.yml @@ -27,4 +27,3 @@ S2ANetHead: reg_loss_weight: [1.0, 1.0, 1.0, 1.0, 1.05] cls_loss_weight: [1.05, 1.0] reg_loss_type: 'l1' - is_training: True diff --git a/configs/dota/s2anet_conv_2x_dota.yml b/configs/dota/s2anet_conv_2x_dota.yml index eaca36207fe3f9652a745cca017b514a5f42d406..795ba242b116b01489924a687490492799875d07 100644 --- a/configs/dota/s2anet_conv_2x_dota.yml +++ b/configs/dota/s2anet_conv_2x_dota.yml @@ -6,6 +6,7 @@ _BASE_: [ '_base_/s2anet_reader.yml', ] weights: output/s2anet_conv_1x_dota/model_final +pretrain_weights: https://paddledet.bj.bcebos.com/models/pretrained/ResNet50_cos_pretrained.pdparams ResNet: depth: 50 diff --git a/ppdet/ext_op/rbox_iou_op.cc b/ppdet/ext_op/rbox_iou_op.cc index ce27e8e919e80bd2cc2a59f2087b41151b880a50..6031953d20e6302759621ac80b7a3e6ca35928db 100644 --- a/ppdet/ext_op/rbox_iou_op.cc +++ b/ppdet/ext_op/rbox_iou_op.cc @@ -45,8 +45,7 @@ std::vector RboxIouCPUForward(const paddle::Tensor& rbox1, const auto rbox1_num = rbox1.shape()[0]; auto rbox2_num = rbox2.shape()[0]; - auto output = paddle::Tensor(paddle::PlaceType::kCPU); - output.reshape({rbox1_num, rbox2_num}); + auto output = paddle::Tensor(paddle::PlaceType::kCPU, {rbox1_num, rbox2_num}); PD_DISPATCH_FLOATING_TYPES( rbox1.type(), diff --git a/ppdet/ext_op/rbox_iou_op.cu b/ppdet/ext_op/rbox_iou_op.cu index 72cac238922bdad50999e9ae7116181cf303c212..8ec43e54b4a813ef5829ba3120cc4a2be4d5d9b9 100644 --- a/ppdet/ext_op/rbox_iou_op.cu +++ b/ppdet/ext_op/rbox_iou_op.cu @@ -94,8 +94,7 @@ std::vector RboxIouCUDAForward(const paddle::Tensor& rbox1, cons auto rbox1_num = rbox1.shape()[0]; auto rbox2_num = rbox2.shape()[0]; - auto output = paddle::Tensor(paddle::PlaceType::kGPU); - output.reshape({rbox1_num, rbox2_num}); + auto output = paddle::Tensor(paddle::PlaceType::kGPU, {rbox1_num, rbox2_num}); const int blocks_x = CeilDiv(rbox1_num, BLOCK_DIM_X); const int blocks_y = CeilDiv(rbox2_num, BLOCK_DIM_Y); diff --git a/ppdet/modeling/bbox_utils.py b/ppdet/modeling/bbox_utils.py index 789d064674cf7031e31fa3035d1d9224f935f739..e040ba69b755fdc5c329413343edaba463ba7925 100644 --- a/ppdet/modeling/bbox_utils.py +++ b/ppdet/modeling/bbox_utils.py @@ -529,18 +529,18 @@ def poly2rbox(polys): rbox_angle = 0 if edge1 > edge2: rbox_angle = np.arctan2( - np.float(pt2[1] - pt1[1]), np.float(pt2[0] - pt1[0])) + float(pt2[1] - pt1[1]), float(pt2[0] - pt1[0])) elif edge2 >= edge1: rbox_angle = np.arctan2( - np.float(pt4[1] - pt1[1]), np.float(pt4[0] - pt1[0])) + float(pt4[1] - pt1[1]), float(pt4[0] - pt1[0])) def norm_angle(angle, range=[-np.pi / 4, np.pi]): return (angle - range[0]) % range[1] + range[0] rbox_angle = norm_angle(rbox_angle) - x_ctr = np.float(pt1[0] + pt3[0]) / 2 - y_ctr = np.float(pt1[1] + pt3[1]) / 2 + x_ctr = float(pt1[0] + pt3[0]) / 2 + y_ctr = float(pt1[1] + pt3[1]) / 2 rotated_box = np.array([x_ctr, y_ctr, width, height, rbox_angle]) rotated_boxes.append(rotated_box) ret_rotated_boxes = np.array(rotated_boxes)