GithubHelp home page GithubHelp logo

doubt about encoder loss about ganomaly HOT 7 CLOSED

ybpaopao avatar ybpaopao commented on August 20, 2024
doubt about encoder loss

from ganomaly.

Comments (7)

samet-akcay avatar samet-akcay commented on August 20, 2024 1

Hi @ybpaopao, if the error gets stuck between 0 and 27.631, then it is highly likely that mode collapse occurs. How do you train UCSD? Are you working with full images, or sliding window patches?

For the adversarial loss, we tried both, and as we said in the paper, feature matching works better. Seems like we forgot to update the code, though. I’ll update the code accordingly.

from ganomaly.

samet-akcay avatar samet-akcay commented on August 20, 2024

Hi,
Thanks for spotting this! Actually, that is a typo in the paper, which should have been L2 (copy paste issues :) ). However, the results are quite similar when we use L1 as well. You could check it out if you want.

Concerning the loss function, there is no need to do so. When we use the original L1 or L2 loss, we have the following error:

"nn criterions don't compute the gradient w.r.t. targets - please " \
AssertionError: nn criterions don't compute the gradient w.r.t. targets - please mark these tensors as not requiring gradients

The error is because the original L1 or L2 loss functions that come with PyTorch expects two variables, the first of which should be set_grad=True, while the latter of which should be set_grad=False. In our case, however, we have two variables, both of which should be set_grad=True. When we use the function we created (l1_loss), the output of the function is a variable whose gradients are computed by default. You could read more about this from the following link:

https://discuss.pytorch.org/t/how-to-calculate-l1-loss-between-two-variables/2204/4

from ganomaly.

ybpaopao avatar ybpaopao commented on August 20, 2024

@samet-akcay Thanks for your reply and i'm now understand the loss used in the code. Yes, I found that L1 loss and L2 loss actually achieved similar results. In addition, I wonder if you have tried your method in anomaly detection in videos, such as the UCSD as you mentioned in your code. Does you code can directly read images as input or you have processed the video data before you run GAnomaly? Thanks!

from ganomaly.

samet-akcay avatar samet-akcay commented on August 20, 2024

We haven't trained UCSD, but one chap opened another issue here #10, raising UCSD training. Most of the video anomaly detection papers use temporal information within the UCSD, which we cannot do via Ganomaly. However, we could still train it like we do for the UBA dataset in the paper. You could read more about this here README.md.

from ganomaly.

ybpaopao avatar ybpaopao commented on August 20, 2024

@samet-akcay Hi, I wonder if there are any functional differences between your codes of torch0.3 and torch0.4. Are they just implemented with different version of pytorch?

from ganomaly.

samet-akcay avatar samet-akcay commented on August 20, 2024

@ybpaopao , There is no functional difference. As you said, the only difference is the PyTorch version.

from ganomaly.

ybpaopao avatar ybpaopao commented on August 20, 2024

@samet-akcay Hi, I tried to implement the work in video anomaly detection. However, I meet some problems when I test the code in UCSD PED dataset according the guidance you provided in readme.txt. The err_d_real and err_d_fake are always 0 and 27.631 from the first iteration. I guess may be the DNet did not work very well. By the way, the adversarial loss you defined in your paper is the L2 loss between the DNet outputs of real sample and a fake generated sample. But I found in the code that "self.err_g_bce = self.bce_criterion(self.out_g, self.label)". It seems that you use the binary entropy-cross error between the true label and the DNet output of the fake generated sample. Does this matters? Or do you have any suggestions about the strange err_d_real and err_d_fake?

from ganomaly.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.