Skip to content

Commit

Permalink
pretrained=False fix (#5966)
Browse files Browse the repository at this point in the history
* `pretriained=False` fix

Fix for ultralytics/yolov5#5964

* CI speed improvement
  • Loading branch information
SecretStar112 committed Dec 13, 2021
1 parent 32f9d1c commit a4254bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _create(name, pretrained=True, channels=3, classes=80, autoshape=True, verbo
model = DetectMultiBackend(path, device=device) # download/load FP32 model
# model = models.experimental.attempt_load(path, map_location=device) # download/load FP32 model
else:
cfg = list((Path(__file__).parent / 'models').rglob(f'{path.name}.yaml'))[0] # model.yaml path
cfg = list((Path(__file__).parent / 'models').rglob(f'{path.stem}.yaml'))[0] # model.yaml path
model = Model(cfg, channels, classes) # create model
if pretrained:
ckpt = torch.load(attempt_download(path), map_location=device) # load
Expand Down Expand Up @@ -138,6 +138,6 @@ def yolov5x6(pretrained=True, channels=3, classes=80, autoshape=True, verbose=Tr
Image.open('data/images/bus.jpg'), # PIL
np.zeros((320, 640, 3))] # numpy

results = model(imgs) # batched inference
results = model(imgs, size=320) # batched inference
results.print()
results.save()

0 comments on commit a4254bf

Please sign in to comment.