Midgut_oocyst_segmentation
Perform oocyst segmentation in mercurochrome stained mosquito midguts
http://got2findthemall.org/
This oocyst segmentation model also powers the webtool atRequirements to run locally:
(1) Build tools
Visual Studio build tools if using Windows:
https://visualstudio.microsoft.com/visual-cpp-build-tools/
Xcode if using MacOS
Linux: you should be able to figure this out if you use Linux
(2) Python and packages
Python >3.8
Python packages:
Notes: the listed versions are tested to work. You can use pip to install all the packages listed here,
or create a conda environment using conda_env.yml supplied by this repo
torch=1.9.1
torchvision=0.10.0
torchaudio=0.9.1
pandas=1.3.3
pycocotools=2.0.2
dataclasses=0.6
typing=3.7.4.3
opencv-python=4.5.3.56
xlsxwriter=3.0.1
detectron2=0.5
For the detectron2 package, you can git clone the repo and install using (must have Git installed):
python -m pip install 'git+https://github.com/facebookresearch/detectron2.git' --user
Instructions:
(1) Clone the repository
(2) unzip the two model weight files and keep it in the "model" directory:
<1> model_0002399.MG.pth
(unzip from model_0002399.MG.zip.001 and model_0002399.MG.zip.002)
<2> model_0006199.pth
(unzip from model_0006199.zip.001 and model_0006199.zip.002)
(3) prepare your own jpeg images and place them in a folder, or use the "test_images" folder
(4) run oocyst segementation with the following command:
python oocyst_segmentation.py --dir [path to your folder]
(5) Four result files with the same prefix will be generated for each image
count_N_size.xlsx oocyst count, area and coordiate of each oocyst, average area
[prefix].oocyst.jpg oocyst annotated on the original image
[prefix].midgut.jpg midgut annotated on the original image
[prefix].midgut.MASK.jpg A full-resolution black-whight MASK of the midgut identified