import json

from ptsemseg.loader.pascal_voc_loader import pascalVOCLoader
from ptsemseg.loader.camvid_loader import camvidLoader
from ptsemseg.loader.ade20k_loader import ADE20KLoader
from ptsemseg.loader.mit_sceneparsing_benchmark_loader import (
    MITSceneParsingBenchmarkLoader
)
from ptsemseg.loader.cityscapes_loader import cityscapesLoader
from ptsemseg.loader.nyuv2_loader import NYUv2Loader
from ptsemseg.loader.sunrgbd_loader import SUNRGBDLoader
from ptsemseg.loader.mapillary_vistas_loader import mapillaryVistasLoader
from ptsemseg.loader.MiniSAR_loader import MiniSARLoader
from ptsemseg.loader.Aerial_loader import AerialLoader
from ptsemseg.loader.SARdata_loader import SARdata_Loader
from ptsemseg.loader.WHU_loader import WHULoader
from ptsemseg.loader.Mass_roads_loader import Road_Loader
from ptsemseg.loader.Crack_loader import CrackLoader
from ptsemseg.loader.Echo_loader import EchoLoader
from ptsemseg.loader.HCM_loader import HCMLoader


def get_loader(name):
    """get_loader

    :param name:
    """
    return {
        "pascal": pascalVOCLoader,
        "camvid": camvidLoader,
        "ade20k": ADE20KLoader,
        "mit_sceneparsing_benchmark": MITSceneParsingBenchmarkLoader,
        "cityscapes": cityscapesLoader,
        "nyuv2": NYUv2Loader,
        "sunrgbd": SUNRGBDLoader,
        "vistas": mapillaryVistasLoader,
        "MiniSAR": MiniSARLoader,
        "Aerial": AerialLoader,
        "SARdata": SARdata_Loader,
        "Mass_road": Road_Loader,
        "WHU": WHULoader,
        "Crack": CrackLoader,
        "HCM": HCMLoader,
        "Echo": EchoLoader,
    }[name]


def get_data_path(name, config_file="config.json"):
    """get_data_path

    :param name:
    :param config_file:
    """
    data = json.load(open(config_file))
    return data[name]["data_path"]
