-
Notifications
You must be signed in to change notification settings - Fork 7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[fbsync] cleanup prototype datasets (#4471)
Summary: * cleanup image folder * make shuffling mandatory * rename parameter in home() function * don't show builtin list * make categories optional in dataset info * use pseudo-infinite buffer size for shuffler Reviewed By: datumbox Differential Revision: D31268046 fbshipit-source-id: e7d66ecdc1c8250cabb8385d116daea32ef0899b Co-authored-by: Francisco Massa <fvsmassa@gmail.com>
- Loading branch information
1 parent
18fdaac
commit 3d6b42c
Showing
7 changed files
with
24 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import io | ||
|
||
import numpy as np | ||
import PIL.Image | ||
import torch | ||
|
||
from torchvision.transforms.functional import pil_to_tensor | ||
|
||
__all__ = ["pil"] | ||
|
||
|
||
def pil(file: io.IOBase, mode: str = "RGB") -> torch.Tensor: | ||
image = PIL.Image.open(file).convert(mode.upper()) | ||
return torch.from_numpy(np.array(image, copy=True)).permute((2, 0, 1)) | ||
return pil_to_tensor(PIL.Image.open(file).convert(mode.upper())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters