-
Notifications
You must be signed in to change notification settings - Fork 16
/
imports.py
70 lines (52 loc) · 1.98 KB
/
imports.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
## Written by Daniel Buscombe,
## MARDA Science
##> Release v1.3 (July 2020)
###===================================================
# import libraries
import gc, os, sys, shutil
###===================================================
# import and set global variables from defaults.py
from defaults import *
global IM_HEIGHT, IM_WIDTH
global NUM_EPOCHS, SHALLOW
global VALID_BATCH_SIZE, BATCH_SIZE
VALID_BATCH_SIZE = BATCH_SIZE
global MAX_LR, OPT, USE_GPU, DO_AUG
# global MIN_DELTA, FACTOR, STOP_PATIENCE
##====================================================
# import tensorflow.compat.v1 as tf1
# config = tf1.ConfigProto()
# config.gpu_options.allow_growth = True # dynamically grow the memory used on the GPU
# config.log_device_placement = True # to log device placement (on which device the operation ran)
# sess = tf1.Session(config=config)
# tf1.keras.backend.set_session(sess)
##TF/keras
from tensorflow.keras.layers import Input, Dense, MaxPool2D, GlobalMaxPool2D
from tensorflow.keras.layers import Dropout, MaxPooling2D, GlobalAveragePooling2D
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau, LearningRateScheduler
from tensorflow.keras.layers import DepthwiseConv2D, Conv2D, SeparableConv2D
from tensorflow.keras.layers import BatchNormalization, Activation, concatenate
try:
from tensorflow.keras.utils import plot_model
except:
pass
import tensorflow.keras.backend as K
from tensorflow.keras.utils import to_categorical
import tensorflow_addons as tfa
##SKLEARN
from sklearn.preprocessing import RobustScaler #MinMaxScaler
from sklearn.metrics import confusion_matrix, classification_report
##OTHER
from PIL import Image
from glob import glob
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import itertools
import joblib
import random
import tensorflow_addons as tfa
import tqdm
from skimage.transform import AffineTransform, warp #rotate,