brainglobe / cellfinder

Automated 3D cell detection in very large images
https://brainglobe.info/documentation/cellfinder/index.html
BSD 3-Clause "New" or "Revised" License
181 stars 39 forks source link

[BUG] Kernel crashes when running the example #415

Open priya-velu5 opened 6 months ago

priya-velu5 commented 6 months ago

Kernel crashes when running the example

To Reproduce Followed the installation steps by creating a separate conda environment, installed brainglobe and cellfinder with napari.

Log file kernel outputs: 11:14:38.025 [info] Cell 2 completed in 5.643s (start: 1715105672381, end: 1715105678024) 11:14:58.376 [info] Cell 2 completed in 1715105678.024s (start: undefined, end: 1715105678024) 11:14:59.192 [info] Cell 2 completed in 0s (start: undefined, end: undefined) 11:15:00.210 [error] Disposing session as kernel process died ExitCode: undefined, Reason: 11:15:00.225 [info] Cell 2 completed in 0s (start: undefined, end: undefined) 11:18:14.973 [error] Failed to write data to the kernel channel shell [ <Buffer 3c 49 44 53 7c 4d 53 47 3e>, <Buffer 32 62 32 32 61 38 65 64 66 35 30 63 30 38 36 35 35 66 39 65 37 33 39 38 38 64 30 31 32 64 33 65 34 34 61 37 66 38 66 61 62 64 33 35 65 39 33 35 31 35 ... 14 more bytes>, <Buffer 7b 22 64 61 74 65 22 3a 22 32 30 32 34 2d 30 35 2d 30 37 54 31 38 3a 31 38 3a 31 34 2e 39 37 32 5a 22 2c 22 6d 73 67 5f 69 64 22 3a 22 30 39 31 38 33 ... 177 more bytes>, <Buffer 7b 7d>, <Buffer 7b 7d>, <Buffer 7b 22 73 69 6c 65 6e 74 22 3a 66 61 6c 73 65 2c 22 73 74 6f 72 65 5f 68 69 73 74 6f 72 79 22 3a 66 61 6c 73 65 2c 22 75 73 65 72 5f 65 78 70 72 65 73 ... 12329 more bytes> ] Error: Socket is closed at a.postToSocket (/Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.4.0-darwin-arm64/dist/extension.node.js:318:10349) at /Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.4.0-darwin-arm64/dist/extension.node.js:318:10099 { errno: 9, code: 'EBADF' } 11:18:14.974 [error] Failed to write data to the kernel channel shell [ <Buffer 3c 49 44 53 7c 4d 53 47 3e>, <Buffer 65 36 62 39 62 33 61 30 35 35 64 64 33 37 35 34 62 65 32 35 37 34 37 35 32 33 64 32 63 31 35 64 36 33 66 62 61 65 30 32 38 32 63 61 33 35 36 36 31 37 ... 14 more bytes>, <Buffer 7b 22 64 61 74 65 22 3a 22 32 30 32 34 2d 30 35 2d 30 37 54 31 38 3a 31 38 3a 31 34 2e 39 37 34 5a 22 2c 22 6d 73 67 5f 69 64 22 3a 22 64 62 31 63 37 ... 177 more bytes>, <Buffer 7b 7d>, <Buffer 7b 7d>, <Buffer 7b 22 73 69 6c 65 6e 74 22 3a 66 61 6c 73 65 2c 22 73 74 6f 72 65 5f 68 69 73 74 6f 72 79 22 3a 66 61 6c 73 65 2c 22 75 73 65 72 5f 65 78 70 72 65 73 ... 12329 more bytes> ] Error: Socket is closed at a.postToSocket (/Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.4.0-darwin-arm64/dist/extension.node.js:318:10349) at /Users/~/.vscode/extensions/ms-toolsai.jupyter-2024.4.0-darwin-arm64/dist/extension.node.js:318:10099 { errno: 9, code: 'EBADF' }

Screenshots image

Computer used:

Additional context I've been trying to use the cellfinder APIs too. The detected cells output is always empty - used the training data images used in the paper, from here: https://gin.g-node.org/cellfinder/manuscript_data

adamltyson commented 6 months ago

Hi @priya-velu5, could you attach the specific code you're running here?

Also, do you see the same behaviour outside of VSCode?

priya-velu5 commented 6 months ago

I see the same behaviour when running cell detection on the napari plugin too. This is the Screenshot of the napari parameters:

image

I got the pretrained model weights from here: [https://gin.g-node.org/cellfinder/manuscript_data]()

This is the code that crashed:

import napari

from cellfinder.napari.sample_data import load_sample

viewer = napari.Viewer()
# Open plugin
viewer.window.add_plugin_dock_widget(
    plugin_name="cellfinder", widget_name="Cell detection"
)
# Add sample data layers
for layer in load_sample():
    viewer.add_layer(napari.layers.Image(layer[0], **layer[1]))

if __name__ == "__main__":
    # The napari event loop needs to be run under here to allow the window
    # to be spawned from a Python script
    napari.run()
alessandrofelder commented 6 months ago

Could you

please?

(I assume you installed brainglobe and napari as in your first post, on the same machine)

I just tried to reproduce the code above in a fresh conda environment with just pip install brainglobe on my M2 Macbook. I hit run and was able to find some cells:

image
alessandrofelder commented 6 months ago

I got the pretrained model weights from here: https://gin.g-node.org/cellfinder/manuscript_data

(btw I think the "Use pre trained weights" checkbox will override what you point to in the "trained model" textbox, and download the pretrained weights for you - which are the same ones you seem to have downloaded manually)