Showing posts with label CNN. Show all posts
Showing posts with label CNN. Show all posts

Sunday, September 11, 2022

cnn filter, stride, paddling

# Create 10 random images of shape (1, 28, 28)
images = torch.rand(10, 1, 100, 50)

# Build 6 conv. filters
conv_filters = torch.nn.Conv2d(in_channels=1, out_channels=6, kernel_size=10, stride=4, padding=0)
print(output_feature.shape)
torch.Size([10, 6, 23, 11])

conv_filters = torch.nn.Conv2d(in_channels=1, out_channels=6, kernel_size=5, stride=4, padding=0) # Convolve the image with the filters output_feature = conv_filters(images) print(output_feature.shape)
torch.Size([10, 6, 24, 12])








conv_filters = torch.nn.Conv2d(in_channels=1, out_channels=6, kernel_size=5, stride=5, padding=0) # Convolve the image with the filters output_feature = conv_filters(images) print(output_feature.shape)
torch.Size([10, 6, 20, 10])





 



Friday, February 11, 2022

1D, 2D, 3D CNN

 

  • In 1D CNN, kernel moves in 1 direction. Input and output data of 1D CNN is 2 dimensional. Mostly used on Time-Series data.
  • In 2D CNN, kernel moves in 2 directions. Input and output data of 2D CNN is 3 dimensional. Mostly used on Image data.
  • In 3D CNN, kernel moves in 3 directions. Input and output data of 3D CNN is 4 dimensional. Mostly used on 3D Image data (MRI, CT Scans, Video).

https://towardsdatascience.com/understanding-1d-and-3d-convolution-neural-network-keras-9d8f76e29610