medicalai


Namemedicalai JSON
Version 1.3.1 PyPI version JSON
download
home_pagehttps://github.com/aibharata/medicalAI
SummaryMedical-AI is a AI framework specifically for Medical Applications
upload_time2022-12-06 15:06:28
maintainer
docs_urlNone
authorVinayaka Jyothi - For AiBharata
requires_python>=3.5, <3.9
licenseApache
keywords ai framework medical ai tensorflow radiology ai
VCS
bugtrack_url
requirements mkdocs-material pymdown-extensions mkdocs-awesome-pages-plugin markdown-include mock autodoc
Travis-CI
coveralls test coverage
            <p align="center">
  <a href="https://aibharata.github.io/medicalAI/"><img src="https://raw.githubusercontent.com/aibharata/medicalAI/master/logo/logo.png" alt="MedicalAI"></a>
</p>
<p align="center">
    <em>Medical-AI is a AI framework for rapid protyping for Medical Applications</em>
</p>


---

**Documentation**: <a href="https://aibharata.github.io/medicalAI/" target="_blank">https://aibharata.github.io/medicalAI/</a>

**Source Code**: <a href="https://github.com/aibharata/medicalai" target="_blank">https://github.com/aibharata/medicalai</a>

**Youtube Tutorial**: <a href="https://www.youtube.com/V4nCX-kLACg" target="_blank">https://www.youtube.com/V4nCX-kLACg</a>

---


