Skip to content

Glaucoma detection automation project. Trained a binary image classifier using CNNs and deployed as a streamlit web app. It takes eye (retinal scan) image as input and outputs whether the person is affected by glaucoma or not.

License

Notifications You must be signed in to change notification settings

golden-panther/glaucoma-detector

Repository files navigation

Glaucoma detector Open in Streamlit

Link: https://share.streamlit.io/golden-panther/glaucoma-detector/glaucoma_app.py

(If app at above link doesn't work then use this project by downloading and running it on your local PC)

Web Page

alt text

Healthy Eye

alt text

Glaucomatous Eye

alt text

>> Details

Part 1

  • We have collected all the publicly available labelled(glaucoma or normal) fundus images of eye from web.
  • Some are already cropped and some are full. So, we cropped the full fundus images too.
  • We bulk renamed all the images in the two classes using https://www.bulkrenameutility.co.uk/
  • Then we bulk converted all the images to jpg using https://www.xnview.com/en/xnconvert/
  • Number of images in both classes are not equal. They are highly imbalanced. Then we balanced by removing extra images.
  • Finally, we sticked with 1,115 images of each class totalling 2,230 (Contact me if you want this data). And we divided them randomly into train, val and test sets in the ratio 8:1:1 using https://pypi.org/project/split-folders/

Part 2

  • We uploaded all these images to my google drive and trained on various CNN architectures from simple to advanced.
  • We did augmentation of data using keras ImageGenerator to cut down high variance. But there is some bias due to low and bad data.
  • We used keras (2.4.3) and tesorflow (2.3.0) on top of python (3.6.9). (You can see the code in train.py)
  • We trained on train set and validated on validation set after each epoch. Finally tested the test set.
  • It gave 93 percent AUC score, some good accuracy, precision and recall values. We saved the model file(h5) for further usage.
  • Then we built a simple streamlit app for hosting on web.

>> Usage:

Always remember that tensorflow does not support python 3.8. It supports upto version 3.7 only.

To use our project - go to this link https://share.streamlit.io/golden-panther/glaucoma-detector/glaucoma_app.py

(or)

To run this app

pip install -r requirements.txt
streamlit run https://raw.githubusercontent.com/golden-panther/glaucoma-detector/master/glaucoma_app.py

(or)

To run our glaucoma detector on your machine by cloning this repository,

  • Type the following in your terminal or cmd:
pip install -r requirements.txt
streamlit run glaucoma_app.py
  • The web app opens up in a local host. Then you can use it for classifying. That's it!

  • Upload a (jpg) cropped fundus image of eye(if not cropped, see note). Our model predicts whether affected by glaucoma or not.

  • I provided two folders Glaucomatous and Healthy. These contain images from my test set. Use these if you don't have any fundus images with you.

Note: The image should be cropped around the optic nerve part.(see the below full to cropped image for reference)

alt text

About

Glaucoma detection automation project. Trained a binary image classifier using CNNs and deployed as a streamlit web app. It takes eye (retinal scan) image as input and outputs whether the person is affected by glaucoma or not.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •  

Languages