Added second model and second experiment pipeline, while running other experiments

This commit is contained in:
2025-04-11 14:48:23 +02:00
parent 26d5c7ace5
commit 62e56e67f6
4 changed files with 636 additions and 39 deletions
+4 -3
View File
@@ -29,14 +29,14 @@ class RandomChannelRotation(nn.Module):
return out
class DepthWiseSeperableConv(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size):
def __init__(self, in_channels, out_channels, kernel_size, padding):
super(DepthWiseSeperableConv, self).__init__()
# Depthwise convolution (each channel is convolved separately)
self.depthwise = nn.Conv2d(
in_channels=in_channels,
out_channels=in_channels,
kernel_size=kernel_size,
padding=kernel_size // 2,
padding=padding,
groups=in_channels
)
self.batch_norm_depth = nn.BatchNorm2d(in_channels)
@@ -89,7 +89,8 @@ class ForeignObjectClassificationModel(nn.Module):
conv_layers = []
for i in range(num_conv_layers):
in_ch = input_channels if i == 0 else conv_out_channels
conv_layers.append(DepthWiseSeperableConv(in_ch, conv_out_channels, kernel_size))
padding = kernel_size // 2
conv_layers.append(DepthWiseSeperableConv(in_ch, conv_out_channels, kernel_size, padding))
self.dws_conv_layers = nn.Sequential(*conv_layers)
# Global average pooling to reduce spatial dimensions.