def f(x, p, aim): '''x : variable de contrôle p : paramètre du réseau renvoie le temps de trajet total pour (x,p) calculé avec Aimsun''' Aimsun_simul(x, p, aim) TTT = data.getTotalTravelTime(file) return TTT
for path_data_set in [path_train_set, path_cv_set, path_test_set]: print("On", path_data_set.split('_')[-1], 'set') data_set = h5py.File(path_data_set, 'r') pos_topleft_coord = np.array(data_set['positive_example']) neg_topleft_coord = np.array(data_set['negative_example']) raw_image = np.array(data_set['raw_image']) road_mask = np.array(data_set['road_mask']) data_set.close() if classifier.classifier_type == 'LR': data_extractor = Data_Extractor(raw_image, road_mask, size, pos_topleft_coord=pos_topleft_coord, neg_topleft_coord=neg_topleft_coord, normalization=norm) else: assert classifier.classifier_type == 'FCN' data_extractor = FCN_Data_Extractor( raw_image, road_mask, size, pos_topleft_coord=pos_topleft_coord, neg_topleft_coord=neg_topleft_coord, normalization=norm) gc.collect()
train_neg_topleft_coord = np.array(train_set['negative_example']) train_raw_image = np.array(train_set['raw_image']) train_road_mask = np.array(train_set['road_mask']) train_set.close() # Load cross-validation set CV_set = h5py.File(path_cv_set, 'r') CV_pos_topleft_coord = np.array(CV_set['positive_example']) CV_neg_topleft_coord = np.array(CV_set['negative_example']) CV_raw_image = np.array(CV_set['raw_image']) CV_road_mask = np.array(CV_set['road_mask']) CV_set.close() Train_Data = Data_Extractor(train_raw_image, train_road_mask, size, pos_topleft_coord=train_pos_topleft_coord, neg_topleft_coord=train_neg_topleft_coord, normalization=norm) # run garbage collector gc.collect() CV_Data = Data_Extractor(CV_raw_image, CV_road_mask, size, pos_topleft_coord=CV_pos_topleft_coord, neg_topleft_coord=CV_neg_topleft_coord, normalization=norm) # run garbage collector gc.collect() print("train data:")
""" Main Setup file to run the whole process for s given source data """ import os import time from sys import argv, path path.append( "/home/ahmedr/Documents/Backend-Retailstreets/venv/lib/python3.6/site-packages" ) import Data_Extractor import Patterns_Recognition input_file_path = "" try: if len(argv[1]) > 0 and os.stat("data/source_file/" + str(argv[1])).st_size > 0: input_file_path = "data/source_file/" + str(argv[1]) except Exception: exit("file not found: " + str(argv[1])) os.system("python3 Reset_files.py") texted_file = Data_Extractor.main(input_file_path) Patterns_Recognition.main(texted_file) time.sleep(10) os.system("python3 PotentialMatch_Cleanser.py") time.sleep(5) os.system("python3 Address_Validator.py") time.sleep(5) os.system("python3 Information_Fetcher.py")
def Aimsun_q(): '''renvoie le paramètre exogène q du queuing model sortie : array (p,(k,gamma)) taille N²,2*N''' q = data.getQueuingModelParameters(file2) return q
def Aimsun_p(): '''renvoie le paramètre exogène p d'Aimsun sortie : [id_CP, id_n, cyc. dur., avail. cyc. ratio, nb of phases, start index]''' p = data.getNetworkParameters(file2)[1] return p
def Aimsun_M(): '''renvoie le nombre de noeuds du réseau''' M = data.getNetworkParameters(file2)[0] return M
def Aimsun_N(): '''renvoie le nombre de files dans le métamodèle''' N = data.getLanesNumber(file2) return N