How to use EMA model to do evaluation or test? #9162
-
Beta Was this translation helpful? Give feedback.
Replies: 10 comments
-
Do you mean adding EMA to models? All models trained in mmdetection can do evaluation and testing by tools/test.py |
Beta Was this translation helpful? Give feedback.
-
I add custom hook to add EMA during training, but the keys in saved checkpoints is ema_xxx_xxx_xxx, which is hard to transfer to normal key names. I just want to know that is it using EMA model to evaluate results by default if |
Beta Was this translation helpful? Give feedback.
-
In EMA model, we register |
Beta Was this translation helpful? Give feedback.
-
Do you mean directly evaluate results is equal to use the EMA model to evaluate instead of the online model? |
Beta Was this translation helpful? Give feedback.
-
I mean you can directly load the .pth model in tools/test.py. It will test normally. The parameters starting with |
Beta Was this translation helpful? Give feedback.
-
Thanks for the answer. My point is, when we using EMA, there are two models, one is online model, and another is the EMA model (the temporal ensemble model). Just like the student model and the teacher model in mean teacher. I want to know when we evaluate result, which model would be used? |
Beta Was this translation helpful? Give feedback.
-
You can directly use the saved model. EMAHook will swap the ema model and the normal model before CheckPoint saving. |
Beta Was this translation helpful? Give feedback.
-
Code can be found at here |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! Could you give me some advice about how to ensemble the results from different detectors? |
Beta Was this translation helpful? Give feedback.
-
Maybe you can refer to more materials related to ensemble learning. |
Beta Was this translation helpful? Give feedback.
In EMA model, we register
ema_xxx_xxx_
in the model as buffer. The normal keys are also in the model state_dict, so you can directly evaluate results by default.