/MedEyeService

AI telegram-bot - "MedEyeService"

Primary LanguageJupyter Notebook

MedEyeBot

MedEyeService

On the verge of defeating the tyranny of biology


MedEyeBot


Introductions

This is an example of the tandem of PyTorch, Telebot (telegram-bot api) and Heroku.
This bot was written based on the code from my jupyter notebook from competition "APTOS 2019 Blindness Detection" as a practice.
If you are interested in creating any interface for other people to interact with your ML-models, then this repository can be an example and starting point for this.
Update:
Now bot can segment the retinal blood vessels.

About Bot's prediction models

Blindness detection :

Blood Vessels Segmentation :

  • This is vanilla UNet pretrained on DRIVE, STARE, and CHASE_DB1 datasets.

Files

  • Proctfile - configuration file to deploy on heroku
  • requirements.txt - requirements
  • blindness_detection - blindness detection model
  • blood_vessels_segmentation - blood vessels segmentation model
  • bot_description - bot description file
  • app.py - main app

Notes on Heroku

Common heroku errors

When deploying ML-applications you may encounter with some heroku common server errors:

  • h10 - The reasons may be many, the most common is errors in the code, for the solution you need to look at the logs.
  • h13 - If a request to your application takes more than 30 seconds, this leads to this error.
  • h14 - RAM limit exceeded (large batch size of image/text, deep model, etc.) try to reduce computation in memory.
  • h15 - If h14 is ignored there will be this error, followed by a forced server reboot, if during the restart there will be requests, an error h10 is caused, then you must restart the server yourself or wait a day until the server automatically restores its operation.

Installing additional packages

Heroku server by default does not have the following libraries on board: (libsm6, libxrender1 libfontconfig1, libice6), which are deb-packages, among other things, for the correct drawing of geometric shapes,the opencv library without these packages will not work, therefore if you use opencv in your code then:

  • I - install them yourself by following the official guide.
  • II - Use another library, scikit-image or PIL.
    Hope it will save you time.