Exemplo n.º 1
0
def main():
    cfg = Config.fromfile('../src/config/testa.py')
    print(cfg)

    # init logger before other steps
    logger = setup_logger(logging.DEBUG)
    logger.info('test: {}'.format('pass'))
Exemplo n.º 2
0
def main():
    args = process_command_args()

    if args.dataset == 'tid2013':
        args.train_list = 'tid2013_train.txt'
        args.test_list = 'tid2013_test.txt'
    elif args.dataset == 'LIVE':
        args.train_list = 'live_train.txt'
        args.test_list = 'live_test.txt'
    elif args.dataset == 'CSIQ':
        args.train_list = 'csiq_train.txt'
        args.test_list = 'csiq_test.txt'
    else:
        logger.info("datasets is not in LIVE, CSIQ, tid2013")

    output_dir = os.path.join(args.ckpt_dir, args.dataset)
    args.data_dir = os.path.join(args.data_dir, args.dataset)
    args.ckpt_dir = os.path.join(args.ckpt_dir, args.dataset, args.exp_name)
    args.logs_dir = os.path.join(args.logs_dir, args.dataset, "logs")

    if not os.path.exists(args.ckpt_dir):
        os.makedirs(args.ckpt_dir)

    global logger
    logger = setup_logger("TF_rank_training", output_dir, "train_")
    logger.info(args)

    train(args)
Exemplo n.º 3
0
def main():
    args = process_command_args()
    global logger
    if args.dataset == 'tid2013':
        args.train_list = os.path.abspath('..') + '/TOMO/ft_tid2013_train.txt'
        args.test_list = os.path.abspath('..') + '/TOMO/ft_tid2013_test.txt'
    elif args.dataset == 'LIVE':
        args.train_list = os.path.abspath('..') + '/TOMO/ft_live_train.txt'
        args.test_list = os.path.abspath('..') + '/TOMO/ft_live_test.txt'
    elif args.dataset == 'TOMO':
        args.train_list = 'train_info.txt'
        args.test_list = 'test_info.txt'
    else:
        logger.info("datasets is not in LIVE, CSIQ, tid2013")

    output_dir = os.path.join(args.ckpt_dir, args.dataset)
    # args.data_dir=os.path.join(args.data_dir,args.dataset)
    args.ckpt_dir = os.path.join(args.ckpt_dir, args.dataset, args.exp_name)
    args.logs_dir = os.path.join(args.logs_dir, args.dataset, "logs")

    if not os.path.exists(args.ckpt_dir):
        os.makedirs(args.ckpt_dir)

    logger = setup_logger("TF_IQA_" + args.dataset + "_training", output_dir,
                          "train_iqa_")
    logger.info(args)

    train(args)
Exemplo n.º 4
0
def main():
    args = process_command_args()
    global logger

    if args.dataset == 'tid2013':
        args.train_list = 'tid2013_train.txt'
        args.test_list = 'tid2013_test.txt'
    elif args.dataset == 'LIVE':
        args.train_list = 'live_train.txt'
        args.test_list = 'live_test.txt'
    elif args.dataset == 'TOMO':
        args.train_list = 'tomo_train.txt'
        args.test_list = 'tomo_test.txt'
    else:
        logger.info("datasets is not in LIVE, TOMO, tid2013")

    BASE_PATH = "/gdrive/My Drive/pyIQA/"
    output_dir = os.path.join(args.ckpt_dir, args.dataset)
    args.ckpt_dir = os.path.join(args.ckpt_dir, args.dataset, args.exp_name)
    args.logs_dir = os.path.join(args.logs_dir, args.dataset, "logs")

    if not os.path.exists(args.ckpt_dir):
        os.makedirs(args.ckpt_dir)

    logger = setup_logger("TF_rank_training", output_dir, "train_")
    logger.info(args)

    train(args)
Exemplo n.º 5
0
def setup(config: Config, args):
    config.opts.new = args.new
    if args.total_step is not None:
        config.trainer.start_total_steps = args.total_step
    config.opts.device_list = args.gpu
    config.resource.create_directories()
    if args.cmd == 'self':
        setup_logger(config.resource.main_log_path)
    elif args.cmd == 'opt':
        setup_logger(config.resource.opt_log_path)
    elif args.cmd == 'play' or args.cmd == 'ob':
        setup_logger(config.resource.play_log_path)
    elif args.cmd == 'eval':
        setup_logger(config.resource.eval_log_path)
    elif args.cmd == 'sl':
        setup_logger(config.resource.sl_log_path)
Exemplo n.º 6
0
def main():
    args = process_command_args()

    if args.dataset == 'tid2013':
        args.test_list = os.path.abspath('..') + '/data/ft_tid2013_test.txt'
    elif args.dataset == 'LIVE':
        args.test_list = os.path.abspath('..') + '/data/ft_live_test.txt'
    elif args.dataset == 'CSIQ':
        args.test_list = 'ft_csiq_test.txt'
    else:
        logger.info("datasets is not in LIVE, CSIQ, tid2013")

    output_dir = os.path.join(args.ckpt_dir, args.dataset)
    args.data_dir = os.path.join(args.data_dir, args.dataset)
    args.ckpt_dir = os.path.join(args.ckpt_dir, args.dataset, args.exp_name)

    global logger
    logger = setup_logger("TF_IQA_" + args.dataset + "_evaluating", output_dir,
                          "evaluate_")
    logger.info(args)

    evaluate(args)
Exemplo n.º 7
0
from src.utils.logger import setup_logger
from src.config import Config, PlayWithHumanConfig
from src.human import play


def setup_parameters(config):
    num_cores = mp.cpu_count()
    search_threads = 10 if num_cores < 10 else 20
    print(f"search_threads = {search_threads}")
    config.play.search_threads = search_threads

if __name__ == "__main__":
    # mp.freeze_support()
    # sys.setrecursionlimit(10000)
    # config_type = 'distribute'

    config = Config()
    print(config)
    config.resource.create_directories()
    setup_logger(config.resource.play_log_path)
    config.opts.new = False
    config.opts.light = False
    pwhc = PlayWithHumanConfig()
    pwhc.update_play_config(config.play)
    config.opts.bg_style = 'WOOD'
    setup_parameters(config)
    config.play.simulation_num_per_move = 10
    play.start(config, True)
    input('按任意键退出...')