How to implement a custom loss without rewriting box_predictor #2559
Replies: 2 comments 3 replies
-
detectron2/detectron2/modeling/roi_heads/fast_rcnn.py Lines 398 to 413 in 6d25060 |
Beta Was this translation helpful? Give feedback.
-
Hey @alexander-soare, @ppwwyyxx
Any idea what's causing this issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
My goal is to apply label smoothing to the classification loss. So I write a new ROIHeads class:
Actually I haven't done anything new there, but I'm trying to figure out how to replace
self.box_predictor
. In the docs, this example is given:But it's not clear to me how I can make use of the existing
MyFastRCNNOutputLayers
class. Because I'd like to replace theloss
method there, something like this:The problem is, I have no idea how and where to init this.
StandardROIHeads
does not init thebox_predictor
but rather, it's passed in as an argument. And there are multiple instances ofStandardROIHeads
in an FPN framework, which only complicates things more, because it means I probably need to do the initialisation somewhere upstream.I realised that maybe if I knew what was supposed to go in the ellipsis from the example in the docs:
... I would be able to solve it. But the init signature of
FastRCNNOutputLayers
requires arguments which I don't know where to obtain.Beta Was this translation helpful? Give feedback.
All reactions