Coder Social home page Coder Social logo

Exploding gradient problem about pytorch-ssd HOT 5 OPEN

qfgaohao avatar qfgaohao commented on July 23, 2024
Exploding gradient problem

from pytorch-ssd.

Comments (5)

tamyiuchau avatar tamyiuchau commented on July 23, 2024 1

I have also come across exploding gradient problem when trying to use mobilenet v2 ssd on Widerface. I am able to bisect the problem to the smooth L1 loss at

smooth_l1_loss = F.smooth_l1_loss(predicted_locations, gt_locations, size_average=False)
.
I suspect it is caused by no default boxes matched. After changing torch.nn.functional.smooth_l1_loss( reduction='sum'), problem is solved.

from pytorch-ssd.

qfgaohao avatar qfgaohao commented on July 23, 2024

@scarmaten have you tried smaller learning rates?

from pytorch-ssd.

9-Time avatar 9-Time commented on July 23, 2024

yup i have tried it with learning rate all the way till 1e-20. still no luck.
The problem was partially solved when I removed Expand(mean), RandomSampleCrop(), RandomMirror() under the trainAugmentation in transformation.py but that would mean that the model's accuracy is much worse

from pytorch-ssd.

qfgaohao avatar qfgaohao commented on July 23, 2024

Hi @scarmaten , one possible way to debug is use a very small, verified dataset as both train and val data to train overfitted models. If you can get a overfitted model with 100% (or almost) accuracy, that means the architecture and system is fine, and the problem might be the data. Otherwise, there is something wrong in the system design.

from pytorch-ssd.

tamyiuchau avatar tamyiuchau commented on July 23, 2024

The question then arise, should I adjust the prior boxes for my specific purposes, or just let it go?(As it is kind of working now)

from pytorch-ssd.

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.