Beispiel #1
0
def process_args():
    """
    Parse input arguments
    :return:
    """
    parser = argparse.ArgumentParser(description=__doc__)

    parser.add_argument(
        "--model_path",
        type=str,
        default="../experiments/best_model/v2/iteration_71955.ckpt-71955",
        help="pre-train best model")
    parser.add_argument("--file_name",
                        type=str,
                        default="F:\\dataset\\cifar10\\train\\11093.png",
                        help="test image to class")
    parser.add_argument('-c',
                        '--config',
                        metavar='C',
                        default='../config/cifar10_config.json',
                        help='The Configuration file')

    args = parser.parse_args()
    config = process_config(args.config)

    return args, config
Beispiel #2
0
                logger.info(
                    " Validation step {} : Validation Accuracy = {:.4f}".
                    format(step, mean_val_acc))

        train_writer.close()
        val_writer.close()
        logger.info("Optimization finish!")


if __name__ == "__main__":

    # capture the config path from the run arguments
    # then process the json configuration file
    try:
        args = get_args()
        config = process_config(args.config)

    except:
        print("missing or invalid arguments")
        exit(0)

    # create the experiments dirs
    create_dirs([config.summary_dir, config.ckpt_dir])
    # create logger info
    global logger
    logger = setup_logger("TF_cifar10", config.ckpt_dir, "train_cifar10_")
    logger.info(config)

    main(config)

    logger.info("---------Train Finished !----------")