def __init__(self, batch_size,image_size,path_size): self.data_pair1_root = "../dataset/For_pair_IMG_Train/pair1/" # assume this one is the newest frame self.data_pair2_root = "../dataset/For_pair_IMG_Train/pair2/" # assume this one is the historical image self.data_mat_root = "../dataset/For_pair_IMG_Train/CostMatrix/" self.signalroot ="../dataset/For_pair_IMG_Train/saved_stastics/" self.read_all_flag=0 self.read_record =0 self.folder_pointer = 0 self.slice_record=1 self.batch_size = batch_size self.img_size = Resample_size self.path_size = Path_length self.mat_size = Mat_size self.img_size2 = Resample_size2 # Initialize the inout for the tainning self.input_mat = np.zeros((batch_size,1,Mat_size,Resample_size)) #matri self.input_path = np.zeros((batch_size,Path_length))#path self.input_pair1 = np.zeros((batch_size,1,Resample_size2,Resample_size))#pairs self.input_pair2 = np.zeros((batch_size,1,Resample_size2,Resample_size)) self.input_pair3 = np.zeros((batch_size,1,Resample_size2,Resample_size)) self.input_pair4 = np.zeros((batch_size,1,Resample_size2,Resample_size)) # the number isdeter by teh mat num self.all_dir_list = os.listdir(self.data_mat_root) self.folder_num = len(self.all_dir_list) # create the buffer list(the skill to create the list) self.folder_mat_list = [None]*self.folder_num self.folder_pair1_list = [None]*self.folder_num self.folder_pair2_list = [None]*self.folder_num self.signal = [None]*self.folder_num # create all the folder list and their data list number_i = 0 # all_dir_list is subfolder list #creat the image list point to the STASTICS TIS list saved_stastics = MY_ANALYSIS() #read all the folder list of mat and pairs and path for subfold in self.all_dir_list: #the mat list this_folder_list = os.listdir(os.path.join(self.data_mat_root, subfold)) this_folder_list2 = [ self.data_mat_root +subfold + "/" + pointer for pointer in this_folder_list] self.folder_mat_list[number_i] = this_folder_list2 #the pair1 list this_folder_list = os.listdir(os.path.join(self.data_pair1_root, subfold)) this_folder_list2 = [ self.data_pair1_root +subfold + "/" + pointer for pointer in this_folder_list] self.folder_pair1_list[number_i] = this_folder_list2 #the pair2 list this_folder_list = os.listdir(os.path.join(self.data_pair2_root, subfold)) this_folder_list2 = [ self.data_pair2_root +subfold + "/" + pointer for pointer in this_folder_list] self.folder_pair2_list[number_i] = this_folder_list2 #the supervision signal list #change the dir firstly before read saved_stastics.all_statics_dir = os.path.join(self.signalroot, subfold, 'signals.pkl') self.signal[number_i] = saved_stastics.read_my_signal_results() number_i +=1
def __init__(self, batch_size, image_size, path_size): self.dataroot = "..\\dataset\\CostMatrix\\" self.signalroot = "..\\dataset\\saved_stastics\\" self.read_all_flag = 0 self.read_record = 0 self.folder_pointer = 0 self.batch_size = batch_size self.img_size = image_size self.path_size = path_size self.input_image = np.zeros((batch_size, 1, image_size, image_size)) self.input_path = np.zeros((batch_size, path_size)) self.all_dir_list = os.listdir(self.dataroot) self.folder_num = len(self.all_dir_list) # create the buffer list self.folder_list = [None] * self.folder_num self.signal = [None] * self.folder_num # create all the folder list and their data list number_i = 0 # all_dir_list is subfolder list #creat the image list point to the STASTICS TIS list saved_stastics = MY_ANALYSIS() #read all the folder list for subfold in self.all_dir_list: #if(number_i==0): this_folder_list = os.listdir(os.path.join(self.dataroot, subfold)) this_folder_list2 = [ self.dataroot + subfold + "\\" + pointer for pointer in this_folder_list ] self.folder_list[number_i] = this_folder_list2 #change the dir firstly before read saved_stastics.all_statics_dir = os.path.join( self.signalroot, subfold, 'signals.pkl') self.signal[number_i] = saved_stastics.read_my_signal_results() number_i += 1