This repository has been archived by the owner on Jun 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
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
b663d98
commit a709809
Showing
17 changed files
with
896 additions
and
850 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ scikit-image>=0.14.0 | |
scikit-learn>=0.20.0 | ||
jupyter>=1.0.0 | ||
flake8 | ||
pytest-cov | ||
autopep8 | ||
ipython | ||
joblib | ||
|
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,20 +1,30 @@ | ||
from delira.data_loading import BaseDataLoader, SequentialSampler | ||
|
||
import numpy as np | ||
import numpy as np | ||
from . import DummyDataset | ||
import unittest | ||
|
||
def test_data_loader(): | ||
np.random.seed(1) | ||
dset = DummyDataset(600, [0.5, 0.3, 0.2]) | ||
sampler = SequentialSampler.from_dataset(dset) | ||
loader = BaseDataLoader(dset, batch_size=16, sampler=sampler) | ||
|
||
assert isinstance(loader.generate_train_batch(), dict) | ||
for key, val in loader.generate_train_batch().items(): | ||
assert len(val) == 16 | ||
assert "label" in loader.generate_train_batch() | ||
assert "data" in loader.generate_train_batch() | ||
assert len(set([_tmp for _tmp in loader.generate_train_batch()["label"]])) == 1 | ||
class DataLoaderTest(unittest.TestCase): | ||
|
||
def test_data_loader(self): | ||
np.random.seed(1) | ||
dset = DummyDataset(600, [0.5, 0.3, 0.2]) | ||
sampler = SequentialSampler.from_dataset(dset) | ||
loader = BaseDataLoader(dset, batch_size=16, sampler=sampler) | ||
|
||
self.assertIsInstance(loader.generate_train_batch(), dict) | ||
|
||
for key, val in loader.generate_train_batch().items(): | ||
self.assertEqual(len(val), 16) | ||
|
||
self.assertIn("label", loader.generate_train_batch()) | ||
self.assertIn("data", loader.generate_train_batch()) | ||
|
||
self.assertEqual( | ||
len(set([_tmp for _tmp in loader.generate_train_batch()["label"]])), | ||
1) | ||
|
||
|
||
if __name__ == '__main__': | ||
test_data_loader() | ||
unittest.main() |
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
Oops, something went wrong.