maxpmx / CelloType

End-to-end model for cell segmentation and classification
https://cellotype.readthedocs.io
Apache License 2.0
2 stars 6 forks source link

Segmentation on Images with More Than Three Channels #1

Open walkeraw2002 opened 1 month ago

walkeraw2002 commented 1 month ago

Hello,

I had a question regarding running the segmentation module on images that have more than three channels.

I know maskDINO is built for RGB, but are you able to pass in an image of more than three channels into the segmentation module?

When I try and segment a 4-channel image using the CelloType Predictor MaskDINO model, I get the following error: RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

Any guidance on how to handle the segmentation and/or cell type classification of images that have more than three channels would be very much appreciated. Thank you for your time!

maxpmx commented 1 month ago
  1. To use the pretrained model for cell segmentation, the input image needs to have 3 channels. Typically, for segmentation tasks, you can process the image such that the nucleus is represented in the blue channel and the membrane in the green channel.
  2. When training segmentation or annotation models, multi-channel inputs are supported. For example, in the train_crc.py script, you can modify the cfg.MODEL.IN_CHANS parameter within the setup function to specify the number of input channels.