| --- |
| license: mit |
| tags: |
| - cellpose |
| - cell-segmentation |
| - hemocytometer |
| - microscopy |
| --- |
| |
| # CellposeCellCounter segmentation models |
|
|
| Weights for [CellposeCellCounter](https://huggingface.co/spaces/LiangLabUMB/cellposecellcounter), |
| which counts cells and scores viability from a phone photograph of a hemocytometer. |
|
|
| ## Files |
|
|
| | file | used by the app | description | |
| |---|---|---| |
| | `hemocytometer_retrained_20260825.npy` | **yes** | Cellpose-SAM fine-tuned for hemocytometer counting. This is the current model. | |
| | `generalmodel.npy` | **yes** | General-purpose model used for the confluency tab only. Not retrained, not evaluated on this imaging setup. | |
| | `hemocytometer_v1_baseline.npy` | no | The previous hemocytometer model, kept so the comparison below can be reproduced. | |
|
|
| ## Training β `hemocytometer_retrained_20260825.npy` |
|
|
| Fine-tuned from the built-in `cpsam` (Cellpose 4.1.1) on 13 images from a phone-adaptor |
| hemocytometer setup, **1,069 hand-corrected cell masks**. Images were cropped to a single |
| 4Γ4 counting block and downscaled to the app's working size (max side 1024) before |
| annotation, so training and inference see identical geometry. |
|
|
| ``` |
| python -m cellpose --train --dir train --test_dir test --mask_filter _seg.npy \ |
| --use_gpu --learning_rate 0.00001 --weight_decay 0.1 --n_epochs 60 \ |
| --train_batch_size 1 |
| ``` |
|
|
| Annotation was human-in-the-loop: the previous model's output was corrected rather than |
| drawn from scratch. Across the first eight images that took **336 deletions and 79 |
| additions** β the base error was over-segmentation of debris, not missed cells. |
|
|
| ## Evaluation |
|
|
| Six held-out images, **556 hand-annotated cells**, one-to-one IoU matching at 0.5. These |
| images were used for neither training nor any parameter choice. |
|
|
| | model | count error | precision | recall | F1 | |
| |---|---|---|---|---| |
| | **retrained** | **β1.1%** | **0.940** | 0.926 | **0.933** | |
| | v1 baseline | +40.6% | 0.656 | 0.932 | 0.768 | |
| | Cellpose-SAM, off the shelf | β63.7% | 0.741 | 0.238 | 0.319 | |
|
|
| False positives fell from 260 to 36 with recall unchanged. Off-the-shelf Cellpose-SAM is |
| not usable on these images β on one field it returned a single object out of 74. |
|
|
| ## Intended use and limitations |
|
|
| - Brightfield hemocytometer images from a phone adaptor, cropped to one counting block. |
| Performance on whole uncropped frames is much worse: cells fall to ~7 px and the |
| populations stop being separable. |
| - `generalmodel.npy` has **not** been retrained or evaluated here. Confluency results |
| should be treated as indicative. |
| - Viability is not produced by these models. The app determines it from a local-contrast |
| threshold, described in the Space README. |
| - Trained on one cell line, one adaptor and two phones. Generalisation beyond that is |
| untested. |
|
|
| ## Provenance |
|
|
| `generalmodel.npy` and `hemocytometer_v1_baseline.npy` are copies of `generalmodel.npy` |
| and `hemocytometermodel.npy` from |
| [myang4218/cellposemodel](https://huggingface.co/myang4218/cellposemodel) (Apache-2.0), |
| mirrored here so the published pipeline does not depend on an external personal account. |
|
|