Medical-AI is a AI framework for rapid protyping for Medical Applications
Documentation: https://aibharata.github.io/medicalAI/
Source Code: https://github.com/aibharata/medicalai
Youtube Tutorial: https://www.youtube.com/V4nCX-kLACg
Medical-AI is a AI framework for rapid prototyping of AI for Medical Applications.
pip install medicalai
Dependencies: Numpy, Tensorflow, Seaborn, Matplotlib, Pandas
NOTE: Dependency libraries are automatically installed. No need for user to install them manually.
Getting Started Tutorial: Google Colab Google Colab Notebook Link
import medicalai as ai
You can use the following templates to perform specific Tasks
Set the path of the dataset and set the target dimension of image that will be input to AI network.
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
print(trainSet.data.shape)
print(trainSet.labels.shape)
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)
trainer.plot_train_acc_loss()
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.
trainer.explain(testSet.data[0:1], layer_to_explain='CNN3')
infEngine = ai.INFERENCE_ENGINE(modelName = 'PATH_WHERE_MODEL_IS_SAVED_TO')
infEngine.predict_with_labels(testSet.data[0:2], top_preds=3)
infEngine.predict(testSet.data[0:2])
infEngine.predict_pipeline(testSet.data[0:1])
## 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)
To Check the tests
pytest
To See Output of Print Statements
pytest -s
Dr. Vinayaka Jyothi