cure-lab / deep-active-learning

An implementation of the state-of-the-art Deep Active Learning algorithms
BSD 2-Clause "Simplified" License
99 stars 17 forks source link

AttributeError: 'ResNet' object has no attribute 'fe' #1

Open YazhouTUD opened 2 years ago

YazhouTUD commented 2 years ago

When we try to use pretrained model to extract features, such as "python main.py --model ResNet18 --dataset cifar10 --strategy LeastConfidence --pretrained", it returns an error: AttributeError: 'ResNet' object has no attribute 'fe'.

The reason is related to line 303 in https://github.com/cure-lab/deep-active-learning/blob/main/query_strategies/strategy.py: e1 = self.clf.fe.encode_image(x)

Could I ask how to solve this issue?

yuli-yl commented 2 years ago

Hi, The current model definition has not provided support for the pre-trained feature extractor yet. To use a pre-trained feature extractor, one way you could do is to extend the resnet definition with the encode_image function.