Merge branch 'master' into advanced_logging

This commit is contained in:
Alex Stoken authored and GitHub committed 2020-07-06 16:52:11 -05:00
commit f517ba81c7
17 files changed
+541 -169

No files matched your search

+3 -6
View File
@@ -26,6 +26,7 @@ def test(data,
# Initialize/load model and set device
if model is None:
training = False
merge = opt.merge # use Merge NMS
device = torch_utils.select_device(opt.device, batch_size=batch_size)
# Remove previous
@@ -34,10 +35,8 @@ def test(data,
# Load model
google_utils.attempt_download(weights)
model = torch.load(weights, map_location=device)['model'].float() # load to FP32
torch_utils.model_info(model)
model.fuse()
model.to(device)
model = torch.load(weights, map_location=device)['model'].float().fuse().to(device) # load to FP32
imgsz = check_img_size(imgsz, s=model.stride.max()) # check img_size
# Multi-GPU disabled, incompatible with .half() https://github.com/ultralytics/yolov5/issues/99
# if device.type != 'cpu' and torch.cuda.device_count() > 1:
@@ -62,7 +61,6 @@ def test(data,
# Dataloader
if dataloader is None: # not training
merge = opt.merge # use Merge NMS
img = torch.zeros((1, 3, imgsz, imgsz), device=device) # init img
_ = model(img.half() if half else img) if device.type != 'cpu' else None # run once
path = data['test'] if opt.task == 'test' else data['val'] # path to val/test images
@@ -246,7 +244,6 @@ if __name__ == '__main__':
parser.add_argument('--merge', action='store_true', help='use Merge NMS')
parser.add_argument('--verbose', action='store_true', help='report mAP by class')
opt = parser.parse_args()
opt.img_size = check_img_size(opt.img_size)
opt.save_json = opt.save_json or opt.data.endswith('coco.yaml')
opt.data = check_file(opt.data) # check file
print(opt)