Choubo / DRA

Official PyTorch implementation of the paper “Catching Both Gray and Black Swans: Open-set Supervised Anomaly Detection”, open-set anomaly detection, few-shot anomaly detection.
GNU Affero General Public License v3.0
72 stars 11 forks source link

the behavior of func generate_target #3

Open zhanjw opened 2 years ago

zhanjw commented 2 years ago

It is a bit difficult to understand the behavior of setting the target of normal samples in the training of holistic_head to 1 in generate_target,

def generate_target(self, target, eval=False):
        targets = list()
        if eval:
            targets.append(target==0)
            targets.append(target)
            targets.append(target)
            targets.append(target)
            return targets
        else:
            temp_t = target != 0
            targets.append(target == 0)
            targets.append(temp_t[target != 2])
            targets.append(temp_t[target != 1])
            targets.append(target != 0)
        return targets

Can you assist me in understanding it? There is no mention of this in the paper.

image
CC2033625919 commented 2 years ago

It is a bit difficult to understand the behavior of setting the target of normal samples in the training of holistic_head to 1 in generate_target,

def generate_target(self, target, eval=False):
        targets = list()
        if eval:
            targets.append(target==0)
            targets.append(target)
            targets.append(target)
            targets.append(target)
            return targets
        else:
            temp_t = target != 0
            targets.append(target == 0)
            targets.append(temp_t[target != 2])
            targets.append(temp_t[target != 1])
            targets.append(target != 0)
        return targets

Can you assist me in understanding it? There is no mention of this in the paper. image

I have the same problem about it. Do you understand it now? If it is, could you explain the problem? Thank you!

caiyu6666 commented 2 years ago

image I think the normality head predict the probability of normality, that's the reason why they minus this score to obatin final anomaly score.

Choubo commented 1 year ago

Hi, @zhanjw @CC2033625919

As @caiyu6666 said, we want holistic_head to predict the probability of normality, so we changed the target to learn the feature of normality.

Cheers, Choubo