Skip to content

Commit

Permalink
Update default batch size to 64 for inference
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed May 31, 2024
1 parent 865ff14 commit 05da2f0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cellfinder/core/classify/cube_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def __init__(
background_array: types.array,
voxel_sizes: Tuple[int, int, int],
network_voxel_sizes: Tuple[int, int, int],
batch_size: int = 32,
batch_size: int = 64,
cube_width: int = 50,
cube_height: int = 50,
cube_depth: int = 20,
Expand Down Expand Up @@ -345,7 +345,7 @@ def __init__(
signal_list: List[Union[str, Path]],
background_list: List[Union[str, Path]],
labels: Optional[List[int]] = None, # only if training or validating
batch_size: int = 32,
batch_size: int = 64,
shape: Tuple[int, int, int] = (50, 50, 20),
channels: int = 2,
classes: int = 2,
Expand Down
2 changes: 1 addition & 1 deletion cellfinder/core/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main(
trained_model: Optional[os.PathLike] = None,
model_weights: Optional[os.PathLike] = None,
model: model_type = "resnet50_tv",
batch_size: int = 32,
batch_size: int = 64,
n_free_cpus: int = 2,
network_voxel_sizes: Tuple[int, int, int] = (5, 1, 1),
soma_diameter: int = 16,
Expand Down
2 changes: 1 addition & 1 deletion cellfinder/napari/curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def __init__(
self.save_empty_cubes = save_empty_cubes
self.max_ram = max_ram
self.voxel_sizes = [5, 2, 2]
self.batch_size = 32
self.batch_size = 64
self.viewer = viewer

self.signal_layer = None
Expand Down
2 changes: 1 addition & 1 deletion cellfinder/napari/detect/detect_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class ClassificationInputs(InputContainer):
skip_classification: bool = False
use_pre_trained_weights: bool = True
trained_model: Optional[Path] = Path.home()
batch_size: int = 32
batch_size: int = 64

def as_core_arguments(self) -> dict:
args = super().as_core_arguments()
Expand Down
4 changes: 2 additions & 2 deletions cellfinder/napari/detect/thread_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ def detect_finished_callback(points: list) -> None:
def classify_callback(batch: int) -> None:
self.update_progress_bar.emit(
"Classifying cells",
# Default cellfinder-core batch size is 32. This seems to give
# Default cellfinder-core batch size is 64. This seems to give
# a slight underestimate of the number of batches though, so
# allow for batch number to go over this
max(self.npoints_detected // 32 + 1, batch + 1),
max(self.npoints_detected // 64 + 1, batch + 1),
batch + 1,
)

Expand Down

0 comments on commit 05da2f0

Please sign in to comment.