deepextractor.models.architectures

Module Contents

deepextractor.models.architectures.logger[source]
class deepextractor.models.architectures.SE1D(channels, r=8)[source]

Bases: torch.nn.Module

Squeeze-and-Excitation channel attention for 1D features (B, C, T).

net[source]
forward(x)[source]
class deepextractor.models.architectures.MHSA1D(channels, num_heads=4, dropout=0.0)[source]

Bases: torch.nn.Module

Temporal multi-head self-attention on (B, C, T).

proj_in[source]
attn[source]
proj_out[source]
norm[source]
forward(x)[source]
class deepextractor.models.architectures.LSTMBottleneck1D(channels, hidden: int | None = None, num_layers: int = 1, bidirectional: bool = True, dropout: float = 0.0)[source]

Bases: torch.nn.Module

Bidirectional LSTM bottleneck for (B, C, T) features.

lstm[source]
proj[source]
norm[source]
forward(x)[source]
class deepextractor.models.architectures.UNET1D_LSTM_ATT(in_channels: int = 2, out_channels: int = 4, features=(64, 128, 256, 512), use_lstm_bottleneck: bool = True, lstm_layers: int = 1, lstm_bidirectional: bool = True, lstm_dropout: float = 0.0, use_mhsa_bottleneck: bool = False, use_mhsa_encoder: bool = False, use_mhsa_decoder: bool = False, attn_heads: int = 4, use_se_on_skips: bool = True, norm: str = 'bn')[source]

Bases: torch.nn.Module

Time-domain U-Net for two-detector signal/glitch separation.

Input : (B, in_channels, T) — default 2 (H1 + L1 strain stacked) Output: (B, out_channels, T) — default 4 (h1_signal, h1_noise, l1_signal, l1_noise)

Optional bottleneck: bidirectional LSTM, multi-head self-attention. Optional skip connections: Squeeze-and-Excitation (SE) gating.

pool[source]
downs[source]
ups[source]
skip_se[source]
use_lstm = True[source]
use_mhsa_bottleneck = False[source]
use_mhsa_encoder = False[source]
use_mhsa_decoder = False[source]
bottleneck_conv[source]
final_conv[source]
forward(x)[source]
class deepextractor.models.architectures.DoubleConv1D(in_channels, out_channels)[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

conv[source]
forward(x)[source]
class deepextractor.models.architectures.UNET1D(in_channels=1, out_channels=1, features=[64, 128, 256, 512])[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

ups[source]
downs[source]
pool[source]
bottleneck[source]
final_conv[source]
forward(x)[source]
class deepextractor.models.architectures.DnCNN1D(depth=12, n_channels=64, image_channels=1, use_bnorm=True, kernel_size=3)[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

dncnn[source]
forward(x)[source]
class deepextractor.models.architectures.Autoencoder1D(in_channels=1, out_channels=1, features=[64, 128, 256, 512])[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

ups[source]
downs[source]
pool[source]
bottleneck[source]
final_conv[source]
forward(x)[source]
class deepextractor.models.architectures.DoubleConv2D(in_channels, out_channels)[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

conv[source]
forward(x)[source]
class deepextractor.models.architectures.UNET2D(in_channels=2, out_channels=2, features=[64, 128, 256, 512])[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

ups[source]
downs[source]
pool[source]
bottleneck[source]
final_conv[source]
forward(x)[source]
class deepextractor.models.architectures.Autoencoder2D(in_channels=2, out_channels=2, features=[64, 128, 256, 512])[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

ups[source]
downs[source]
pool[source]
bottleneck[source]
final_conv[source]
forward(x)[source]
class deepextractor.models.architectures.ModifiedAutoencoder2D(in_channels=2, out_channels=2, features=[64, 128, 256])[source]

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F


class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

ups[source]
downs[source]
pool[source]
bottleneck[source]
final_conv[source]
forward(x)[source]