titu1994 / keras-non-local-nets

Keras implementation of Non-local Neural Networks
MIT License
290 stars 100 forks source link

Error in YOLOv3 #14

Closed ervinyo closed 4 years ago

ervinyo commented 4 years ago

HI, Thanks for your code because your code can improve my work in YOLOv2 but I have error in YOLOv3. Could anyone help me ? I put non local block in this part

Layer 80 => 82

pred_yolo_1 = _conv_block(x, [{'filter': 512, 'kernel': 3, 'stride': 1, 'bnorm': True, 'dilation_rate': 2,  'leaky': True,  'layer_idx': 80},
                         {'filter': (3*(5+nb_class)), 'kernel': 1, 'stride': 1, 'bnorm': False, 'leaky': False, 'layer_idx': 81}], do_skip=False)
loss_yolo_1 = YoloLayer(anchors[12:], 
                        [1*num for num in max_grid], 
                        batch_size, 
                        warmup_batches, 
                        ignore_thresh, 
                        grid_scales[0],
                        obj_scale,
                        noobj_scale,
                        xywh_scale,
                        class_scale)([input_image, pred_yolo_1, true_yolo_1, true_boxes])

# Layer 83 => 86
x = _conv_block(x, [{'filter': 512, 'kernel': 1, 'stride': 1, 'bnorm': True, 'leaky': True, 'layer_idx': 84}], do_skip=False)

x = UpSampling2D(2)(x)
# x = concatenate([x, skip_61])

# 1*1 conv for addition
skip_61 = Conv2D(512, (1, 1), strides=(1,1), padding='same', name='add_conv_21', use_bias=False)(skip_61)
skip_61 = BatchNormalization(name='add_norm_21')(skip_61)
skip_61 = LeakyReLU(alpha=0.1)(skip_61)

#non-local block
skip_61 = non_local_block(skip_61, mode='embedded', compression=2) 

and the result is Capture

ervinyo commented 4 years ago

this issues is solve because my input is None. The input must be clear (have a number input size) can't None