glenn-jocher
commited on
Commit
•
d681799
1
Parent(s):
6f3db5e
Update export.py
Browse files- models/export.py +4 -4
models/export.py
CHANGED
@@ -9,7 +9,7 @@ import argparse
|
|
9 |
import torch
|
10 |
import torch.nn as nn
|
11 |
|
12 |
-
|
13 |
from models.experimental import attempt_load
|
14 |
from utils.activations import Hardswish
|
15 |
from utils.general import set_logging
|
@@ -33,10 +33,10 @@ if __name__ == '__main__':
|
|
33 |
# Update model
|
34 |
for k, m in model.named_modules():
|
35 |
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatability
|
36 |
-
if isinstance(m, Conv) and isinstance(m.act, nn.Hardswish):
|
37 |
m.act = Hardswish() # assign activation
|
38 |
-
# if isinstance(m, Detect):
|
39 |
-
#
|
40 |
model.model[-1].export = True # set Detect() layer export=True
|
41 |
y = model(img) # dry run
|
42 |
|
|
|
9 |
import torch
|
10 |
import torch.nn as nn
|
11 |
|
12 |
+
import models
|
13 |
from models.experimental import attempt_load
|
14 |
from utils.activations import Hardswish
|
15 |
from utils.general import set_logging
|
|
|
33 |
# Update model
|
34 |
for k, m in model.named_modules():
|
35 |
m._non_persistent_buffers_set = set() # pytorch 1.6.0 compatability
|
36 |
+
if isinstance(m, models.common.Conv) and isinstance(m.act, nn.Hardswish):
|
37 |
m.act = Hardswish() # assign activation
|
38 |
+
# if isinstance(m, models.yolo.Detect):
|
39 |
+
# m.forward = m.forward_export # assign forward (optional)
|
40 |
model.model[-1].export = True # set Detect() layer export=True
|
41 |
y = model(img) # dry run
|
42 |
|