shachargluska commited on
Commit
ea6c947
·
1 Parent(s): ec212cf

Feature/ support setting activation functions for yolox models (#743)

Browse files
Files changed (2) hide show
  1. exps/default/nano.py +2 -2
  2. yolox/exp/yolox_base.py +3 -2
exps/default/nano.py CHANGED
@@ -33,8 +33,8 @@ class Exp(MyExp):
33
  from yolox.models import YOLOX, YOLOPAFPN, YOLOXHead
34
  in_channels = [256, 512, 1024]
35
  # NANO model use depthwise = True, which is main difference.
36
- backbone = YOLOPAFPN(self.depth, self.width, in_channels=in_channels, depthwise=True)
37
- head = YOLOXHead(self.num_classes, self.width, in_channels=in_channels, depthwise=True)
38
  self.model = YOLOX(backbone, head)
39
 
40
  self.model.apply(init_yolo)
 
33
  from yolox.models import YOLOX, YOLOPAFPN, YOLOXHead
34
  in_channels = [256, 512, 1024]
35
  # NANO model use depthwise = True, which is main difference.
36
+ backbone = YOLOPAFPN(self.depth, self.width, in_channels=in_channels, self.act, depthwise=True)
37
+ head = YOLOXHead(self.num_classes, self.width, in_channels=in_channels, self.act, depthwise=True)
38
  self.model = YOLOX(backbone, head)
39
 
40
  self.model.apply(init_yolo)
yolox/exp/yolox_base.py CHANGED
@@ -20,6 +20,7 @@ class Exp(BaseExp):
20
  self.num_classes = 80
21
  self.depth = 1.00
22
  self.width = 1.00
 
23
 
24
  # ---------------- dataloader config ---------------- #
25
  # set worker to 4 for shorter dataloader init time
@@ -80,8 +81,8 @@ class Exp(BaseExp):
80
 
81
  if getattr(self, "model", None) is None:
82
  in_channels = [256, 512, 1024]
83
- backbone = YOLOPAFPN(self.depth, self.width, in_channels=in_channels)
84
- head = YOLOXHead(self.num_classes, self.width, in_channels=in_channels)
85
  self.model = YOLOX(backbone, head)
86
 
87
  self.model.apply(init_yolo)
 
20
  self.num_classes = 80
21
  self.depth = 1.00
22
  self.width = 1.00
23
+ self.act = 'silu'
24
 
25
  # ---------------- dataloader config ---------------- #
26
  # set worker to 4 for shorter dataloader init time
 
81
 
82
  if getattr(self, "model", None) is None:
83
  in_channels = [256, 512, 1024]
84
+ backbone = YOLOPAFPN(self.depth, self.width, in_channels=in_channels, act=self.act)
85
+ head = YOLOXHead(self.num_classes, self.width, in_channels=in_channels, act=self.act)
86
  self.model = YOLOX(backbone, head)
87
 
88
  self.model.apply(init_yolo)