@@ -1082,6 +1082,9 @@ def __init__(self,
1082
1082
"('ResNet50_vd_dcn', 'ResNet18_vd', 'MobileNetV3_large', 'MobileNetV3_small')" .
1083
1083
format (backbone ))
1084
1084
self .backbone_name = backbone
1085
+ self .downsample_ratios = [
1086
+ 32 , 16 , 8
1087
+ ] if backbone == 'ResNet50_vd_dcn' else [32 , 16 ]
1085
1088
1086
1089
if params .get ('with_net' , True ):
1087
1090
if paddlex .env_info ['place' ] == 'gpu' and paddlex .env_info [
@@ -1117,7 +1120,6 @@ def __init__(self,
1117
1120
freeze_at = - 1 ,
1118
1121
freeze_norm = False ,
1119
1122
norm_decay = 0. )
1120
- downsample_ratios = [32 , 16 , 8 ]
1121
1123
1122
1124
elif backbone == 'ResNet18_vd' :
1123
1125
backbone = self ._get_backbone (
@@ -1129,7 +1131,6 @@ def __init__(self,
1129
1131
freeze_at = - 1 ,
1130
1132
freeze_norm = False ,
1131
1133
norm_decay = 0. )
1132
- downsample_ratios = [32 , 16 ]
1133
1134
1134
1135
elif backbone == 'MobileNetV3_large' :
1135
1136
backbone = self ._get_backbone (
@@ -1140,7 +1141,6 @@ def __init__(self,
1140
1141
with_extra_blocks = False ,
1141
1142
extra_block_filters = [],
1142
1143
feature_maps = [13 , 16 ])
1143
- downsample_ratios = [32 , 16 ]
1144
1144
1145
1145
elif backbone == 'MobileNetV3_small' :
1146
1146
backbone = self ._get_backbone (
@@ -1151,7 +1151,6 @@ def __init__(self,
1151
1151
with_extra_blocks = False ,
1152
1152
extra_block_filters = [],
1153
1153
feature_maps = [9 , 12 ])
1154
- downsample_ratios = [32 , 16 ]
1155
1154
1156
1155
neck = ppdet .modeling .PPYOLOFPN (
1157
1156
norm_type = norm_type ,
@@ -1166,7 +1165,7 @@ def __init__(self,
1166
1165
loss = ppdet .modeling .YOLOv3Loss (
1167
1166
num_classes = num_classes ,
1168
1167
ignore_thresh = ignore_threshold ,
1169
- downsample = downsample_ratios ,
1168
+ downsample = self . downsample_ratios ,
1170
1169
label_smooth = label_smooth ,
1171
1170
scale_x_y = scale_x_y ,
1172
1171
iou_loss = ppdet .modeling .IouLoss (
@@ -1217,7 +1216,6 @@ def __init__(self,
1217
1216
model_name = 'YOLOv3' , num_classes = num_classes , ** params )
1218
1217
self .anchors = anchors
1219
1218
self .anchor_masks = anchor_masks
1220
- self .downsample_ratios = downsample_ratios
1221
1219
self .model_name = 'PPYOLO'
1222
1220
1223
1221
def _get_test_inputs (self , image_shape ):
@@ -1272,7 +1270,7 @@ def __init__(self,
1272
1270
"PPYOLOTiny only supports MobileNetV3 as backbone. "
1273
1271
"Backbone is forcibly set to MobileNetV3." )
1274
1272
self .backbone_name = 'MobileNetV3'
1275
-
1273
+ self . downsample_ratios = [ 32 , 16 , 8 ]
1276
1274
if params .get ('with_net' , True ):
1277
1275
if paddlex .env_info ['place' ] == 'gpu' and paddlex .env_info [
1278
1276
'num' ] > 1 and not os .environ .get ('PADDLEX_EXPORT_STAGE' ):
@@ -1288,7 +1286,6 @@ def __init__(self,
1288
1286
with_extra_blocks = False ,
1289
1287
extra_block_filters = [],
1290
1288
feature_maps = [7 , 13 , 16 ])
1291
- downsample_ratios = [32 , 16 , 8 ]
1292
1289
1293
1290
neck = ppdet .modeling .PPYOLOTinyFPN (
1294
1291
detection_block_channels = [160 , 128 , 96 ],
@@ -1299,7 +1296,7 @@ def __init__(self,
1299
1296
loss = ppdet .modeling .YOLOv3Loss (
1300
1297
num_classes = num_classes ,
1301
1298
ignore_thresh = ignore_threshold ,
1302
- downsample = downsample_ratios ,
1299
+ downsample = self . downsample_ratios ,
1303
1300
label_smooth = label_smooth ,
1304
1301
scale_x_y = scale_x_y ,
1305
1302
iou_loss = ppdet .modeling .IouLoss (
@@ -1350,7 +1347,6 @@ def __init__(self,
1350
1347
model_name = 'YOLOv3' , num_classes = num_classes , ** params )
1351
1348
self .anchors = anchors
1352
1349
self .anchor_masks = anchor_masks
1353
- self .downsample_ratios = downsample_ratios
1354
1350
self .model_name = 'PPYOLOTiny'
1355
1351
1356
1352
def _get_test_inputs (self , image_shape ):
@@ -1405,6 +1401,7 @@ def __init__(self,
1405
1401
"backbone: {} is not supported. Please choose one of "
1406
1402
"('ResNet50_vd_dcn', 'ResNet101_vd_dcn')" .format (backbone ))
1407
1403
self .backbone_name = backbone
1404
+ self .downsample_ratios = [32 , 16 , 8 ]
1408
1405
1409
1406
if params .get ('with_net' , True ):
1410
1407
if paddlex .env_info ['place' ] == 'gpu' and paddlex .env_info [
@@ -1423,7 +1420,6 @@ def __init__(self,
1423
1420
freeze_at = - 1 ,
1424
1421
freeze_norm = False ,
1425
1422
norm_decay = 0. )
1426
- downsample_ratios = [32 , 16 , 8 ]
1427
1423
1428
1424
elif backbone == 'ResNet101_vd_dcn' :
1429
1425
backbone = self ._get_backbone (
@@ -1436,7 +1432,6 @@ def __init__(self,
1436
1432
freeze_at = - 1 ,
1437
1433
freeze_norm = False ,
1438
1434
norm_decay = 0. )
1439
- downsample_ratios = [32 , 16 , 8 ]
1440
1435
1441
1436
neck = ppdet .modeling .PPYOLOPAN (
1442
1437
norm_type = norm_type ,
@@ -1449,7 +1444,7 @@ def __init__(self,
1449
1444
loss = ppdet .modeling .YOLOv3Loss (
1450
1445
num_classes = num_classes ,
1451
1446
ignore_thresh = ignore_threshold ,
1452
- downsample = downsample_ratios ,
1447
+ downsample = self . downsample_ratios ,
1453
1448
label_smooth = label_smooth ,
1454
1449
scale_x_y = scale_x_y ,
1455
1450
iou_loss = ppdet .modeling .IouLoss (
@@ -1501,7 +1496,6 @@ def __init__(self,
1501
1496
model_name = 'YOLOv3' , num_classes = num_classes , ** params )
1502
1497
self .anchors = anchors
1503
1498
self .anchor_masks = anchor_masks
1504
- self .downsample_ratios = downsample_ratios
1505
1499
self .model_name = 'PPYOLOv2'
1506
1500
1507
1501
def _get_test_inputs (self , image_shape ):
0 commit comments