An anomaly detection library comprising state-of-the-art algorithms and features such as experiment management, hyper-parameter optimization, and edge inference.
The GANomaly paper and original implementation (https://github.com/samet-akcay/ganomaly/blob/master/lib/model.py#L318) use the feature representations of the discriminator for the generator's adversarial loss component. This makes sense as the generator's adversarial loss is some for of L1/L2/MSE, not binary cross entropy.
If I'm correct that this is an error, let me know and I can make a pull request.
Thanks
Dataset
N/A
Model
GANomaly
Steps to reproduce the behavior
N/A. Error is evident from the code.
OS information
N/A
Expected behavior
Either the generator's adversarial loss should use the discriminator's feature representations, or the adversarial loss should be changed to binary cross entropy loss on the discriminator's predictions for the fake images.
Screenshots
No response
Pip/GitHub
pip
What version/branch did you use?
No response
Configuration YAML
N/A
Logs
N/A
Code of Conduct
[X] I agree to follow this project's Code of Conduct
Describe the bug
The GANomaly paper and original implementation (https://github.com/samet-akcay/ganomaly/blob/master/lib/model.py#L318) use the feature representations of the discriminator for the generator's adversarial loss component. This makes sense as the generator's adversarial loss is some for of L1/L2/MSE, not binary cross entropy.
However, the anomalib implementation is calculating the adversarial loss based on the output probabilities of the discriminator, not the feature representations. See https://github.com/openvinotoolkit/anomalib/blob/main/src/anomalib/models/image/ganomaly/loss.py#L58
Other relevant lines of code to confirm the issue:
Output from discriminator: https://github.com/openvinotoolkit/anomalib/blob/main/src/anomalib/models/image/ganomaly/torch_model.py#L243 https://github.com/openvinotoolkit/anomalib/blob/main/src/anomalib/models/image/ganomaly/lightning_model.py#L150
Input to loss function: https://github.com/openvinotoolkit/anomalib/blob/main/src/anomalib/models/image/ganomaly/lightning_model.py#L154
If I'm correct that this is an error, let me know and I can make a pull request.
Thanks
Dataset
N/A
Model
GANomaly
Steps to reproduce the behavior
N/A. Error is evident from the code.
OS information
N/A
Expected behavior
Either the generator's adversarial loss should use the discriminator's feature representations, or the adversarial loss should be changed to binary cross entropy loss on the discriminator's predictions for the fake images.
Screenshots
No response
Pip/GitHub
pip
What version/branch did you use?
No response
Configuration YAML
Logs
Code of Conduct