Ejemplo n.º 1
0
import os
import re
import json
import logging
import random

import numpy as np

from argparse import ArgumentParser
from util.logging import logging_config
from PIL import Image

logger = logging.getLogger(__name__)
logging_config()

random.seed(1234)


def get_dataset(metadataset_split_file, aircraft_trainval_file,
                aircraft_test_file, aircraft_box_file):
    with open(metadataset_split_file) as f:
        split_data = json.load(f)
        test_split = split_data["test"]

    bbox_dataset = {}
    with open(aircraft_box_file) as f:
        for line in f.readlines():
            line = line.strip().split()
            image_id, bbox_1, bbox_2, bbox_3, bbox_4 = line[0], int(
                line[1]), int(line[2]), int(line[3]), int(line[4])
            bbox_dataset[image_id] = (bbox_1, bbox_2, bbox_3, bbox_4)
Ejemplo n.º 2
0
    parser.add_argument("--config",
                        action="store",
                        type=str,
                        required=True,
                        help="config file path")
    parser.add_argument("--mode",
                        action="store",
                        type=str,
                        choices=["train", "resume", "eval"],
                        required=True)
    parser.add_argument("--cpu", action="store_true")
    parser.add_argument("--log",
                        action="store",
                        type=str,
                        required=False,
                        default=None,
                        help="log file path")

    # parse args
    args = parser.parse_args()

    # init config
    config = Config(config_path=args.config)
    config.load_config()

    logging_config(config["checkpoint.save_dir"], args.log)
    config.copy_config()

    # start training
    run(config, args.mode, args.cpu)