BiRefNet icon indicating copy to clipboard operation
BiRefNet copied to clipboard

Model name correspondence

Open YUANMU227 opened this issue 1 year ago • 6 comments

In the general use task, the model corresponding to DIS5K-TR,DIS-TEs, DUTS-TR_TE,HRSOD-TR_TE,UHRSD-TR_TE, HRS10K-TR_TE, TR-P3M-10k, TE-P3M-500-NP, TE-P3M-500-P, TR-humans is BiRefNet-general-epoch_244.pth. But in stuff--https://drive.google.com/drive/folders/1s2Xe0cjq-2ctnJBR24563yMSCOu4CcxM, there are two models, BiRefNet-massive-TR_DIS5K_TR_TEs-epoch_420.pth and BiRefNet-massive-epoch_240.pth. Which of these models works best for general use tasks? And if I want to perform ft on these models, do I need to modify the script and configuration? Thank you for your suggestions.

YUANMU227 avatar Jul 29 '24 09:07 YUANMU227

I chose BiRefNet-general-epoch_244.pth, changed its path and name to ckpt/general/epoch_1.pth, and then added the resume parameter in train.sh, which can run normally:

echo "Multi-GPU mode received..." CUDA_VISIBLE_DEVICES=${devices}
torchrun --nproc_per_node $((nproc_per_node+1)) --master_port=${3:-8989}
train.py --ckpt_dir ckpt/${method} --epochs ${epochs}
--testsets ${testsets}
--dist ${to_be_distributed}
--resume ckpt/general/epoch_1.pth

Due to limited computing resources, I plan to use the training set "DIS5K-TR,DIS-TEs, DUTS-TR_TE,HRSOD-TR_TE,UHRSD-TR_TE, HRS10K-TR_TE, TR-P3M-10k, TE-P3M-500-NP, TE-P3M-500-P, TR-humans", plus my own dataset, and fine-tune the training together.

Do you have any suggestions for modifying parameters such as lr and the number of epochs?

YUANMU227 avatar Jul 29 '24 10:07 YUANMU227

They were both trained for general use. However, for the massive one (earlier one), portrait seg data was not included in the training data. Therefore, I trained the general one with more data on portrait and uploaded it yesterday. In my opinion, I suggest using the latest one (BiRefNet-general-epoch_224.pth).

ZhengPeng7 avatar Jul 29 '24 10:07 ZhengPeng7

You want to add your custom dataset to the general training setting? That would be a really huge computation cost... In my case, 250 epochs was chosen for training the BiRefNet for general use on the general setting from scratch.

I cannot be sure about the better training hyper-params for your experiments, but if you want to fine-tune with that weights file, 1/2 ~ 1/10 of the default lr could be better. And perhaps, you can fine-tune only on your custom dataset for ~50 epochs to take a quick look at the effectiveness, instead of including all the other datasets, since your custom dataset could be a very small number compared to them.

ZhengPeng7 avatar Jul 29 '24 10:07 ZhengPeng7

BTW, if you think the data domain gap between your custom dataset and the datasets in general setting is large, maybe you need to enlarge the lr. On the contrary, turn it down.

ZhengPeng7 avatar Jul 29 '24 10:07 ZhengPeng7

Thank you very much for your suggestion. I tried it and BiRefNet-general-epoch_224.pth is indeed better than the previous model. Great work.

YUANMU227 avatar Jul 30 '24 05:07 YUANMU227

Glad to hear about that :)

ZhengPeng7 avatar Jul 30 '24 07:07 ZhengPeng7

Where do you put the file BiRefNet-general-epoch_244.pth

Thanks

mikevipe avatar Dec 26 '24 18:12 mikevipe

All the places... GitHub repo release, google drive, Hugging Face...

ZhengPeng7 avatar Dec 27 '24 13:12 ZhengPeng7