cellfinder 1.3.0rc1__py3-none-any.whl → 1.3.0rc2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cellfinder/__init__.py CHANGED
@@ -26,6 +26,7 @@ except PackageNotFoundError as e:
26
26
 
27
27
  # Set the Keras backend to torch
28
28
  os.environ["KERAS_BACKEND"] = "torch"
29
+ os.environ["PYTORCH_ENABLE_MPS_FALLBACK"] = "1"
29
30
 
30
31
  __license__ = "BSD-3-Clause"
31
32
 
@@ -1,4 +1,5 @@
1
1
  import os
2
+ from datetime import datetime
2
3
  from typing import Any, Callable, Dict, List, Optional, Tuple
3
4
 
4
5
  import keras
@@ -50,6 +51,8 @@ def main(
50
51
  # Too many workers doesn't increase speed, and uses huge amounts of RAM
51
52
  workers = get_num_processes(min_free_cpu_cores=n_free_cpus)
52
53
 
54
+ start_time = datetime.now()
55
+
53
56
  logger.debug("Initialising cube generator")
54
57
  inference_generator = CubeGeneratorFromFile(
55
58
  points,
@@ -90,6 +93,11 @@ def main(
90
93
  cell.type = predictions[idx] + 1
91
94
  points_list.append(cell)
92
95
 
96
+ time_elapsed = datetime.now() - start_time
97
+ print(
98
+ "Classfication complete - all points done in : {}".format(time_elapsed)
99
+ )
100
+
93
101
  return points_list
94
102
 
95
103
 
@@ -40,7 +40,7 @@ class CubeGeneratorFromFile(Sequence):
40
40
  background_array: types.array,
41
41
  voxel_sizes: Tuple[int, int, int],
42
42
  network_voxel_sizes: Tuple[int, int, int],
43
- batch_size: int = 16,
43
+ batch_size: int = 64,
44
44
  cube_width: int = 50,
45
45
  cube_height: int = 50,
46
46
  cube_depth: int = 20,
@@ -345,7 +345,7 @@ class CubeGeneratorFromDisk(Sequence):
345
345
  signal_list: List[Union[str, Path]],
346
346
  background_list: List[Union[str, Path]],
347
347
  labels: Optional[List[int]] = None, # only if training or validating
348
- batch_size: int = 16,
348
+ batch_size: int = 64,
349
349
  shape: Tuple[int, int, int] = (50, 50, 20),
350
350
  channels: int = 2,
351
351
  classes: int = 2,
cellfinder/core/main.py CHANGED
@@ -18,7 +18,7 @@ def main(
18
18
  trained_model: Optional[os.PathLike] = None,
19
19
  model_weights: Optional[os.PathLike] = None,
20
20
  model: model_type = "resnet50_tv",
21
- batch_size: int = 32,
21
+ batch_size: int = 64,
22
22
  n_free_cpus: int = 2,
23
23
  network_voxel_sizes: Tuple[int, int, int] = (5, 1, 1),
24
24
  soma_diameter: int = 16,
@@ -54,7 +54,7 @@ class CurationWidget(QWidget):
54
54
  self.save_empty_cubes = save_empty_cubes
55
55
  self.max_ram = max_ram
56
56
  self.voxel_sizes = [5, 2, 2]
57
- self.batch_size = 32
57
+ self.batch_size = 64
58
58
  self.viewer = viewer
59
59
 
60
60
  self.signal_layer = None
@@ -253,8 +253,9 @@ def detect_widget() -> FunctionGui:
253
253
  max_cluster_size: int,
254
254
  classification_options,
255
255
  skip_classification: bool,
256
- trained_model: Optional[Path],
257
256
  use_pre_trained_weights: bool,
257
+ trained_model: Optional[Path],
258
+ batch_size: int,
258
259
  misc_options,
259
260
  start_plane: int,
260
261
  end_plane: int,
@@ -298,6 +299,8 @@ def detect_widget() -> FunctionGui:
298
299
  should be attempted
299
300
  use_pre_trained_weights : bool
300
301
  Select to use pre-trained model weights
302
+ batch_size : int
303
+ How many points to classify at one time
301
304
  skip_classification : bool
302
305
  If selected, the classification step is skipped and all cells from
303
306
  the detection stage are added
@@ -372,7 +375,10 @@ def detect_widget() -> FunctionGui:
372
375
  if use_pre_trained_weights:
373
376
  trained_model = None
374
377
  classification_inputs = ClassificationInputs(
375
- skip_classification, use_pre_trained_weights, trained_model
378
+ skip_classification,
379
+ use_pre_trained_weights,
380
+ trained_model,
381
+ batch_size,
376
382
  )
377
383
 
378
384
  if analyse_local:
@@ -114,6 +114,7 @@ class ClassificationInputs(InputContainer):
114
114
  skip_classification: bool = False
115
115
  use_pre_trained_weights: bool = True
116
116
  trained_model: Optional[Path] = Path.home()
117
+ batch_size: int = 64
117
118
 
118
119
  def as_core_arguments(self) -> dict:
119
120
  args = super().as_core_arguments()
@@ -131,6 +132,7 @@ class ClassificationInputs(InputContainer):
131
132
  skip_classification=dict(
132
133
  value=cls.defaults()["skip_classification"]
133
134
  ),
135
+ batch_size=dict(value=cls.defaults()["batch_size"]),
134
136
  )
135
137
 
136
138
 
@@ -72,10 +72,10 @@ class Worker(WorkerBase):
72
72
  def classify_callback(batch: int) -> None:
73
73
  self.update_progress_bar.emit(
74
74
  "Classifying cells",
75
- # Default cellfinder-core batch size is 32. This seems to give
75
+ # Default cellfinder-core batch size is 64. This seems to give
76
76
  # a slight underestimate of the number of batches though, so
77
77
  # allow for batch number to go over this
78
- max(self.npoints_detected // 32 + 1, batch + 1),
78
+ max(self.npoints_detected // 64 + 1, batch + 1),
79
79
  batch + 1,
80
80
  )
81
81
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cellfinder
3
- Version: 1.3.0rc1
3
+ Version: 1.3.0rc2
4
4
  Summary: Automated 3D cell detection in large microscopy images
5
5
  Author-email: "Adam Tyson, Christian Niedworok, Charly Rousseau" <code@adamltyson.com>
6
6
  License: BSD-3-Clause
@@ -1,12 +1,12 @@
1
- cellfinder/__init__.py,sha256=rxpLq2RH-aoB3vm93M3btIrGi2lPxZRIbmzsKhkkVnI,1118
1
+ cellfinder/__init__.py,sha256=S5oQ3EORuyQTMYC4uUuzGKZ23J3Ya6q-1DOBib1KfiA,1166
2
2
  cellfinder/cli_migration_warning.py,sha256=gPtNrtnXvWpl5q0k_EGAQZg0DwcpCmuBTgpg56n5NfA,1578
3
3
  cellfinder/core/__init__.py,sha256=pRFuQsl78HEK0S6gvhJw70QLbjjSBzP-GFO0AtVaGtk,62
4
- cellfinder/core/main.py,sha256=6Uby8WuJ-U6_XBzHIla-fm3WQ2q6Vu7rYjme5Igfp_8,3625
4
+ cellfinder/core/main.py,sha256=t2mkq6iieEytbPckehBB43juwN5E-vhzstLSs620vdM,3625
5
5
  cellfinder/core/types.py,sha256=lTqWE4v0SMM0qLAZJdyAzqV1nLgDtobEpglNJcXt160,106
6
6
  cellfinder/core/classify/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  cellfinder/core/classify/augment.py,sha256=8dMbM7KhimM6NMgdMC53oHoCfYj1CIB-h3Yk8CZAxPw,6321
8
- cellfinder/core/classify/classify.py,sha256=aL2kNojKb4wsk7Zm26yq2QRiazRbwUO_cbbC2BJN0uc,3061
9
- cellfinder/core/classify/cube_generator.py,sha256=L5BvTDiHbkJ6VFeApALGtCV7Ws--jXR1foYY-bL0Buc,17125
8
+ cellfinder/core/classify/classify.py,sha256=33ZvNDmgVabH_6p4jV9Xi8bLKwDZnVhzlImrL_TlnBk,3269
9
+ cellfinder/core/classify/cube_generator.py,sha256=jC5aogTVy213PHouViSR9CgKkuOks3yk6csQC5kRoOE,17125
10
10
  cellfinder/core/classify/resnet.py,sha256=vGa85y_NcQnOXwAt5EtatLx5mrO8IoShCcNKtJ5-EFg,10034
11
11
  cellfinder/core/classify/tools.py,sha256=s5PEKAsZVbVuoferZ_nqMUM0f2bV_8WEKsdKe3SXEuE,2560
12
12
  cellfinder/core/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -39,21 +39,21 @@ cellfinder/core/tools/tools.py,sha256=G8oDGNRuWkzEJDnnC4r3SNGgpVbqbelCZR5ODk9JRz
39
39
  cellfinder/core/train/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  cellfinder/core/train/train_yml.py,sha256=9QXv2wk24G8hYskMnBij7OngEELUWySK2fH4NFbYWw4,13260
41
41
  cellfinder/napari/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- cellfinder/napari/curation.py,sha256=jz7GekuuzOdwiEFLarvvO5Bho68k8eL7AjObMdEoPXw,21447
42
+ cellfinder/napari/curation.py,sha256=nbxCwY2bhEPM15Wf3S_Ff8qGdLSWojr4X48mmAJqD3U,21447
43
43
  cellfinder/napari/input_container.py,sha256=tkm0dkPt7kSL8Xkvs1fh8M6vKWw57QLIt_wv74HFkGk,2150
44
44
  cellfinder/napari/napari.yaml,sha256=WMR1CIAmYIVyQngbdbomTRZLvlDbb6LxsXsvTRClQnE,921
45
45
  cellfinder/napari/sample_data.py,sha256=oUST23q09MM8dxHbUCmO0AjtXG6OlR_32LLqP0EU2UA,732
46
46
  cellfinder/napari/utils.py,sha256=AwTs76M9azutHhHj2yuaKErDEQ5F6pFbIIakBfzen6M,3824
47
47
  cellfinder/napari/detect/__init__.py,sha256=BD9Bg9NTAr6yRTq2A_p58U6j4w5wbY0sdXwhPJ3MSMY,34
48
- cellfinder/napari/detect/detect.py,sha256=gX10U4HHcni1ff3zYXkXYX6dWMZErYpvzVde56yV80w,13658
49
- cellfinder/napari/detect/detect_containers.py,sha256=Xx-E2JTbe5Ih_1m5ZhQ0pCYFxfdQxVJMMfGh9EZExms,5377
50
- cellfinder/napari/detect/thread_worker.py,sha256=3xGUPSthycpErcVxl_yc5soIv_z0Hf0iEaZq0Yx90OM,3078
48
+ cellfinder/napari/detect/detect.py,sha256=VB3SLZvqJhjuypjpaZuV9JscQ-sE8yVHG8RzEsZWfeA,13809
49
+ cellfinder/napari/detect/detect_containers.py,sha256=j9NTsIyyDNrhlI2dc7hvc7QlxvI1NRHlCe137v7fsPg,5467
50
+ cellfinder/napari/detect/thread_worker.py,sha256=PWM3OE-FpK-dpdhaE_Gi-2lD3u8sL-SJ13mp0pMhTyI,3078
51
51
  cellfinder/napari/train/__init__.py,sha256=xo4CK-DvSecInGEc2ohcTgQYlH3iylFnGvKTCoq2WkI,35
52
52
  cellfinder/napari/train/train.py,sha256=zJY7zKcLqDTDtD76thmbwViEU4tTFCmXZze-zHsTpoo,5941
53
53
  cellfinder/napari/train/train_containers.py,sha256=1wZ_GPe7B5XsLYs5XIx4m8GMw5KeVhg6SchhPtXu4V8,4386
54
- cellfinder-1.3.0rc1.dist-info/LICENSE,sha256=Tw8iMytIDXLSmcIUsbQmRWojstl9yOWsPCx6ZT6dZLY,1564
55
- cellfinder-1.3.0rc1.dist-info/METADATA,sha256=GiwPyIxT0EFxoHCCwWWaZs8CUnrvUPGrFcD3DWWt9Vg,6531
56
- cellfinder-1.3.0rc1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
57
- cellfinder-1.3.0rc1.dist-info/entry_points.txt,sha256=cKKjU8GPiN-TRelG2sT2JCKAcB9XDCjP6g9atE9pSoY,247
58
- cellfinder-1.3.0rc1.dist-info/top_level.txt,sha256=jyTQzX-tDjbsMr6s-E71Oy0IKQzmHTXSk4ZhpG5EDSE,11
59
- cellfinder-1.3.0rc1.dist-info/RECORD,,
54
+ cellfinder-1.3.0rc2.dist-info/LICENSE,sha256=Tw8iMytIDXLSmcIUsbQmRWojstl9yOWsPCx6ZT6dZLY,1564
55
+ cellfinder-1.3.0rc2.dist-info/METADATA,sha256=DlFtBgJoeh7SHPbvxuQ7hn-jyLLylKYjCy6rUHBMdLA,6531
56
+ cellfinder-1.3.0rc2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
57
+ cellfinder-1.3.0rc2.dist-info/entry_points.txt,sha256=cKKjU8GPiN-TRelG2sT2JCKAcB9XDCjP6g9atE9pSoY,247
58
+ cellfinder-1.3.0rc2.dist-info/top_level.txt,sha256=jyTQzX-tDjbsMr6s-E71Oy0IKQzmHTXSk4ZhpG5EDSE,11
59
+ cellfinder-1.3.0rc2.dist-info/RECORD,,