Skip to content

An immunohistochemistry cell-counting (quantifying) neural network (CSRNet PyTorch) that was trained on KRT14, KRT5, and Ki67 stains (and of course DAPI).

License

Notifications You must be signed in to change notification settings

jeffock/ihc_cellcount

Repository files navigation

Made withJupyter

Results:


Annotated cell count: 62


original heatmap


Predicted cell count: 60


model heatmap


Original image: cytokeratin 14 (KRT14) stain


original image


The MAE for the this model was 79.8, which isn't bad for the limited amount of data available to me, but could be better, it is also to be said that keratin stains can be much more difficult for NN to count due to the rampant background (it may also be explained by the fact that some cell counts were in the hundreds, making MAE=30 more reasonable compared to the context of the example given above). The nuclei stains such as DAPI and Ki67 will likely perform better, it is just taking me a while to annotate.

Model also struggled with higher cell counts.

model google drive

TO-DO before you start:


You will need to add data to the \Data directory. You will also need to run pkg_install.sh as specified by comments within the file.

Note on packages, this model uses CUDA supported PyTorch, make sure you have the correct packages for this if you have an Nvidia GPU.

Data:


The file tree that I used for my data is included. Once you have your data in ./images, annotate them in MATLAB with the provided .m script in the keratin/ and nuclei/ directories. Run make_dataset.ipynb to generate the needed .h5 files.

Make .json files for validation, test, and train. Make an 10% 10% 80% split of the images in the files. Enter the file paths to the images you want in val, test, and train in list form.

I will be adding my own data and annotations, once I finish annotating all of them, as zipped files either in the repo or in a linked google drive.

Training:


First ensure that the .json files contain the correct file paths. To train run: python train.py krt_train.json krt_test.json 0 0

Testing:


Run val.ipynb to test.

Specifics:


Note that this model was trained with KRT14, KRT5, Ki67, and DAPI stains. Each stain will appear slightly differently so the code will not be as effective for stains other than those mentioned. The two keratin stains were trained together while the two nuclei stains were trained together.

Credit:


Original CSRNet repo: [https://github.com/leeyeehoo/CSRNet-pytorch/tree/master]


Original annotation repo: [https://github.com/princenarula222/Crowd_Annotation]

About

An immunohistochemistry cell-counting (quantifying) neural network (CSRNet PyTorch) that was trained on KRT14, KRT5, and Ki67 stains (and of course DAPI).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published