AI system to segment and measure periorbital features from color photographs
In this repo you will find a python script (run_periorbitAI.py) to segment a color photograph (in JPG format) and calculate the periorbital measures described in https://doi.org/10.1016/j.ajo.2021.05.007.
It takes two inputs a root directory name and a directory name containing all photographs:
python run_periorbitAI.py root_directory name_of_photo_directory
Example:
python run_periorbitAI.py /data/periorbitAI photos
It will create:
- a directory "periorbitAI_figures" where it will put a segmetation overlay and a report with periorbital measures
- a csv (periorbitAI_measures.csv) with the measures in mm for each subject (subject IDs are determined by JPG names)
We provide an example photograph in "photos" and the output for this photo in "example_output," shown above.
Please cite this paper when using this repo:
Alexandra Van Brummen, Julia P. Owen, Theodore Spaide, Colin Froines, Randy Lu, Megan Lacy, Marian Blazes, Emily Li, Cecilia S. Lee, Aaron Y. Lee, Matthew Zhang, PeriorbitAI: Artificial intelligence automation of eyelid and periorbital measurements, American Journal of Ophthalmology, 2021
You must install the following Python packages:
pytorch (1.4.0)
scipy
scikit-image
numpy
torchvision
psd_tools
imutils
cv2
conda install pytorch=1.4.0 scipy=1.4.1 scikit-image=0.16.2 numpy=1.18.1 torchvision=0.5.0 psd-tools=1.8.38 imutils=0.5.3 pip install opencv-python
Donwloading the repo Due to the size of the segmentation model (>100MB) this repo has to be downloaded a release. Please follow these instructions:
- Go to https://github.com/uw-biomedical-ml/periorbitAI
- Click on Release: periorbitAI_v1.0 to the right of the page
- Download source code (either *.zip or *tar.gz)
- Download PSPNet_best
- Unzip/untar the source code repository (this may be needed: tar -xf v1.0.tar.gz --no-same-owner)
- Place PSPNet_best into the code repo
- You should now be able to run from within the code repo:
python run_periorbitAI.py root_directory name_of_photo_directory