VDIGPKU / DynamicDet

[CVPR 2023] DynamicDet: A Unified Dynamic Architecture for Object Detection

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

关于Variable-speed inference的疑问

yangyahu-1994 opened this issue · comments

作者您好:

image
通过(14)求出来的是分类为“hard”图像的比例,假如0.75,也就是75%的图像被分类为“hard”。那
image
计算的不应该是25%的分位数嘛,这样计算出来的阈值才有75%的图像的难度分数大于它呀。如果直接将0.75放进percentile函数,计算的好像不对啊
image

image
这里First和Second是不是弄反了呀,阈值越大,通过的“hard”图像越少的应该是Second啊

DynamicDet/models/yolo.py

Lines 236 to 245 in 4dbb9b2

if self.dynamic:
score = self.router([y[i] for i in self.router_ins]) # 'score' denotes the (1 - difficulty score)
if not hasattr(self, 'get_score'):
self.get_score = False
if self.get_score:
return score
need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)

That is, 'score' in our code denotes the (1 - difficulty score). So, it is ok~

DynamicDet/models/yolo.py

Lines 236 to 245 in 4dbb9b2

if self.dynamic:
score = self.router([y[i] for i in self.router_ins]) # 'score' denotes the (1 - difficulty score)
if not hasattr(self, 'get_score'):
self.get_score = False
if self.get_score:
return score
need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)

That is, 'score' in our code denotes the (1 - difficulty score). So, it is ok~

作者您好:
score = self.router([y[i] for i in self.router_ins]) 计算出来的就是difficulty score啊,怎么会是1 - difficulty score呢? @LZHgrla

DynamicDet/models/yolo.py

Lines 244 to 245 in 4dbb9b2

need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)

分数足够低会选择second,分数足够高则会选择first。因此,这是由训练决定的,只要训练与推理统一即可。

DynamicDet/models/yolo.py

Lines 244 to 245 in 4dbb9b2

need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)

分数足够低会选择second,分数足够高则会选择first。因此,这是由训练决定的,只要训练与推理统一即可。

image
由这里决定?奖励的检测器乘的是1- difficulty score,所以拟合出来的score实际上是1- difficulty score?
那我把这里的score和1-score调换后,计算出来的score就表示difficulty score了吧?

DynamicDet/models/yolo.py

Lines 244 to 245 in 4dbb9b2

need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)

除了loss要修改,模型的forward也需要修改(分数足够大则走second,足够小则走first)。修改后即可认为score是difficulty score

DynamicDet/models/yolo.py

Lines 244 to 245 in 4dbb9b2

need_second = self.training or (not self.dynamic) or score[:, 0] < self.dy_thres
need_first_head = self.training or (self.dynamic and score[:, 0] >= self.dy_thres)

除了loss要修改,模型的forward也需要修改(分数足够大则走second,足够小则走first)。修改后即可认为score是difficulty score

原来如此,感谢您的耐心解答。