|
a |
|
b/Projects/Augmentation/Augmentation.py |
|
|
1 |
############################################################################################ |
|
|
2 |
# |
|
|
3 |
# Project: Peter Moss Acute Myeloid & Lymphoblastic Leukemia AI Research Project |
|
|
4 |
# Repository: ALL Detection System 2019 |
|
|
5 |
# Project: Data Augmentation |
|
|
6 |
# |
|
|
7 |
# Author: Adam Milton-Barker (AdamMiltonBarker.com) |
|
|
8 |
# Contributors: |
|
|
9 |
# Title: Manual Data Augmentation Class |
|
|
10 |
# Description: Manual data augmentation class for the ALL Detection System 2019. |
|
|
11 |
# License: MIT License |
|
|
12 |
# Last Modified: 2020-07-14 |
|
|
13 |
# |
|
|
14 |
############################################################################################ |
|
|
15 |
|
|
|
16 |
import matplotlib.pyplot as plt |
|
|
17 |
|
|
|
18 |
from Classes.Data import Data |
|
|
19 |
|
|
|
20 |
plt.rcParams['figure.figsize'] = (5.0, 4.0) |
|
|
21 |
plt.rcParams['image.interpolation'] = 'nearest' |
|
|
22 |
plt.rcParams['image.cmap'] = 'gray' |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
class Augmentation(): |
|
|
26 |
""" ALL Detection System 2019 Manual Data Augmentation Class |
|
|
27 |
|
|
|
28 |
Manual data augmentation wrapper class for the ALL Detection System 2019 Data Augmentation project. |
|
|
29 |
""" |
|
|
30 |
|
|
|
31 |
def __init__(self): |
|
|
32 |
""" Initializes the Augmentation class. """ |
|
|
33 |
|
|
|
34 |
self.Data = Data() |
|
|
35 |
|
|
|
36 |
def processDataset(self): |
|
|
37 |
""" Processes the AML/ALL Detection System Dataset. |
|
|
38 |
Make sure you have your equal amounts of positive and negative |
|
|
39 |
samples in the Model/Data directories. |
|
|
40 |
|
|
|
41 |
Only run this function once! it will continually make copies |
|
|
42 |
of all images in the Settings->TrainDir directory specified |
|
|
43 |
in Required/confs.json |
|
|
44 |
""" |
|
|
45 |
|
|
|
46 |
self.Data.processDataset() |
|
|
47 |
|
|
|
48 |
|
|
|
49 |
print("!! Data Augmentation Program Starting !!") |
|
|
50 |
print("") |
|
|
51 |
Augmentation = Augmentation() |
|
|
52 |
Augmentation.processDataset() |
|
|
53 |
print(" Data Augmentation Program Complete") |
|
|
54 |
print("") |