AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.65k stars 7.96k forks source link

SAM implementation #6499

Closed ankandrew closed 4 years ago

ankandrew commented 4 years ago

I am trying to understand SAM module (version shown on YOLOv4 paper).

def sam(x):
  # If channels last
  n_c = K.int_shape(x)[-1]
  # 3x3 filter version
  h = Conv2D(kernel_size=3, filters=n_c, strides=1, padding='same')(x)
  # 1x1 filter version (should include only channel information)
  # h = Conv2D(kernel_size=1, filters=n_c, strides=1, padding='same')(x)
  # h = BatchNormalization()(h)
  gate = Activation(sigmoid)(h)
  return Multiply()([x,gate])

My question:

  1. Is batch norm. used
  2. Is this what was presented in the paper?

Note: 1x1 conv. probably doesn't make sense, since it isn't taking spatial info. (was just testing)

AlexeyAB commented 4 years ago
  1. batch norm is used
  2. Use Conv2D(kernel_size=1, but you can try both 3x3 and 1x1
akashAD98 commented 3 years ago

@AlexeyAB @ankandrew where to put this [sam] modules in yolov4-csp/mish ?? and what scenario is perfect to use this [SAM ].