marco-rudolph / differnet

This is the official repository to the WACV 2021 paper "Same Same But DifferNet: Semi-Supervised Defect Detection with Normalizing Flows" by Marco Rudolph, Bastian Wandt and Bodo Rosenhahn.
217 stars 68 forks source link

About the Resnet training #20

Closed renqiqi closed 3 years ago

renqiqi commented 3 years ago

When training Alexnet and VGG on my dataset, the AUROC can reach 0.95 +, but when using Resnet,the AUROC can only reach 0.5 +. Is this normal? If not, how can I modify the code?

        # Alexnet  /  VGG
        # feat_s = self.feature_extractor.features(x_scaled)

`

        # Resnet
        feat_s = self.feature_extractor.conv1(x_scaled)
        feat_s = self.feature_extractor.bn1(feat_s)
        feat_s = self.feature_extractor.relu(feat_s)
        feat_s = self.feature_extractor.layer1(feat_s)
        feat_s = self.feature_extractor.layer2(feat_s)
        feat_s = self.feature_extractor.layer3(feat_s)
        feat_s = self.feature_extractor.layer4(feat_s)
        y_cat.append(torch.mean(feat_s, dim=(2, 3)))

`

marco-rudolph commented 3 years ago

Hi, about which dataset are we talking? I have observed sometimes strong differences in AUROC between the feature extractors, sometimes then also between the classes of MVTec AD. So I would say it is normal. But in this case, I think you missed this line (maxpool).

renqiqi commented 3 years ago

Hi, I trained the model on my own dataset which is a defect dataset. From the experimental point of view, the results obtained by using Resnet as a feature extractor are not as good as using VGG & Alexnet. Why use Resnet as a feature extractor to get poor results? Thanks a lot!

marco-rudolph commented 3 years ago

This is hard to say. One reason could be that ResNet's feature are too high level (but intermediate layers do not change the game here) or too overfitted to ImageNet. Maybe you could try EfficientNet as this paper suggests.

renqiqi commented 3 years ago

I guess the reason is that ResNet is not suitable for the data I am researching. I might try EfficientNet in the future. thanks a lot!