Initial model ensemble capability #318

This commit is contained in:
Glenn Jocher committed 2020-07-07 15:40:50 -07:00
1 parent 121d90b3f2
commit e8cf24b6c8
4 files changed
+33 -20

No files matched your search

+3 -4
View File
@@ -2,7 +2,7 @@ import argparse
import torch.backends.cudnn as cudnn
from utils import google_utils
from models.experimental import *
from utils.datasets import *
from utils.utils import *
@@ -20,8 +20,7 @@ def detect(save_img=False):
half = device.type != 'cpu' # half precision only supported on CUDA
# Load model
google_utils.attempt_download(weights)
model = torch.load(weights, map_location=device)['model'].float().eval() # load FP32 model
model = attempt_load(weights, map_location=device) # load FP32 model
imgsz = check_img_size(imgsz, s=model.stride.max()) # check img_size
if half:
model.half() # to FP16
@@ -137,7 +136,7 @@ def detect(save_img=False):
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--weights', type=str, default='weights/yolov5s.pt', help='model.pt path')
parser.add_argument('--weights', nargs='+', type=str, default='yolov5s.pt', help='model.pt path(s)')
parser.add_argument('--source', type=str, default='inference/images', help='source') # file/folder, 0 for webcam
parser.add_argument('--output', type=str, default='inference/output', help='output folder') # output folder
parser.add_argument('--img-size', type=int, default=640, help='inference size (pixels)')