Merge branch 'master' into argparse

This commit is contained in:
Glenn Jocher 2018-12-06 13:13:35 +01:00 committed by GitHub
commit c63e96bc82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -36,12 +36,11 @@ def detect(
if weights_file_path.endswith('.pt'): # pytorch format if weights_file_path.endswith('.pt'): # pytorch format
if weights_file_path.endswith('weights/yolov3.pt') and not os.path.isfile(weights_file_path): if weights_file_path.endswith('weights/yolov3.pt') and not os.path.isfile(weights_file_path):
os.system('wget https://storage.googleapis.com/ultralytics/yolov3.pt -O ' + weights_file_path) os.system('wget https://storage.googleapis.com/ultralytics/yolov3.pt -O ' + weights_file_path)
else: # darknet format
load_weights(model, weights_file_path)
checkpoint = torch.load(weights_file_path, map_location='cpu') checkpoint = torch.load(weights_file_path, map_location='cpu')
model.load_state_dict(checkpoint['model']) model.load_state_dict(checkpoint['model'])
del checkpoint del checkpoint
else: # darknet format
load_weights(model, weights_file_path)
# current = model.state_dict() # current = model.state_dict()
# saved = checkpoint['model'] # saved = checkpoint['model']