-
Notifications
You must be signed in to change notification settings - Fork 20
/
main.py
57 lines (45 loc) · 1.98 KB
/
main.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
from utilities.parserUtils import *
from utilities.customUtils import *
from utilities.aestheticUtils import *
from dataTools.processDataset import *
from dataTools.patchExtractor import *
from mainModule.BJDD import *
if __name__ == "__main__":
# Parsing Options
options = mainParser(sys.argv[1:])
if len(sys.argv) == 1:
customPrint("Invalid option(s) selected! To get help, execute script with -h flag.")
exit()
# Reading Model Configuration
if options.conf:
configCreator()
# Loading Configuration
config = configReader()
# Taking action as per received options
if options.epoch:
config=updateConfig(entity='epoch', value=options.epoch)
if options.batch:
config=updateConfig(entity='batchSize', value=options.batch)
if options.manualUpdate:
config=manualUpdateEntity()
if options.modelSummary:
BJDD(config).modelSummary()
if options.train:
BJDD(config).modelTraining(dataSamples=options.dataSamples)
if options.retrain:
BJDD(config).modelTraining(resumeTraning=True, dataSamples=options.dataSamples)
if options.inference:
noiseSigmaSet = None
if options.noiseSigma:
noiseSigmaSet = options.noiseSigma.split(',')
noiseSigmaSet = list(map(int, noiseSigmaSet))
BJDD(config).modelInference(testImagesPath=options.sourceDir, outputDir=options.resultDir, noiseSet=noiseSigmaSet)
if options.overFitTest:
BJDD(config).modelTraining(overFitTest=True)
if options.dataSampling:
datasetSampler(config, options.sourceDir, options.resultDir, options.gridSize, options.dataSamples).samplingImages()
if options.resumeDataSampling:
datasetSampler(config, options.sourceDir, options.resultDir, options.gridSize, options.dataSamples).resumeSampling()
if options.patch:
patch = patchExtract(config, options.sourceDir, options.resultDir)
patch()