Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions monai/apps/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class MedNISTDataset(Randomizable, CacheDataset):
cache_rate: percentage of cached data in total, default is 1.0 (cache all).
will take the minimum of (cache_num, data_length x cache_rate, data_length).
num_workers: the number of worker threads to use.
if 0 a single thread will be used. Default is 0.
If num_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
progress: whether to display a progress bar when downloading dataset and computing the transform cache content.
copy_cache: whether to `deepcopy` the cache content before applying the random transforms,
default to `True`. if the random transforms don't modify the cached content
Expand Down Expand Up @@ -82,7 +83,7 @@ def __init__(
test_frac: float = 0.1,
cache_num: int = sys.maxsize,
cache_rate: float = 1.0,
num_workers: int = 0,
num_workers: Optional[int] = 1,
progress: bool = True,
copy_cache: bool = True,
as_contiguous: bool = True,
Expand Down Expand Up @@ -202,7 +203,8 @@ class DecathlonDataset(Randomizable, CacheDataset):
cache_rate: percentage of cached data in total, default is 1.0 (cache all).
will take the minimum of (cache_num, data_length x cache_rate, data_length).
num_workers: the number of worker threads to use.
if 0 a single thread will be used. Default is 0.
If num_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
progress: whether to display a progress bar when downloading dataset and computing the transform cache content.
copy_cache: whether to `deepcopy` the cache content before applying the random transforms,
default to `True`. if the random transforms don't modify the cached content
Expand Down Expand Up @@ -274,7 +276,7 @@ def __init__(
val_frac: float = 0.2,
cache_num: int = sys.maxsize,
cache_rate: float = 1.0,
num_workers: int = 0,
num_workers: int = 1,
progress: bool = True,
copy_cache: bool = True,
as_contiguous: bool = True,
Expand Down
6 changes: 4 additions & 2 deletions monai/apps/pathology/data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,10 @@ class SmartCachePatchWSIDataset(SmartCacheDataset):
will take the minimum of (cache_num, data_length x cache_rate, data_length).
num_init_workers: the number of worker threads to initialize the cache for first epoch.
If num_init_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
Comment thread
yiheng-wang-nv marked this conversation as resolved.
num_replace_workers: the number of worker threads to prepare the replacement cache for every epoch.
If num_replace_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
progress: whether to display a progress bar when caching for the first epoch.
copy_cache: whether to `deepcopy` the cache content before applying the random transforms,
default to `True`. if the random transforms don't modify the cache content
Expand All @@ -142,8 +144,8 @@ def __init__(
replace_rate: float = 0.5,
cache_num: int = sys.maxsize,
cache_rate: float = 1.0,
num_init_workers: Optional[int] = None,
num_replace_workers: Optional[int] = None,
num_init_workers: Optional[int] = 1,
num_replace_workers: Optional[int] = 1,
progress: bool = True,
copy_cache: bool = True,
as_contiguous: bool = True,
Expand Down
11 changes: 7 additions & 4 deletions monai/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ def __init__(
transform: Union[Sequence[Callable], Callable],
cache_num: int = sys.maxsize,
cache_rate: float = 1.0,
num_workers: Optional[int] = None,
num_workers: Optional[int] = 1,
progress: bool = True,
copy_cache: bool = True,
as_contiguous: bool = True,
Expand All @@ -687,8 +687,9 @@ def __init__(
will take the minimum of (cache_num, data_length x cache_rate, data_length).
cache_rate: percentage of cached data in total, default is 1.0 (cache all).
will take the minimum of (cache_num, data_length x cache_rate, data_length).
num_workers: the number of worker processes to use.
num_workers: the number of worker threads to use.
If num_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
progress: whether to display a progress bar.
copy_cache: whether to `deepcopy` the cache content before applying the random transforms,
default to `True`. if the random transforms don't modify the cached content
Expand Down Expand Up @@ -862,8 +863,10 @@ class SmartCacheDataset(Randomizable, CacheDataset):
will take the minimum of (cache_num, data_length x cache_rate, data_length).
num_init_workers: the number of worker threads to initialize the cache for first epoch.
If num_init_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
num_replace_workers: the number of worker threads to prepare the replacement cache for every epoch.
If num_replace_workers is None then the number returned by os.cpu_count() is used.
If a value less than 1 is speficied, 1 will be used instead.
progress: whether to display a progress bar when caching for the first epoch.
shuffle: whether to shuffle the whole data list before preparing the cache content for first epoch.
it will not modify the original input data sequence in-place.
Expand All @@ -884,8 +887,8 @@ def __init__(
replace_rate: float,
cache_num: int = sys.maxsize,
cache_rate: float = 1.0,
num_init_workers: Optional[int] = None,
num_replace_workers: Optional[int] = None,
num_init_workers: Optional[int] = 1,
num_replace_workers: Optional[int] = 1,
progress: bool = True,
shuffle: bool = True,
seed: int = 0,
Expand Down