On the verge of defeating the tyranny of biology
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.
Blindness detection :
- This is Resnet18, trained on a dataset of resized data from the “Detection of Diabetic Retinopathy” and on data from the kaggle competition “APTOS 2019 Blindness Detection” and has a quadratic weighted kappa 0.59+ in competitions "APTOS 2019 Blindness Detection".
The predictive model of the bot has a minimal configuration due to the limitations of the Heroku free server, and consequently the relatively low prediction accuracy.
Blood Vessels Segmentation :
- This is vanilla UNet pretrained on DRIVE, STARE, and CHASE_DB1 datasets.
- 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
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.
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.