-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainWrapper.py
74 lines (59 loc) · 3.35 KB
/
mainWrapper.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
71
# This file contain the main function of the framework
# This function is the wrapper that runs First part of Framework which includes Loading of Datasets(depth 0,1 and 2)
# Then it evaluate different variance of the proposed ML Scheme. The trained network and summary is stored in the specifed folder.
# Author: Kamran Qureshi & Waqas Ahmad, Date: 04-21-23
#from PIL import Image as pil_image
# Reading function define in other python file
from CNN_Depth0 import Depth0_CNN
from CNN_Depth1 import Depth1_CNN
from CNN_Depth2 import Depth2_CNN
import tensorflow as tf
tf.__version__
import os
os.environ['TF_XLA_FLAGS'] = '--tf_xla_enable_xla_devices'
import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], True)
# Flags that define different variant of the code
METHODOLOGY=1 # 0 for non key views prediction and 1 for complete LF view prediction
MOTION_FLAG=0 # When this flag is 1 then four neighbours motion vector information will be used in feature vector
DEBUG=1 # This flag enable debugging. Total LF are 4 and total test images are 1.
# Define the current System on which the code is running. Then accordingly it defines the path of the datasets
# These two flag control following variation of the code (1,0) select CU only case , (0,1) selects CTU + feature vector case, (0,0) select feature only case
# CTU_FLAG_HV = [1, 0, 0]
# CTU_NN_FLAG_HV = [0, 1, 0]
CTU_FLAG_HV = [1]
CTU_NN_FLAG_HV = [0]
MULTI_CTU_FLAG= 0
# Select the databaess
DBlist=['HCI']
PreDefinedTest = 1 # 0 will randomoly select three test cases in which 3 LF images will be used for testing and rest of the LF images will go for training. 1 value will select pre defined test cases
# Bitrates on which experimentation is performed
rate_list = ['32', '27', '22']
# rate_list = ['32']
PRINT_STATUS=1
PRINT_STATS=1
# Test I am using to benchmark the ML schemes. Each test contains 3 LF images which are defined in the inner functions.
# Test = ['A', 'B', 'C']
Test = ['C']
simCount=0
EPOCHS=1
depthValues=['2']
outputDNNFolder= 'DSN_Test'
outputFolder='../../output/'+ outputDNNFolder + '/'
for depth in depthValues: # Loop over depth 0 to 2
for FLAG_indx in range(0,len(CTU_FLAG_HV)): # Loop over flags
CTU_FLAG = CTU_FLAG_HV[FLAG_indx] #CTU only
CTU_NN_FLAG = CTU_NN_FLAG_HV[FLAG_indx] #CTU + Feature Vector
for loopidx in range (0,len(Test)):# Loop over Test A to C
simCount=simCount+1
print("Simulation no. ",simCount)
if(depth=='0'): # Depth 0 work
print('Depth0')
Depth0_CNN(loopidx,CTU_FLAG,MOTION_FLAG,CTU_NN_FLAG,rate_list,DBlist,PRINT_STATUS,PRINT_STATS,Test[loopidx],EPOCHS,outputFolder,MULTI_CTU_FLAG,METHODOLOGY,PreDefinedTest,DEBUG)
elif(depth=='1'):# Depth 1 work
print('Depth1')
Depth1_CNN(loopidx,CTU_FLAG,MOTION_FLAG,CTU_NN_FLAG,rate_list,DBlist,PRINT_STATUS,PRINT_STATS,Test[loopidx],EPOCHS,outputFolder,MULTI_CTU_FLAG,METHODOLOGY,PreDefinedTest,DEBUG)
else:# Depth 2 work
print('Depth 2')
Depth2_CNN(loopidx, CTU_FLAG, MOTION_FLAG, CTU_NN_FLAG, rate_list,DBlist, PRINT_STATUS, PRINT_STATS,Test[loopidx], EPOCHS,outputFolder,MULTI_CTU_FLAG,METHODOLOGY,PreDefinedTest,DEBUG)