gigo-team / bev_lane_det

229 stars 66 forks source link

How to choose the best model? #5

Open ppbangKGT opened 1 year ago

ppbangKGT commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

ppbangKGT commented 1 year ago

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

FeiYull commented 1 year ago

@ppbangKGT it seems so

vanAken commented 1 year ago

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 commented 1 year ago

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 commented 11 months ago

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

dagongji10 commented 10 months ago

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

24werewolf commented 8 months ago

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

hitbuyi commented 7 months ago

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

shupinghu commented 1 month ago

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