Unverified 提交 17300a4c authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

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

Slight speedup.
上级 2af059c0
......@@ -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
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论