[![Downloads](https://pepy.tech/badge/medicalai)](https://pepy.tech/project/medicalai) [![Downloads](https://pepy.tech/badge/medicalai/month)](https://pepy.tech/project/medicalai/month) [![Documentation Status](https://readthedocs.org/projects/medicalai/badge/?version=latest)](https://medicalai.readthedocs.io/en/latest/?badge=latest) [![Gitter](https://badges.gitter.im/aibh-medicalAI/devteam.svg)](https://gitter.im/aibh-medicalAI/devteam?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 


Medical-AI is a AI framework  for rapid prototyping of AI for Medical Applications.

## Installation

<div class="termy">

```py
pip install medicalai
```

</div>
## Requirements
Python Version : 3.5-3.7 (Doesn't Work on 3.8 Since Tensorflow does not support 3.8 yet.

Dependencies: Numpy, Tensorflow, Seaborn, Matplotlib, Pandas

    NOTE: Dependency libraries are automatically installed. No need for user to install them manually.

## Usage
### Getting Started Tutorial: Google Colab [Google Colab Notebook Link](https://colab.research.google.com/drive/1Wma4i5f11oyYrrkz0Y-3FOyPGmIpwKdD)

### Importing the Library
```py 
import medicalai as ai
```

## Using Templates
You can use the following templates to perform specific Tasks

### Load Dataset From Folder
Set the path of the dataset and set the target dimension of image that will be input to AI network.
```py 
trainSet,testSet,labelNames =ai.datasetFromFolder(datasetFolderPath, targetDim = (96,96)).load_dataset()
```
    - trainSet contains 'data' and 'labels' accessible by trainSet.data and trainSet.labels
    - testSet contains 'data' and 'labels' accessible by testSet.data and testSet.labels
    - labelNames contains class names/labels

### Check Loaded Dataset Size
```py 
print(trainSet.data.shape)
print(trainSet.labels.shape)
```

### Run Training and Save Model
```py
trainer = ai.TRAIN_ENGINE()
trainer.train_and_save_model(AI_NAME= 'tinyMedNet', MODEL_SAVE_NAME='PATH_WHERE_MODEL_IS_SAVED_TO', trainSet, testSet, OUTPUT_CLASSES, RETRAIN_MODEL= True, BATCH_SIZE= 32, EPOCHS= 10, LEARNING_RATE= 0.001)
```


### Plot Training Loss and Accuracy
```py
trainer.plot_train_acc_loss()
```

### Generate a comprehensive evaluation PDF report 
```py
trainer.generate_evaluation_report()
```
PDF report will be generated with model sensitivity, specificity, accuracy, confidence intervals,
ROC Curve Plot, Precision Recall Curve Plot, and Confusion Matrix Plot for each class.
This function can be used when evaluating a model with Test or Validation Data Set.

### Explain the Model on a sample
```py
trainer.explain(testSet.data[0:1], layer_to_explain='CNN3')
```


### Loading Model for Prediction 
```py
infEngine = ai.INFERENCE_ENGINE(modelName = 'PATH_WHERE_MODEL_IS_SAVED_TO')
```


### Predict With Labels 
```py
infEngine.predict_with_labels(testSet.data[0:2], top_preds=3)
```
### Get Just Values of Prediction without postprocessing
```py
infEngine.predict(testSet.data[0:2])
```

### Alternatively, use a faster prediction method in production
```py
infEngine.predict_pipeline(testSet.data[0:1])
```
## Advanced Usage

### Code snippet for Training Using Medical-AI 
```py
## Setup AI Model Manager with required AI. 
model = ai.modelManager(AI_NAME= AI_NAME, modelName = MODEL_SAVE_NAME, x_train = train_data, OUTPUT_CLASSES = OUTPUT_CLASSES, RETRAIN_MODEL= RETRAIN_MODEL)

# Start Training
result = ai.train(model, train_data, train_labels, BATCH_SIZE, EPOCHS, LEARNING_RATE, validation_data=(test_data, test_labels), callbacks=['tensorboard'])

# Evaluate Trained Model on Test Data
model.evaluate(test_data, test_labels)

# Plot Accuracy vs Loss for Training
ai.plot_training_metrics(result)

#Save the Trained Model
ai.save_model_and_weights(model, outputName= MODEL_SAVE_NAME)
```

## Automated Tests
To Check the tests

        pytest

To See Output of Print Statements

        pytest -s 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aibharata/medicalAI",
    "name": "medicalai",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.5, <3.9",
    "maintainer_email": "",
    "keywords": "AI Framework,Medical AI,Tensorflow,radiology AI",
    "author": "Vinayaka Jyothi - For AiBharata",
    "author_email": "contact@aibharata.com",
    "download_url": "https://files.pythonhosted.org/packages/bf/cd/886e2158262e1ede8a57a86316f50292ab35a5da079b018ec04625ac042e/medicalai-1.3.1.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\r\n  <a href=\"https://aibharata.github.io/medicalAI/\"><img src=\"https://raw.githubusercontent.com/aibharata/medicalAI/master/logo/logo.png\" alt=\"MedicalAI\"></a>\r\n</p>\r\n<p align=\"center\">\r\n    <em>Medical-AI is a AI framework for rapid protyping for Medical Applications</em>\r\n</p>\r\n\r\n\r\n---\r\n\r\n**Documentation**: <a href=\"https://aibharata.github.io/medicalAI/\" target=\"_blank\">https://aibharata.github.io/medicalAI/</a>\r\n\r\n**Source Code**: <a href=\"https://github.com/aibharata/medicalai\" target=\"_blank\">https://github.com/aibharata/medicalai</a>\r\n\r\n**Youtube Tutorial**: <a href=\"https://www.youtube.com/V4nCX-kLACg\" target=\"_blank\">https://www.youtube.com/V4nCX-kLACg</a>\r\n\r\n---\r\n\r\n\r\n[![Downloads](https://pepy.tech/badge/medicalai)](https://pepy.tech/project/medicalai) [![Downloads](https://pepy.tech/badge/medicalai/month)](https://pepy.tech/project/medicalai/month) [![Documentation Status](https://readthedocs.org/projects/medicalai/badge/?version=latest)](https://medicalai.readthedocs.io/en/latest/?badge=latest) [![Gitter](https://badges.gitter.im/aibh-medicalAI/devteam.svg)](https://gitter.im/aibh-medicalAI/devteam?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) \r\n\r\n\r\nMedical-AI is a AI framework  for rapid prototyping of AI for Medical Applications.\r\n\r\n## Installation\r\n\r\n<div class=\"termy\">\r\n\r\n```py\r\npip install medicalai\r\n```\r\n\r\n</div>\r\n## Requirements\r\nPython Version : 3.5-3.7 (Doesn't Work on 3.8 Since Tensorflow does not support 3.8 yet.\r\n\r\nDependencies: Numpy, Tensorflow, Seaborn, Matplotlib, Pandas\r\n\r\n    NOTE: Dependency libraries are automatically installed. No need for user to install them manually.\r\n\r\n## Usage\r\n### Getting Started Tutorial: Google Colab [Google Colab Notebook Link](https://colab.research.google.com/drive/1Wma4i5f11oyYrrkz0Y-3FOyPGmIpwKdD)\r\n\r\n### Importing the Library\r\n```py \r\nimport medicalai as ai\r\n```\r\n\r\n## Using Templates\r\nYou can use the following templates to perform specific Tasks\r\n\r\n### Load Dataset From Folder\r\nSet the path of the dataset and set the target dimension of image that will be input to AI network.\r\n```py \r\ntrainSet,testSet,labelNames =ai.datasetFromFolder(datasetFolderPath, targetDim = (96,96)).load_dataset()\r\n```\r\n    - trainSet contains 'data' and 'labels' accessible by trainSet.data and trainSet.labels\r\n    - testSet contains 'data' and 'labels' accessible by testSet.data and testSet.labels\r\n    - labelNames contains class names/labels\r\n\r\n### Check Loaded Dataset Size\r\n```py \r\nprint(trainSet.data.shape)\r\nprint(trainSet.labels.shape)\r\n```\r\n\r\n### Run Training and Save Model\r\n```py\r\ntrainer = ai.TRAIN_ENGINE()\r\ntrainer.train_and_save_model(AI_NAME= 'tinyMedNet', MODEL_SAVE_NAME='PATH_WHERE_MODEL_IS_SAVED_TO', trainSet, testSet, OUTPUT_CLASSES, RETRAIN_MODEL= True, BATCH_SIZE= 32, EPOCHS= 10, LEARNING_RATE= 0.001)\r\n```\r\n\r\n\r\n### Plot Training Loss and Accuracy\r\n```py\r\ntrainer.plot_train_acc_loss()\r\n```\r\n\r\n### Generate a comprehensive evaluation PDF report \r\n```py\r\ntrainer.generate_evaluation_report()\r\n```\r\nPDF report will be generated with model sensitivity, specificity, accuracy, confidence intervals,\r\nROC Curve Plot, Precision Recall Curve Plot, and Confusion Matrix Plot for each class.\r\nThis function can be used when evaluating a model with Test or Validation Data Set.\r\n\r\n### Explain the Model on a sample\r\n```py\r\ntrainer.explain(testSet.data[0:1], layer_to_explain='CNN3')\r\n```\r\n\r\n\r\n### Loading Model for Prediction \r\n```py\r\ninfEngine = ai.INFERENCE_ENGINE(modelName = 'PATH_WHERE_MODEL_IS_SAVED_TO')\r\n```\r\n\r\n\r\n### Predict With Labels \r\n```py\r\ninfEngine.predict_with_labels(testSet.data[0:2], top_preds=3)\r\n```\r\n### Get Just Values of Prediction without postprocessing\r\n```py\r\ninfEngine.predict(testSet.data[0:2])\r\n```\r\n\r\n### Alternatively, use a faster prediction method in production\r\n```py\r\ninfEngine.predict_pipeline(testSet.data[0:1])\r\n```\r\n## Advanced Usage\r\n\r\n### Code snippet for Training Using Medical-AI \r\n```py\r\n## Setup AI Model Manager with required AI. \r\nmodel = ai.modelManager(AI_NAME= AI_NAME, modelName = MODEL_SAVE_NAME, x_train = train_data, OUTPUT_CLASSES = OUTPUT_CLASSES, RETRAIN_MODEL= RETRAIN_MODEL)\r\n\r\n# Start Training\r\nresult = ai.train(model, train_data, train_labels, BATCH_SIZE, EPOCHS, LEARNING_RATE, validation_data=(test_data, test_labels), callbacks=['tensorboard'])\r\n\r\n# Evaluate Trained Model on Test Data\r\nmodel.evaluate(test_data, test_labels)\r\n\r\n# Plot Accuracy vs Loss for Training\r\nai.plot_training_metrics(result)\r\n\r\n#Save the Trained Model\r\nai.save_model_and_weights(model, outputName= MODEL_SAVE_NAME)\r\n```\r\n\r\n## Automated Tests\r\nTo Check the tests\r\n\r\n        pytest\r\n\r\nTo See Output of Print Statements\r\n\r\n        pytest -s \r\n",
    "bugtrack_url": null,
    "license": "Apache",
    "summary": "Medical-AI is a AI framework specifically for Medical Applications",
    "version": "1.3.1",
    "split_keywords": [
        "ai framework",
        "medical ai",
        "tensorflow",
        "radiology ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "e9d61ed4aa2df62e0373f4a2c18e3dc8",
                "sha256": "0ef28dd358cb579b893337dc389fc47519fd04a13600ca5fa08e622a59025e3e"
            },
            "downloads": -1,
            "filename": "medicalai-1.3.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e9d61ed4aa2df62e0373f4a2c18e3dc8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.5, <3.9",
            "size": 67460,
            "upload_time": "2022-12-06T15:06:26",
            "upload_time_iso_8601": "2022-12-06T15:06:26.504774Z",
            "url": "https://files.pythonhosted.org/packages/84/46/baaa81a40c6d962e90d2152f2437fb21b6c7e3eb54a38c01ece40b817cd9/medicalai-1.3.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "1d9a3ce8c5108714c64aacb587af385d",
                "sha256": "fa05a95d7d6c423cc9a6ce2554303d8b8dd5e26f724fd59a288e11811ff611bb"
            },
            "downloads": -1,
            "filename": "medicalai-1.3.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1d9a3ce8c5108714c64aacb587af385d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.5, <3.9",
            "size": 48120,
            "upload_time": "2022-12-06T15:06:28",
            "upload_time_iso_8601": "2022-12-06T15:06:28.668362Z",
            "url": "https://files.pythonhosted.org/packages/bf/cd/886e2158262e1ede8a57a86316f50292ab35a5da079b018ec04625ac042e/medicalai-1.3.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-06 15:06:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "aibharata",
    "github_project": "medicalAI",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "mkdocs-material",
            "specs": []
        },
        {
            "name": "pymdown-extensions",
            "specs": []
        },
        {
            "name": "mkdocs-awesome-pages-plugin",
            "specs": []
        },
        {
            "name": "markdown-include",
            "specs": []
        },
        {
            "name": "mock",
            "specs": []
        },
        {
            "name": "autodoc",
            "specs": []
        }
    ],
    "lcname": "medicalai"
}
        
Elapsed time: 0.01808s