public DarknetBasicBlockV3(int channel, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { this.body = new HybridSequential(prefix: ""); // 1x1 reduce this.body.Add(DarknetV3.Conv2d(channel, 1, 0, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); // 3x3 conv expand this.body.Add(DarknetV3.Conv2d(channel * 2, 3, 1, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); }
public YOLODetectionBlockV3(int channel, string norm_layer = "BatchNorm", FuncArgs norm_kwargs = null, string prefix = null, ParameterDict @params = null) : base(prefix, @params) { Debug.Assert(channel % 2 == 0, $"channel {channel} cannot be divided by 2"); this.body = new HybridSequential(prefix: ""); foreach (var _ in Enumerable.Range(0, 2)) { // 1x1 reduce this.body.Add(DarknetV3.Conv2d(channel, 1, 0, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); // 3x3 expand this.body.Add(DarknetV3.Conv2d(channel * 2, 3, 1, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); } this.body.Add(DarknetV3.Conv2d(channel, 1, 0, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs)); this.tip = DarknetV3.Conv2d(channel * 2, 3, 1, 1, norm_layer: norm_layer, norm_kwargs: norm_kwargs); }