Giter Club home page Giter Club logo

golden-panther / glaucoma-detector Goto Github PK

View Code? Open in Web Editor NEW
16.0 4.0 15.0 73.1 MB

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: MIT License

Python 100.00%
glaucoma glaucoma-detector fundus-images eye cnns tensorflow keras neural-networks binary-classification image-classification

glaucoma-detector's Introduction

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

glaucoma-detector's People

Contributors

dependabot[bot] avatar golden-panther avatar jrieke avatar streamlit-badge-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

glaucoma-detector's Issues

is not working

SNAG-0714

root@2-ubuntu-s-8vcpu-16gb-nyc1-01:~/glaucoma-detector# streamlit run glaucoma_app.py
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
2021-06-17 03:15:44.775025: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2021-06-17 03:15:44.775070: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

  You can now view your Streamlit app in your browser.

  Network URL: http://143.244.172.85:8501
  External URL: http://143.244.172.85:8501

2021-06-17 03:15:45.824426: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'libcuda.so.1'; dlerror: libcuda.so.1: cannot open shared object file: No such file or directory
2021-06-17 03:15:45.824465: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303)
2021-06-17 03:15:45.824491: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:156] kernel driver does not appear to be running on this host (2-ubuntu-s-8vcpu-16gb-nyc1-01): /proc/driver/nvidia/version does not exist
2021-06-17 03:15:45.824715: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-06-17 03:15:45.831907: I tensorflow/core/platform/profile_utils/cpu_utils.cc:104] CPU Frequency: 2494085000 Hz
2021-06-17 03:15:45.832359: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7f13e67b3190 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-06-17 03:15:45.832395: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version

how can solve?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.