# 在import部分添加median_filter
from Image_Process.image_enhancement import histogram_equalization, adaptive_histogram_equalization_without_limit, unsharp_mask, laplacian_sharpen, adjust_hsv, gamma_correction, Contrast_Limited_Adaptive_Histogram_Equalization, Hight_Light, mean_filter, median_filter
import datetime

Image_Enhance = {
    "Shapen" : laplacian_sharpen,
    "CLAHE": histogram_equalization,
    "CLAHE_Adaptive" : adaptive_histogram_equalization_without_limit,
    "CLAHE_Adaptive_have_Limit" : Contrast_Limited_Adaptive_Histogram_Equalization,
    "HSV" : adjust_hsv,
    "gamma" : gamma_correction,
    "Hight_Light" : Hight_Light,
    "Mean" : mean_filter,
    "Median" : median_filter,  # 添加中值濾波
    "Gamma_Value" : 0.95
}

Loading_Config = {
    "Test_Data_Root": "../Dataset/Testing",
    "Train_Data_Root": "../Dataset/Training",
    # "Annotation_Training_Root": "../Dataset/Annotation/Training",
    # "Annotation_Testing_Root": "../Dataset/Annotation/Testing",
    # "TestProcess_Image_Root" : "../TestProcess_Image",
    "ImageGenerator_Data_Root": "../Dataset/ImageGenerator",
    # "Process_Roots" : "../Dataset/test_Images",
    # "Image enhance processing save root": f'../Dataset/image_enhancement_Result/New_{Image_Enhance["gamma"].__name__}_and_gamma_value_is_{Image_Enhance["Gamma_Value"]}',
    "Image enhance processing save root": f'../Dataset/image_enhancement_Result/Resetting the training and testing dataset',
    "Training_Labels": ["stomach_cancer_Crop", "Normal_Crop", "Have_Question_Crop"],
    # "Label_Image_Labels" : ["CA", "Have_Question"],
    # "XML_Loading_Label" : ["stomach_cancer_Crop", "Have_Question_Crop"],
    # "Identification_Label_Length" : 3,
}

Training_Config = {
    "Model_Name": "Xception and GastoSegNet",
    "CA_Experiment_Name": f"New architecture of Xception to CA and Have Question",
    "Normal_Experiment_Name": f"New architecture of Xception to Normal and Others",
    "Mask_Experiment_Name" : "New architecture of GastoSegNet",
    "Three_Classes_Experiment_Name" : "Xception adds Vision Transformer Large to training three classes",
    "Epoch": 10000,
    "Train_Batch_Size": 64,
    "Image_Size": 256,
    "Class_Count": 904,
    "Get_Generator": "True",
    "weight_decay": 0.01,
    "Number_Of_Classes" : len(Loading_Config["Training_Labels"])
}

Model_Config = {
    "Model Name": "xception",
    "GPA Output Nodes": 2048,
    "Linear Hidden Nodes": 1025,
    "Output Linear Nodes": 3,
    "Dropout Rate": 0.6
}

Save_Result_File_Config = {
    "Identification_Plot_Image" : f"../Result/Training_Image/save_the_train_image({str(datetime.date.today())})", # 分類模型的走勢圖存檔路徑
    "Segument_Plot_Image" : f"../Result/Training_Image/save_the_train_image({str(datetime.date.today())})/Segument_Plot_Image", # 分割模型的走勢圖存檔路徑

    "Identification_Marix_Image" : f"../Result/Matrix_Image/model_matrix_image({str(datetime.date.today())})/Identification_Plot_Marix_Image", # 分類模型的混淆矩陣存檔路徑

    "Identification_Every_Fold_Training_Result" : f'../Result/Training_Result/save_the_train_result({str(datetime.date.today())})/Identification_Every_Fold', # 分類模型每折訓練結果存檔路徑
    "Identification_Average_Result" : f'../Result/Training_Average_Result/Average_Result({str(datetime.date.today())})/Identification_Average_Result', # 分類模型平均訓練結果存檔路徑

    "Segument_Every_Fold_Training_Result" : f'../Result/Training_Result/save_the_train_result({str(datetime.date.today())})/Segument_Every_Fold', # 分割模型每折訓練結果存檔路徑
    "Segument_Average_Result" : f'../Result/Training_Average_Result/Average_Result({str(datetime.date.today())})/Segument_Average_Result', # 分割模型平均訓練結果存檔路徑    
    "Segument_Bounding_Box_Image" : f'../Result/Bounding_Box_Image/save_bounding_box_image({str(datetime.date.today())})', # 分割模型邊界框圖像存檔路徑
    "Segument_Test_Bounding_Box_Image" : f'../Result/Test_Bounding_Box_Image/save_bounding_box_image({str(datetime.date.today())})', # 分割模型邊界框圖像存檔路徑

    "Normal_Identification_Best_Model" : '../Result/save_the_best_model/Identification_Normal',
    "CA_Identification_Best_Model" : "../Result/save_the_best_model/Identification_CA", 
    "Segmentation_Best_Model" : "../Result/save_the_best_model/Segmentation",
    "Three_Classes_Identification_Best_Model" : "../Result/save_the_best_model/Three_Classes_Identification",

    "GradCAM_Validation_Image_Save_Root" : f"../Result/GradCAM_Image/Validation/GradCAM_Image({str(datetime.date.today())})",
    "GradCAM_Test_Image_Save_Root" : f"../Result/GradCAM_Image/Test/GradCAM_Image({str(datetime.date.today())})",

    "Density_Peak_Save_Root" : f"../Result/Density_Peak/Density_Peak_Result({str(datetime.date.today())})",
}