/HacknRoll2017

Identifying Skin Diseases with Deep Learning

Primary LanguageJavaScript

HacknRoll2017 - Skinalytics - Identifying Skin Diseases with Deep Learning

Skinalytics poster

What is Skinalytics?

Skinalytics is a Snap N Diagnose solution that can identify over 8 common skin diseases (including STDs) through the use of deep learning. It can be accessed from both a Web Application, Twitter and via Facebook Messenger.

This prototype, inclusive of scraping the training data, was made within 24 hours for HackNRoll 2017, an annual hackathon organized by NUS Hackers. Our initial deep learning model achieved an accuracy of ~76%. This accuracy can definitely be improved by adding more training images, and tuning the model architecture.

We hope to continously improve this model, and have a solution which can rival the accuracy of a doctor's diagnosis, bringing healthcare to people who cannot afford specialist care, or whom do not visit the doctor for reasons such as embarassment, downplaying the severity of their symptoms, etc.

Click here for the Devpost URL

How to use

Application

To host the repository and run it on your local computer:

  • Install the dependencies via pip install -r requirements.txt (Caution - opencv might fail and require a seperate installation)
  • Run python app.py in your command line and navigate to http://localhost:5000
  • Snap a picture of the diseased area, and drop it into the box as shown. Click analyze and the results will be displayed.

Models & Retraining

  • Create a folder called raw_images, and create a new subfolder for every disease you wish to train on. Populate these folders with many training images of the disease. For example:

Example of folder setup

Preprocessor.py resizes the training images to specified dimensions, and generates flipped and rotated images to increase the number of training images.

  • run python preprocessor.py to resize and preprocess these images.

combine_to_one_folder.py creates a folder called train, and copies all the pictured created by preprocessor.py to the train folder. It creates a labels.csv that maps images to their labels.

  • run python combine_to_one_folder.py

Modify the settings in classifier.py if needed. You can set your own model architecture as well and tune existing ones in the models section of the file.

  • Set the 'save_model_to' variable to a name to save the model in run(), then run python classifier.py

This should train your model, and save it with the name given if specified.

Facebook Messenger Bot

Setup

  1. Run npm install
  2. Create a .env file with contents
PAGE_ACCESS_TOKEN=... (get from Facebook app dashboard)
VERIFICATION_TOKEN=... (set arbitrarily)
  1. Download ngrok

Run

  1. Run node index.js
  2. Run ./ngrok http 3000
  3. Copy paste the output https url (https://...ngrok.io+/facebook) from ngrok into the Facebook app dashboard. Set the Verify Token field to VERIFICATION_TOKEN (as set in part 2 of Setup above).

alt text

alt text

  1. If the bot still remains unresponsive to messages (does not receive POST requests from Facebook), it might be due to the bot webhook not being subscribed properly to the Skinalytics Facebook page events.

Choose the page to subscribe to:

alt text

Select the Unsubscribe button, then click the Subscribe button to resubscribe the webhook:

alt text