diff --git a/models.py b/models.py index 78a34117..40a9dc91 100755 --- a/models.py +++ b/models.py @@ -39,9 +39,9 @@ def create_modules(module_defs): elif module_def['type'] == 'maxpool': kernel_size = int(module_def['size']) stride = int(module_def['stride']) + maxpool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=int((kernel_size - 1) // 2)) if kernel_size == 2 and stride == 1: # yolov3-tiny modules.add_module('_debug_padding_%d' % i, nn.ZeroPad2d((0, 1, 0, 1))) - maxpool = nn.MaxPool2d(kernel_size=kernel_size, stride=stride, padding=int((kernel_size - 1) // 2)) modules.add_module('maxpool_%d' % i, maxpool) elif module_def['type'] == 'upsample': diff --git a/utils/utils.py b/utils/utils.py index 12f774f1..fdfd760f 100755 --- a/utils/utils.py +++ b/utils/utils.py @@ -338,7 +338,7 @@ def build_targets(model, targets): nt = len(targets) txy, twh, tcls, tbox, indices, anchor_vec = [], [], [], [], [], [] for i in model.yolo_layers: - layer = model.module_list[i][0] + layer = model.module_list[i] # iou of targets-anchors t, a = targets, []