hi all, i came across some puzzle when using a trained net to extract feature, here is the problem:
- trained a resnet50 for classification task, and extract the feature from feature lay,which is a fc layer before classification layer.
- i tried two ways to do the feature extracting ,
model.fc = nn.Sequential()
and
model = nn.Sequential(*list(model.children())[:-1]) - the speed of extracting feature is very slow when using the second method and the first is very fast.
is there anyone can explain it ?
thanks