Unet segmentation in imagej



I’m new to imagej. I could not find the documentation for Unet segmentation in Imagej. I would be grateful if anyone can share the steps for Unet Segmentation in imagej.

Thank you

U-Net available as ImageJ Plugin?

I don’t know of anyone who has written an ImageJ plugin for UNet-based segmentation. However, the CellProfiler project has a plugin called ClassifyPixels-Unet that I believe works on cell nuclei (and there is a feature request to add support for other UNet models). I have added the cellprofiler tag to this topic, and invited relevant folks from that project to comment as appropriate.


Thanks, @ctrueden!

Yes, @Arunak, learning-based methods (e.g. fully convolutional methods like UNet) are available in CellProfiler. You need to download CellProfiler from http://cellprofiler.org and download the UNet plugin from https://github.com/CellProfiler/CellProfiler-plugins. It has the cumbersome name classifypixelsunet. :joy:

Let me know if you run into any problems (the author and I work together).


After I added classifypixelsunet.py to my plugins folder and restarted CellProfiler, I got error “no module named keras”. I am using a Windows 10 Enterprise. Can you tell me what I need to install (Anaconda, python, etc) in order to use classifypixelsunet please.


Sorry I didnot worked on this plugin yet sir.

Best Regards,



I got the same error (“no module named keras”) on another Windows 10 PC where keras_backend=cntk and I had no trouble using “import keras” in python 2.7.
Please advise what and how to install necessary packages. Thanks.


We have used the UNet plugin with CNTK under windows 10. Can you try to run the command

cd CellProfiler-plugins
pip install -r requirements-windows.txt

using the command line? And then start CellProfler from the command line using

cellprofiler --plugins-directory PLUGIN_DIRECTORY/CellProfiler-plugins

where PLUGIN_DIRECTORY points to your file path to the CellProfiler-plugins repository.


After followed your instruction, I got the same error “no module named keras”. It is strange because I can do “import keras” in python.


Do you use any virtual environments? And can you check if you have installed multiple python version?


I have only one python installation, and am not using virtual environment


The problem is that the windows version of CellProfiler is bundled with its own python version, which is independent from the python version installed on your system. So when you install CNTK, CellProfiler is still not able to find the needed libraries (thanks to @agoodman for clarifying this)

To run CellProfiler with CellProfiler-plugins, you need to install it from source. Could try to re-install CellProfiler using the instruction https://github.com/CellProfiler/CellProfiler/wiki/Source-installation-(Windows) and then try it again?


Thanks for your instructions. I managed to add module ClassifyPixels-Unet. However, it has been running for 95 hours on a small DAPI image of 82x98 pixels, and has made no progress. I have also installed CellProfiler in a CentOS virtual box. How to start the program please?
I am trying to evaluate performance of ClassifyPixels-Unet vs IdentifyPrimaryObject. Both modules performed so well for the example you gave in paper https://journals.plos.org/plosbiology/article?id=10.1371/journal.pbio.2005970 because all nuclei were well separated. My samples have much denser nuclei and the segregation was poor with IdentifyPrimaryObject. I’d really appreciate if you could try one of my image with ClassifyPixels-Unet so that I’d know whether it is worth pursuing.
Many thanks for working on my image, Tim. The result is significantly better than what I got with IdentifyPrimaryObject.
I’d appreciate it if you could send me the cppipe file.