glenn-jocher commited on
Commit
e8ef8fb
1 Parent(s): 19c56e6

`pretrained=False` fix (#5966)

Browse files

* `pretriained=False` fix

Fix for https://github.com/ultralytics/yolov5/issues/5964

* CI speed improvement

Files changed (1) hide show
  1. hubconf.py +2 -2
hubconf.py CHANGED
@@ -46,7 +46,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
46
  model = DetectMultiBackend(path, device=device) # download/load FP32 model
47
  # model = models.experimental.attempt_load(path, map_location=device) # download/load FP32 model
48
  else:
49
- cfg = list((Path(__file__).parent / 'models').rglob(f'{path.name}.yaml'))[0] # model.yaml path
50
  model = Model(cfg, channels, classes) # create model
51
  if pretrained:
52
  ckpt = torch.load(attempt_download(path), map_location=device) # load
@@ -138,6 +138,6 @@ if __name__ == '__main__':
138
  Image.open('data/images/bus.jpg'), # PIL
139
  np.zeros((320, 640, 3))] # numpy
140
 
141
- results = model(imgs) # batched inference
142
  results.print()
143
  results.save()
 
46
  model = DetectMultiBackend(path, device=device) # download/load FP32 model
47
  # model = models.experimental.attempt_load(path, map_location=device) # download/load FP32 model
48
  else:
49
+ cfg = list((Path(__file__).parent / 'models').rglob(f'{path.stem}.yaml'))[0] # model.yaml path
50
  model = Model(cfg, channels, classes) # create model
51
  if pretrained:
52
  ckpt = torch.load(attempt_download(path), map_location=device) # load
 
138
  Image.open('data/images/bus.jpg'), # PIL
139
  np.zeros((320, 640, 3))] # numpy
140
 
141
+ results = model(imgs, size=320) # batched inference
142
  results.print()
143
  results.save()