-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Connected processing to loading the dataset. #11
Changes from 1 commit
20d7f1e
392aacd
67ee80b
589dfd0
62275de
a4b8b31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
DISK_CLASSES_MISSING = ["2b3a", "1b23"] | ||
DISK_CLASSES_NONE = None | ||
DATATYPE_MRC = "mrc" | ||
TRANSFORM_ALL = "rescale,normalise,gaussianblur,shiftmin" | ||
TRANSFORM_SOME = "rescale,gaussianblur" | ||
|
||
|
||
def test_class_instantiation(): | ||
|
@@ -127,3 +129,33 @@ def test_get_loader_training_fail(): | |
torch_loader_train, torch_loader_val = test_loader.get_loader( | ||
split_size=1, batch_size=64 | ||
) | ||
|
||
|
||
def test_processing_data_all_transforms(): | ||
test_loader = DiskDataLoader( | ||
pipeline=DISK_PIPELINE, | ||
classes=DISK_CLASSES_FULL, | ||
dataset_size=DATASET_SIZE_ALL, | ||
training=True, | ||
transformations=TRANSFORM_ALL, | ||
) | ||
test_loader.load(datapath=TEST_DATA_MRC, datatype=DATATYPE_MRC) | ||
assert test_loader.dataset.normalise | ||
assert test_loader.dataset.shiftmin | ||
assert test_loader.dataset.gaussianblur | ||
assert test_loader.dataset.rescale | ||
|
||
|
||
def test_processing_data_some_transforms(): | ||
test_loader = DiskDataLoader( | ||
pipeline=DISK_PIPELINE, | ||
classes=DISK_CLASSES_FULL, | ||
dataset_size=DATASET_SIZE_ALL, | ||
training=True, | ||
transformations=TRANSFORM_SOME, | ||
) | ||
test_loader.load(datapath=TEST_DATA_MRC, datatype=DATATYPE_MRC) | ||
assert not test_loader.dataset.normalise | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we could add a test to make sure the transformation is happening, e.g. that the output dataset (for an example data point) is different if you pass a transformation to passing none. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Latest commit addresses this!! I hope that's ok, made a debug flag that doesn't shuffle the paths so we can test the processing is happening. |
||
assert not test_loader.dataset.shiftmin | ||
assert test_loader.dataset.gaussianblur | ||
assert test_loader.dataset.rescale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it will be good to test the data loader returning what we want, I think here we have only tested that the class variables are correct (which is great!) but we won't catch things like the data loader not returning the right size of data, or selecting correctly the labels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a solid point! I checked it but realised it was only on a local function, I'll make that into assertions here