y_train = data_y[:26614]#, len(low_level)+len(mid_level): y_test = data_y[26614:33268]#, len(low_level)+len(mid_level): """ if load: print("The shape of the X_train is: ", X_train.shape) print("The shape of the y_train is: ", y_train.shape) if load: print("The shape of the X_test is: ", X_test.shape) print("The shape of the y_test is: ", y_test.shape) print(alpha) #alpha = np.ones((1, class_num)) #googleNet默认输入32*32的图片 if args.model == "GoogLeNet": model = GoogLeNet.build(image_height, image_width, 3, class_num) loss_func = weighted_binary_crossentropy(alpha) #loss_func = 'binary_crossentropy' #loss_func = K.mean(K.binary_crossentropy(y_true, y_pred), axis=-1) loss_weights = None #metrics=['accuracy'] metrics = [weighted_acc] metrics = [mA, 'accuracy'] elif args.model == "GoogLeNetGAP": model = GoogLeNetGAP.build(image_height, image_width, 3, class_num) loss_func = weighted_binary_crossentropy(alpha) #loss_func = 'binary_crossentropy' #loss_func = K.mean(K.binary_crossentropy(y_true, y_pred), axis=-1) loss_weights = None #metrics=['accuracy'] metrics = [weighted_acc] metrics = [mA, 'accuracy']
#alpha = np.exp(-alpha) print(alpha) print(alpha.shape) if load: print("The shape of the X_train is: ", X_train.shape) print("The shape of the y_train is: ", y_train.shape) if load: print("The shape of the X_test is: ", X_test.shape) print("The shape of the y_test is: ", y_test.shape) is_multi = None #googleNet默认输入32*32的图片 if args.model == "hiarGoogLeNet": model = hiarGoogLeNet.build(image_height, image_width, 3, [len(low_level), len(mid_level), len(high_level)]) loss_func = 'binary_crossentropy'#weighted_categorical_crossentropy(alpha) loss_func = weighted_binary_crossentropy(alpha) loss_weights = None metrics=['accuracy'] metrics = [weighted_acc] metrics = [mA, 'accuracy'] elif args.model == "hiarGoogLeNetGAP": model = hiarGoogLeNetGAP.build(image_height, image_width, 3, [len(low_level), len(mid_level), len(high_level)]) loss_func = 'binary_crossentropy'#weighted_categorical_crossentropy(alpha) loss_func = weighted_binary_crossentropy(alpha) loss_weights = None metrics=['accuracy'] metrics = [weighted_acc] metrics = [mA, 'accuracy'] elif args.model == "hiarBayesGoogLeNet": model = hiarBayesGoogLeNet.build(image_height, image_width, 3, [len(low_level), len(mid_level), len(high_level)]) loss_func ='binary_crossentropy'#bayes_binary_crossentropy(alpha, y_train)#weighted_categorical_crossentropy(alpha)