|
|
@@ -627,13 +627,12 @@ def strip_optimizer(f='weights/best.pt'): # from utils.utils import *; strip_op |
|
|
|
def create_backbone(f='weights/best.pt', s='weights/backbone.pt'): # from utils.utils import *; create_backbone() |
|
|
|
# create backbone 's' from 'f' |
|
|
|
device = torch.device('cpu') |
|
|
|
x = torch.load(f, map_location=device) |
|
|
|
torch.save(x, s) # update model if SourceChangeWarning |
|
|
|
x = torch.load(s, map_location=device) |
|
|
|
|
|
|
|
x['optimizer'] = None |
|
|
|
x['training_results'] = None |
|
|
|
x['epoch'] = -1 |
|
|
|
x['model'].half() # to FP16 |
|
|
|
for p in x['model'].parameters(): |
|
|
|
p.requires_grad = True |
|
|
|
torch.save(x, s) |