How to train the interaction head individually #50
-
Hi Fred, I would like to know that, how to freeze detector weights to train the interaction head individually? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 4 replies
-
Hi @xiaoxiaoczw, The detector weights are in fact frozen already. We fine-tuned the object detector as a first stage and only train the interaction head next. The corresponding code is here. for p in upt.detector.parameters():
p.requires_grad = False
param_dicts = [{
"params": [p for n, p in upt.named_parameters()
if "interaction_head" in n and p.requires_grad]
}] Fred. |
Beta Was this translation helpful? Give feedback.
-
Hi Fred, Thanks for your quick feedback! |
Beta Was this translation helpful? Give feedback.
-
To get the best performance, you would want to fine-tune the object detector on the custom dataset first, and then train the interaction head. But if the custom dataset has the same set of objects and you don't want to go through the trouble, you can just load the provided detector weights. You can choose amongst the pre-trained MS COCO weights, fine-tuned HICO-DET weights and the fine-tuned V-COCO weights. Which one works the best for you really depends on the dataset similarity. It would be hard to guess without running experiments. Fred. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion! |
Beta Was this translation helpful? Give feedback.
-
Hi @fredzzhang, I have already fine-tune the object detector on the custom dataset, but when I train UPT with this fine-tuned weights, I tried various batch sizes like 4/8/16, always showing 'The HOI loss is NaN', could you please give me some advice in this case? Thanks! |
Beta Was this translation helpful? Give feedback.
Hi @xiaoxiaoczw,
The detector weights are in fact frozen already. We fine-tuned the object detector as a first stage and only train the interaction head next. The corresponding code is here.
Fred.