-
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.
* 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 Co-authored-by: Francisco Massa <fvsmassa@gmail.com>
- Loading branch information
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