captum
captum copied to clipboard
Can I use captum for keypoint detection?
Is it possible use captum library for keypoint detection?
Thank you for the question @waynehong666 ! Can you elaborate more question ? Do you have any example models ?
For example, https://www.kaggle.com/c/facial-keypoints-detection problem uses the following cnn model.
class CNN(nn.Module): def init(self): super(CNN, self).init() self.conv1 = nn.Conv2d(in_channels=1, out_channels=4, kernel_size=5) # (b,1,96,96) to (b,4,92,92) self.conv1_bn = nn.BatchNorm2d(4) self.conv2 = nn.Conv2d(in_channels=4, out_channels=64, kernel_size=3) # (b,4,46,46) to (b,64,44,44) self.conv2_bn = nn.BatchNorm2d(64) self.conv3 = nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3) # (b,64,22,22) to (b,128,20,20) self.conv3_bn = nn.BatchNorm2d(128) self.conv4 = nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3) # (b,128,10,10) to (b,256,8,8) self.conv4_bn = nn.BatchNorm2d(256) self.fc1 = nn.Linear(25644, 1024) self.fc2 = nn.Linear(1024, 256) self.fc3 = nn.Linear(256, 30) self.dp1 = nn.Dropout(p=0.4)
def forward(self, x, verbose=False):
# apply conv1, relu and maxpool2d
x = self.conv1_bn(self.conv1(x))
x = F.relu(x)
x = F.max_pool2d(x, kernel_size=2)
x = self.dp1(x)
# apply conv2, relu and maxpool2d
x = self.conv2_bn(self.conv2(x))
x = F.relu(x)
x = F.max_pool2d(x, kernel_size=2)
x = self.dp1(x)
# apply conv3, relu and maxpool2d
x = self.conv3_bn(self.conv3(x))
x = F.relu(x)
x = F.max_pool2d(x, kernel_size=2)
x = self.dp1(x)
# apply conv4, relu and maxpool2d
x = self.conv4_bn(self.conv4(x))
x = F.relu(x)
x = F.max_pool2d(x, kernel_size=2)
# apply dropout
x = self.dp1(x)
x = x.view(-1, 256*4*4)
# now use FC layer with relu
x = self.fc1(x)
x = F.relu(x)
x = self.dp1(x)
x = self.fc2(x)
x = F.relu(x)
x = self.dp1(x)
x = self.fc3(x)
return x
waiting for more info of Captum
Is there any news ? I also want this feature !