Closed Coder-GAN closed 1 year ago
@Coder-GAN , yes that is possible. You can load in a pre-trained model with the setup_cfg
function and then train based on a local dataset. Could you please share the bugs that are preventing you from doing this?
On another note, I am currently training a model that should be more transferrable than the existing "220723_withParacouUAV.pth" model.
@PatBall1 - Hi, I just load the pre-trained model locally and try to train it with my dataset, the biggest error seems like the pre-trained model is not available in Model Zoo.
Here is my code: trained_model = "/home/gan/detectree/detectree2/model_garden/220723_withParacouUAV.pth" trains = ("GAN1212_train",) tests = ("GAN1212_val",) model_out = site_path + "/221212_train_outputs" cfg = setup_cfg(trained_model , trains , tests , workers = 4, eval_period=25, max_iter=5000, out_dir=model_out)
RuntimeError: /home/gan/detectree/detectree2/model_garden/220723_withParacouUAV.pth not available in Model Zoo!
@PatBall1 -Hi, thanks a lot for the comments and guidance. I just realized I made a stupid mistake about the code, it's quite easy to use a pre-trained model to train the local dataset. The reason was I forgot to add the "update_model" to the code.
Here is my modified code: base_model = "COCO-InstanceSegmentation/mask_rcnn_R_101_FPN_3x.yaml" trained_model = "/home/gan/detectree/detectree2/model_garden/220723_withParacouUAV.pth" trains = ("GAN1212_train",) tests = ("GAN1212_val",) model_out = site_path + "/221212_train_outputs" cfg = setup_cfg(base_model, trains , tests , update_model = trained_model ,workers = 4, eval_period=25, max_iter=5000, out_dir=model_out) trainer = MyTrainer(cfg, patience = 5) trainer.resume_or_load(resume=True) trainer.train()
So far, the model part seems no problem but the dataset occurs some errors, I am continuous try to re-manage my dataset to let it satisfy the model input, seems I didn't register the train data successfully, By the way, if possible, it's much appreciated that if you can publish the latest tutorial for training, evaluation, prediction of detectree2. The existing tutorial is quite a mess and complex for users I think.
I have uploaded some pre-trained models in the model_garden
. The simplest way to access them is with wget
e.g.
!wget https://github.com/PatBall1/detectree2/raw/master/model_garden/230103_randresize_full.pth
The loading the model directly
trained_model = "./230103_randresize_full.pth"
cfg = setup_cfg(update_model=trained_model)
predict_on_data(tiles_path, DefaultPredictor(cfg))
Hi guys, I am considering whether we can use the pre-trained model like "220723_withParacouUAV.pth" to train with local datasets continuously. I had tried the idea but got lots of bugs that I couldn't fix. Did anyone try and have better solutions?