This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from PIL import Image | |
| import os | |
| def augment_and_save(patch, base_name, count, output_dir_aug): | |
| transformations = { | |
| 'orig': patch, | |
| 'rot90': patch.rotate(90), | |
| 'rot180': patch.rotate(180), | |
| 'rot270': patch.rotate(270), | |
| 'flipH': patch.transpose(Image.FLIP_LEFT_RIGHT), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import numpy as np | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.metrics import accuracy_score, roc_auc_score, precision_score, recall_score, f1_score, confusion_matrix | |
| from tensorflow.keras.preprocessing.image import ImageDataGenerator | |
| from tensorflow.keras.applications import VGG16 | |
| from tensorflow.keras.models import Model | |
| from tensorflow.keras.layers import Dense, GlobalAveragePooling2D | |
| from tensorflow.keras.optimizers import Adam | |
| from tensorflow.keras.utils import to_categorical |