Skip to content

Commit

Permalink
Identified and re-named all multi-processed functions vs. multi-threa…
Browse files Browse the repository at this point in the history
…ded ones (#771)
  • Loading branch information
JBWilkie authored Jan 30, 2024
1 parent df1219e commit a11a2e4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions darwin/dataset/local_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,14 @@ def annotation_type_supported(self, annotation) -> bool:
)

def measure_mean_std(
self, multi_threaded: bool = True
self, multi_processed: bool = True
) -> Tuple[np.ndarray, np.ndarray]:
"""
Computes mean and std of trained images, given the train loader.
Parameters
----------
multi_threaded : bool, default: True
multi_processed : bool, default: True
Uses multiprocessing to download the dataset in parallel.
Returns
Expand All @@ -367,7 +367,7 @@ def measure_mean_std(
std : ndarray[double]
Standard deviation (for each channel) of all pixels of the images in the input folder.
"""
if multi_threaded:
if multi_processed:
# Set up a pool of workers
with mp.Pool(mp.cpu_count()) as pool:
# Online mean
Expand Down
6 changes: 3 additions & 3 deletions darwin/dataset/remote_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def pull(
*,
release: Optional[Release] = None,
blocking: bool = True,
multi_threaded: bool = True,
multi_processed: bool = True,
only_annotations: bool = False,
force_replace: bool = False,
remove_extra: bool = False,
Expand All @@ -203,7 +203,7 @@ def pull(
The release to pull.
blocking : bool, default: True
If False, the dataset is not downloaded and a generator function is returned instead.
multi_threaded : bool, default: True
multi_processed : bool, default: True
Uses multiprocessing to download the dataset in parallel. If blocking is False this has no effect.
only_annotations : bool, default: False
Download only the annotations and no corresponding images.
Expand Down Expand Up @@ -364,7 +364,7 @@ def pull(
successes, errors = exhaust_generator(
progress=progress(),
count=count,
multi_threaded=multi_threaded,
multi_processed=multi_processed,
worker_count=max_workers,
)
if errors:
Expand Down
6 changes: 3 additions & 3 deletions darwin/dataset/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ def _f(x: Any) -> Any:
def exhaust_generator(
progress: Generator,
count: int,
multi_threaded: bool,
multi_processed: bool,
worker_count: Optional[int] = None,
) -> Tuple[List[Dict[str, Any]], List[Exception]]:
"""
Exhausts the generator passed as parameter. Can be done multi threaded if desired.
Exhausts the generator passed as parameter. Can be done multi processed if desired.
Creates and returns a coco record from the given annotation.
Uses ``BoxMode.XYXY_ABS`` from ``detectron2.structures`` if available, defaults to ``box_mode = 0``
Expand Down Expand Up @@ -260,7 +260,7 @@ def exhaust_generator(
"""
successes = []
errors = []
if multi_threaded:
if multi_processed:
progress_bar: ProgressBar = ProgressBar(total=count)
responses = []

Expand Down

0 comments on commit a11a2e4

Please sign in to comment.