Coder Social home page Coder Social logo

Comments (9)

xwu6614555 avatar xwu6614555 commented on June 17, 2024

def adjust_learning_rate_poly(optimizer, iteration, max_iter):
"""Sets the learning rate
# Adapted from PyTorch Imagenet example:
# https://github.com/pytorch/examples/blob/master/imagenet/main.py
"""
lr = initial_lr * ( 1 - (iteration / max_iter)) * ( 1 - (iteration / max_iter))
if ( lr < 1.0e-7 ):
lr = 1.0e-7
return lr

learning_rate is not adjusted at all!
add these codes before return lr:
for param_group in optimizer.param_groups:
param_group['lr'] = lr
Maybe this can solve the problem

from libfacedetection.train.

waries avatar waries commented on June 17, 2024

def adjust_learning_rate_poly(optimizer, iteration, max_iter):
"""Sets the learning rate

Adapted from PyTorch Imagenet example:

https://github.com/pytorch/examples/blob/master/imagenet/main.py

"""
lr = initial_lr * ( 1 - (iteration / max_iter)) * ( 1 - (iteration / max_iter))
if ( lr < 1.0e-7 ):
lr = 1.0e-7
return lr

learning_rate is not adjusted at all!
add these codes before return lr:
for param_group in optimizer.param_groups:
param_group['lr'] = lr
Maybe this can solve the problem

Thanks for pointing that out, I'll try that and post the new result later.

from libfacedetection.train.

waries avatar waries commented on June 17, 2024

After modifying the lr code, the final result with scales=[1.], confidence_threshold=0.3 is
Easy Val AP: 0.8285190221051939
Medium Val AP: 0.7929441126273071
Hard Val AP: 0.5663795815749137

from libfacedetection.train.

ShiqiYu avatar ShiqiYu commented on June 17, 2024

the learning rate is adapted according to epoches, not iterations

from libfacedetection.train.

ShiqiYu avatar ShiqiYu commented on June 17, 2024

the learning rate is adapted according to epoches, not iterations

After modifying the lr code, the final result with scales=[1.], confidence_threshold=0.3 is
Easy Val AP: 0.8285190221051939
Medium Val AP: 0.7929441126273071
Hard Val AP: 0.5663795815749137

If you increase batch size to 256, and then fine-tune the mode, you will get a better result.

from libfacedetection.train.

waries avatar waries commented on June 17, 2024

the learning rate is adapted according to epoches, not iterations

After modifying the lr code, the final result with scales=[1.], confidence_threshold=0.3 is
Easy Val AP: 0.8285190221051939
Medium Val AP: 0.7929441126273071
Hard Val AP: 0.5663795815749137

If you increase batch size to 256, and then fine-tune the mode, you will get a better result.

Thank you for your guidance, I'll try it and post the new result. About fine-tune, does the initial lr need to be set to a smaller value?

from libfacedetection.train.

ShiqiYu avatar ShiqiYu commented on June 17, 2024

You can use the same lr, but start from the 200th epoch.

from libfacedetection.train.

waries avatar waries commented on June 17, 2024

You can use the same lr, but start from the 200th epoch.

Thank you so much for your guidence!

from libfacedetection.train.

waries avatar waries commented on June 17, 2024

After fine-tune, the new result is
Easy Val AP: 0.8321736396427939
Medium Val AP: 0.7988401596758341
Hard Val AP: 0.579757106591874
I see professor Yu update the new result yesterday. So even though my new result is better than the original score which is tested on the model without fine-tune, there still exist a huge differences in the final result between the fine-tune model I trained and the official fine-tune model.
I train the first edition model with batchsize 8 and 500 epochs, then use the final model to fine-tune with batch size 256 and start at epoch 200/500. I'm not sure which step was wrong,maybe the best way is to use pretrained model directly, LOL.

You can use the same lr, but start from the 200th epoch.

from libfacedetection.train.

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.