Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to choose the best model? #5

Open
ppbangKGT opened this issue Mar 20, 2023 · 12 comments
Open

How to choose the best model? #5

ppbangKGT opened this issue Mar 20, 2023 · 12 comments

Comments

@ppbangKGT
Copy link

Thanks for your open-source codes. When I train the model, I find that it seems that you don't use tensorboard to record the loss or F1-score. And the total performance of one epoch isn't recorded either. So I wonder how to choose the best model I have got. Should I run the val_openlane.py on each of the models I trained? Or maybe I miss something important.
Thanks for your reply.

@rhwang1314
Copy link
Collaborator

Sorry, we only provided a simple version of the code. You can add tensorboard to your code according to your needs. In fact, we usually choose the latest model for testing.

@ppbangKGT
Copy link
Author

Sorry, we only provided a simple version of the code. You can add tensorboard to your code according to your needs. In fact, we usually choose the latest model for testing.

I have trained 30 epochs. I remember the result in your paper is gotten in 10 epochs on OpenLane dataset.
So is that mean you use the 10th trained model for testing? And it gets the best performance?
Thanks for your reply.

@rhwang1314
Copy link
Collaborator

We found that the effects of the model of 10th epoch and models of continue training were not significantly different.

@ppbangKGT
Copy link
Author

And I find it seems that your codes can't resume training though there is a funtion called "resume_training".

@FeiYull
Copy link

FeiYull commented Apr 13, 2023

@ppbangKGT it seems so

@vanAken
Copy link

vanAken commented Apr 23, 2023

There are some small changes to do to use it:
in
bev_lane_det/models/util/save_model.py

def save_model_dp
make sure

torch.save({
"model_state": net.module.state_dict(),
"optimizer_state": optimizer.state_dict() if optimizer else None,
}, model_path)
has the same names in
bev_lane_det/models/util/load_model.py

def load_model(model, model_state_file):
pretrained_dict = torch.load(model_state_file, map_location='cpu')
if 'model_state' in pretrained_dict:
pretrained_dict1 = pretrained_dict['model_state']
elif 'state_dict' in pretrained_dict:
pretrained_dict1 = pretrained_dict['state_dict']

@ppbangKGT
Copy link
Author

There are some small changes to do to use it: in bev_lane_det/models/util/save_model.py

def save_model_dp make sure

torch.save({ "model_state": net.module.state_dict(), "optimizer_state": optimizer.state_dict() if optimizer else None, }, model_path) has the same names in bev_lane_det/models/util/load_model.py

def load_model(model, model_state_file): pretrained_dict = torch.load(model_state_file, map_location='cpu') if 'model_state' in pretrained_dict: pretrained_dict1 = pretrained_dict['model_state'] elif 'state_dict' in pretrained_dict: pretrained_dict1 = pretrained_dict['state_dict']

Yes, there can be different methods to resume training. What I do is :

  1. still use resume_training and load_checkpoint functions.
  2. make sure the 'model_state' and 'optimizer_state' in load_checkpoint function are the same as those in save_model_dp function.
  3. scheduler.step() seems to change to the epoch which I have trained.
    The load_model function is only used in validation code originally. So I don't change it.

@EnternalTwinkle
Copy link

@ppbangKGT Can you share the source code? Thank you very much,1017094591@qq.com

@dagongji10
Copy link

@ppbangKGT hello, would you please share me the source code? 405612048@qq.com

@24werewolf
Copy link

@ppbangKGT hello, would you please share me the source code? 1653658300@qq.com

@hitbuyi
Copy link

hitbuyi commented Nov 11, 2023

@ppbangKGT hello, would you please share me the source code? hitbuyi@163.com

@shupinghu
Copy link

Hello, I am a new researcher of 3D-BEV-LaneDet, could you please share the source code with me?
My Email hushp3@qq.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants