-
Notifications
You must be signed in to change notification settings - Fork 63
Add "preload" option to Polyps912 dataset #3
Conversation
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.
Thank you for the PR, I like the idea of having a preload
option to preload the dataset in memory.
dataset_loaders/images/polyps912.py
Outdated
image_name_to_idx = {} | ||
for idx, img_name in enumerate(self.filenames): | ||
image_name_to_idx[img_name] = idx | ||
img = io.imread(os.path.join(self.image_path, img_name + ".bmp")) |
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.
Can you move the code that loads images and masks (L119-L127) in a separate function _load_image(image_batch, mask_batch, filename_batch, img_name, prefix=None)
and call that function from here and from load_sequence
? This way the common code doesn't get duplicated.
As a more general step, I think it might be worthwhile to do the same for all the datasets and have a preload
flag in parallel_loader.py, but I don't know if you feel like going that far with this PR or not.
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.
Sure, I'll refactor the loading code for that dataset.
I'm not familiar enough with the rest of the code to have a good sense of what can be refactored in parallel_loader.py, and what needs to be done in each dataset, and unfortunately I will not have time to dive into that soon.
Updated. |
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.
Apart from a small thing, LGTM. Once you are done, can you please run the test at the end of the file (I know, it's not a very formal test unfortunately) just to double check that it still works? Once that's out of the way we can merge!
Thank you again for the PR!
dataset_loaders/images/polyps912.py
Outdated
# Add to minibatch | ||
image_batch.append(img) | ||
mask_batch.append(mask) | ||
filename_batch.append(img_name) |
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.
You will still need to append img_name
to filename_batch
.
Sorry about the delay, I'll update. |
After the last fixes, running the test:
If I change the test to use
Should I also commit that switch to test with |
Thanks for updating the PR!
Sure, why not? Thanks.
The best test here would be to wrap the Thanks for the PR! :) |
c6a8d70
to
ff0bbfe
Compare
I added counts for |
Thank you for the test, everything LGTM: merged! |
The total amount of memory is < 1 GB I think, so it can be reasonable. It is still off by default.
I'm not sure what to add as a test.