mirror of
https://github.com/ultralytics/yolov5.git
synced 2025-06-03 14:49:29 +08:00
create_backbone with SourceChangeWarning update
This commit is contained in:
parent
546f973562
commit
1f698af6f1
@ -557,7 +557,11 @@ 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'
|
||||
x = torch.load(f, map_location=torch.device('cpu'))
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user