-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c10e27
commit 1f2c9b5
Showing
528 changed files
with
5,930 additions
and
4,310 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
name: SROIE2019 | ||
channels: | ||
- conda-forge | ||
- pytorch | ||
- defaults | ||
dependencies: | ||
- python=3.7 | ||
- pip | ||
- numpy | ||
- cudnn | ||
- pytorch | ||
- python=3.7 | ||
- torchvision | ||
- cudatoolkit | ||
- cudnn | ||
- opencv | ||
- python-Levenshtein | ||
- scikit-learn | ||
- fuzzywuzzy | ||
- pyyaml | ||
- visdom | ||
- jsonpatch | ||
- pytorch-model-summary | ||
- regex | ||
- yacs | ||
- pip: | ||
- vizer | ||
- yacs | ||
- regex | ||
- numpy | ||
- visdom | ||
- PyYAML | ||
- tabulate | ||
- opencv-python | ||
- pytorch-model-summary |
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .data_loader import dataloader as Dataloader |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import torch | ||
|
||
from typing import Optional | ||
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler, BatchSampler | ||
|
||
|
||
def dataloader(dataset: Dataset, is_train: Optional[bool] = False, **kwargs): | ||
""" | ||
Create the :class:`torch.utils.data.DataLoader` with given parameters. | ||
Args: | ||
dataset (Dataset): The dataset to iterate through. | ||
is_train (bool , optional): A boolean to check whether the training mode is activated or not. | ||
**kwargs: The dataloader parameters. | ||
Returns: | ||
An iterable over the given dataset. | ||
""" | ||
shuffle = kwargs.get("shuffle", None) | ||
|
||
if not is_train or shuffle is None or not shuffle: | ||
sampler = SequentialSampler(data_source=dataset) | ||
else: | ||
generator = kwargs.get("generator", None) | ||
if generator is None: | ||
generator = torch.Generator(device=torch.device("cpu")) | ||
sampler = RandomSampler(dataset, generator=generator) | ||
|
||
batch_size = kwargs["batch_size"] | ||
drop_last = kwargs["drop_last"] | ||
batch_sampler = BatchSampler(sampler=sampler, batch_size=batch_size, drop_last=drop_last) | ||
|
||
# Once we set the following arguments below, we must remove them. Otherwise, we will get a ValueError: | ||
# batch_sampler option is mutually exclusive with batch_size, shuffle, sampler, and drop_last | ||
kwargs.pop("shuffle") | ||
kwargs.pop("batch_size") | ||
kwargs.pop("drop_last") | ||
|
||
kwargs["batch_sampler"] = batch_sampler | ||
dataloader = DataLoader(dataset=dataset, **kwargs) | ||
|
||
return dataloader |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
from .split_labels import crop_preprocessing |
Oops, something went wrong.