Hi
I am extracting features from a video using ResNet152 from torchvision, but when examining the features I found that some contain nan values. I tried using Densenet161 but got the same thing.
That’s how I define the model
class ResNet:
resnets = {
50: resnet.resnet50,
152: resnet.resnet152
}
def __init__(self, i):
model = ResNet.resnets[i](pretrained=True)
model = nn.Sequential(*list(model.children())[:-1])
model.eval()
model.cuda()
self.model = model
def __call__(self, x):
out = self.model(x)
return out
and I preprocess each frame in the video accordingly
normalize = transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
preprocess = transforms.Compose([
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
normalize
])
any idea how this can be solved?