Преглед изворни кода

autoShape forward im = np.asarray(im) # to numpy (#2689)

Slight speedup.
5.0
Glenn Jocher GitHub пре 3 година
родитељ
комит
17300a4c7b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 измењених фајлова са 2 додато и 1 уклоњено
  1. +2
    -1
      models/common.py

+ 2
- 1
models/common.py Прегледај датотеку

@@ -258,7 +258,8 @@ class autoShape(nn.Module):
im, f = Image.open(requests.get(im, stream=True).raw if im.startswith('http') else im), im # open
im.filename = f # for uri
files.append(Path(im.filename).with_suffix('.jpg').name if isinstance(im, Image.Image) else f'image{i}.jpg')
im = np.array(im) # to numpy
if not isinstance(im, np.ndarray):
im = np.asarray(im) # to numpy
if im.shape[0] < 5: # image in CHW
im = im.transpose((1, 2, 0)) # reverse dataloader .transpose(2, 0, 1)
im = im[:, :, :3] if im.ndim == 3 else np.tile(im[:, :, None], 3) # enforce 3ch input

Loading…
Откажи
Сачувај