Improved BGR2RGB speeds (#3880)

* Update BGR2RGB ops

* speed improvements

* cleanup
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-07-04 20:12:32 +02:00
1 parent 9e8fb9fd0b
commit 3c3f8fbd5d
2 files changed
+5 -6

No files matched your search

+1 -1
View File
@@ -259,7 +259,7 @@ class AutoShape(nn.Module):
files.append(Path(f).with_suffix('.jpg').name)
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
im = im[..., :3] if im.ndim == 3 else np.tile(im[..., None], 3) # enforce 3ch input
s = im.shape[:2] # HWC
shape0.append(s) # image shape
g = (size / max(s)) # gain