未验证 提交 64b51f09 编写于 作者: P pk_hk 提交者: GitHub

fix sm_use for ppyoloe_head and output for box_dis (#7288)

* fix sm_use for ppyoloe_head and output for box_dis

* fix pos_embed of training
上级 a27df36d
...@@ -44,7 +44,6 @@ PPYOLOEHead: ...@@ -44,7 +44,6 @@ PPYOLOEHead:
static_assigner: static_assigner:
name: ATSSAssigner name: ATSSAssigner
topk: 9 topk: 9
sm_use: True
assigner: assigner:
name: TaskAlignedAssigner_CR name: TaskAlignedAssigner_CR
center_radius: 1 center_radius: 1
......
...@@ -3,7 +3,7 @@ _BASE_: [ ...@@ -3,7 +3,7 @@ _BASE_: [
] ]
log_iter: 100 log_iter: 100
snapshot_epoch: 10 snapshot_epoch: 10
weights: output/ppyoloe_plus_new_large_crn_l_80e_visdrone/model_final weights: output/ppyoloe_plus_new_crn_l_largesize_80e_visdrone/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams
PPYOLOEHead: PPYOLOEHead:
......
...@@ -44,7 +44,6 @@ PPYOLOEHead: ...@@ -44,7 +44,6 @@ PPYOLOEHead:
static_assigner: static_assigner:
name: ATSSAssigner name: ATSSAssigner
topk: 9 topk: 9
sm_use: True
assigner: assigner:
name: TaskAlignedAssigner_CR name: TaskAlignedAssigner_CR
center_radius: 1 center_radius: 1
......
...@@ -60,7 +60,7 @@ class PPYOLOEHead(nn.Layer): ...@@ -60,7 +60,7 @@ class PPYOLOEHead(nn.Layer):
grid_cell_scale=5.0, grid_cell_scale=5.0,
grid_cell_offset=0.5, grid_cell_offset=0.5,
reg_max=16, reg_max=16,
reg_range=False, reg_range=None,
static_assigner_epoch=4, static_assigner_epoch=4,
use_varifocal_loss=True, use_varifocal_loss=True,
static_assigner='ATSSAssigner', static_assigner='ATSSAssigner',
...@@ -87,6 +87,7 @@ class PPYOLOEHead(nn.Layer): ...@@ -87,6 +87,7 @@ class PPYOLOEHead(nn.Layer):
self.sm_use = True self.sm_use = True
self.reg_range = reg_range self.reg_range = reg_range
else: else:
self.sm_use = False
self.reg_range = (0, reg_max + 1) self.reg_range = (0, reg_max + 1)
self.reg_channels = self.reg_range[1] - self.reg_range[0] self.reg_channels = self.reg_range[1] - self.reg_range[0]
self.iou_loss = GIoULoss() self.iou_loss = GIoULoss()
......
...@@ -354,7 +354,7 @@ class CustomCSPPAN(nn.Layer): ...@@ -354,7 +354,7 @@ class CustomCSPPAN(nn.Layer):
# flatten [B, C, H, W] to [B, HxW, C] # flatten [B, C, H, W] to [B, HxW, C]
src_flatten = last_feat.flatten(2).transpose([0, 2, 1]) src_flatten = last_feat.flatten(2).transpose([0, 2, 1])
if self.eval_size is not None: if self.eval_size is not None and not self.training:
pos_embed = self.pos_embed pos_embed = self.pos_embed
else: else:
pos_embed = self.build_2d_sincos_position_embedding( pos_embed = self.build_2d_sincos_position_embedding(
......
...@@ -99,7 +99,7 @@ def get_ratio_infos(jsonfile, out_img, eval_size, small_stride): ...@@ -99,7 +99,7 @@ def get_ratio_infos(jsonfile, out_img, eval_size, small_stride):
ratio_w = [i * 1000 for i in ratio_w] ratio_w = [i * 1000 for i in ratio_w]
ratio_h = [i * 1000 for i in ratio_h] ratio_h = [i * 1000 for i in ratio_h]
print(f'suggested of reg_range[1] is {reg_max+1}' ) print(f'Suggested reg_range[1] is {reg_max+1}' )
print(f'Median of ratio_w is {mid_w}') print(f'Median of ratio_w is {mid_w}')
print(f'Median of ratio_h is {mid_h}') print(f'Median of ratio_h is {mid_h}')
print('all_img with box: ', len(ratio_h)) print('all_img with box: ', len(ratio_h))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册