Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
24 changed files
with
8,717 additions
and
0 deletions.
There are no files selected for viewing
BIN
+2.81 MB
NewLoop.wav
Binary file not shown.
BIN
+1.06 MB
NoisyDrumLoop.wav
Binary file not shown.
BIN
+845 Bytes
__pycache__/augment.cpython-39.pyc
Binary file not shown.
BIN
+1.55 KB
__pycache__/cnn.cpython-39.pyc
Binary file not shown.
BIN
+889 Bytes
__pycache__/inference.cpython-39.pyc
Binary file not shown.
BIN
+2.23 KB
__pycache__/offset.cpython-39.pyc
Binary file not shown.
BIN
+2.82 KB
__pycache__/sounds.cpython-39.pyc
Binary file not shown.
BIN
+3.26 KB
__pycache__/test.cpython-39.pyc
Binary file not shown.
BIN
+1.63 KB
__pycache__/train.cpython-39.pyc
Binary file not shown.
BIN
+3.47 KB
__pycache__/urbansounddataset.cpython-39.pyc
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
from torch import nn | ||
from torchsummary import summary | ||
|
||
|
||
class CNNNetwork(nn.Module): | ||
|
||
def __init__(self, dropoutProb): | ||
super().__init__() | ||
self.conv1 = nn.Sequential( | ||
nn.Conv2d( | ||
in_channels=1, | ||
out_channels=16, | ||
kernel_size=3, | ||
stride=1, | ||
padding=2 | ||
), | ||
nn.ReLU(), | ||
nn.MaxPool2d(kernel_size=2) | ||
,nn.BatchNorm2d(16) | ||
) | ||
self.conv2 = nn.Sequential( | ||
nn.Conv2d( | ||
in_channels=16, | ||
out_channels=32, | ||
kernel_size=3, | ||
stride=1, | ||
padding=2 | ||
), | ||
nn.ReLU(), | ||
nn.MaxPool2d(kernel_size=2), | ||
nn.BatchNorm2d(32), | ||
nn.Dropout(dropoutProb) | ||
) | ||
self.conv3 = nn.Sequential( | ||
nn.Conv2d( | ||
in_channels=32, | ||
out_channels=64, | ||
kernel_size=3, | ||
stride=1, | ||
padding=2 | ||
), | ||
nn.ReLU(), | ||
nn.MaxPool2d(kernel_size=2), | ||
nn.BatchNorm2d(64), | ||
nn.Dropout(dropoutProb) | ||
) | ||
self.conv4 = nn.Sequential( | ||
nn.Conv2d( | ||
in_channels=64, | ||
out_channels=128, | ||
kernel_size=3, | ||
stride=1, | ||
padding=2 | ||
), | ||
nn.ReLU(), | ||
nn.MaxPool2d(kernel_size=2), | ||
nn.BatchNorm2d(128), | ||
nn.Dropout(dropoutProb) | ||
) | ||
self.flatten = nn.Flatten() | ||
self.linear = nn.Linear(128 * 5 * 4 , 4) | ||
self.softmax = nn.Softmax(dim=1) | ||
|
||
|
||
|
||
def forward(self, input_data): | ||
x = self.conv1(input_data) | ||
x = self.conv2(x) | ||
x = self.conv3(x) | ||
x = self.conv4(x) | ||
x = self.flatten(x) | ||
logits = self.linear(x) | ||
predictions = self.softmax(logits) | ||
return predictions | ||
|
||
|
||
if __name__ == "__main__": | ||
cnn = CNNNetwork() | ||
summary(cnn.cuda(), (1, 64, 44)) | ||
|
BIN
+720 KB
denoised.wav
Binary file not shown.
Oops, something went wrong.