Example #1
0
def prepareMixedDataset(setID, repeat, size, addHOG=True):
    mixedData = load_mixture_set(setID, repeat, size)
    roidbTrDict, annoCountTr, roidbTrDict1k = mixedData["train"][0], mixedData[
        "train"][1], mixedData["train"][2]
    roidbTeDict, annoCountTe, roidbTeDict1k = mixedData["test"][0], mixedData[
        "test"][1], mixedData['test'][2]
    printRoidbDictImageNamesToTextFile(roidbTrDict, "train_{}".format(setID))
    printRoidbDictImageNamesToTextFile(roidbTeDict, "test_{}".format(setID))
    # does the dataset have a "testing" split?

    dsHasTest = [(i is not None) and (j is not None)
                 for i, j in zip(annoCountTr[size], annoCountTe[size])]
    # cropped hog image input
    if addHOG:
        appendHOGtoRoidbDict(roidbTrDict, size)
        appendHOGtoRoidbDict(roidbTeDict, size)
        appendHOGtoRoidbDict(roidbTrDict1k, 1000)
        appendHOGtoRoidbDict(roidbTeDict1k, 1000)

    print("annoCountTr: {}".format(annoCountTr[size]))
    print("annoCountTe: {}".format(annoCountTe[size]))
    # print_report(roidbTr,annoCountTr,roidbTe,annoCountTe,setID,repeat,size)
    annoSizes = {}
    annoSizes['train'] = annoCountTr
    annoSizes['test'] = annoCountTe

    print("-=" * 50)

    return roidbTrDict, roidbTeDict, roidbTrDict1k, roidbTeDict1k, dsHasTest, annoSizes
Example #2
0
def get_mixed_dataset(args):
    setID = args.setID
    repeat = args.repeat
    size = args.size
    ds_name = args.mixed_name

    mixedData = load_mixture_set(setID, repeat, size)
    train, test = mixedData["train"], mixedData["test"]
    roidbTr = train[0][ds_name]
    annoCountTr = train[1]
    print("annotation counts for training sets")
    print(len(roidbTr))
    print(annoCountTr)
    roidbTr = prepare_onlyA_roidb(roidbTr)
    output_dir = get_output_dir("{}_{}_{}".format(ds_name, size, repeat))
    return roidbTr, output_dir
Example #3
0
    print(args)

    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file)

    print('Using config:')
    pprint.pprint(cfg)

    if not args.randomize:
        np.random.seed(cfg.RNG_SEED)

    setID = args.setID
    repetition = args.repetition
    size = args.size

    roidb, annoCount = load_mixture_set(setID, repetition, size)
    numAnnos = computeTotalAnnosFromAnnoCount(annoCount)

    print("\n\n-=-=-=-=-=-=-=-=-\n\n")
    print("Report:\n\n")
    print("Mixture Dataset: {} {} {}\n\n".format(setID, repetition, size))

    print("number of images: {}".format(len(roidb)))
    print("number of annotations: {}".format(numAnnos))
    print("size of roidb in memory: {}kB".format(
        len(roidb) * sys.getsizeof(roidb[0]) / 1024.))
    print("example roidb:")
    for k, v in roidb[0].items():
        print("\t==> {},{}".format(k, type(v)))
        print("\t\t{}".format(v))
Example #4
0
    print(args)

    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file)

    print('Using config:')
    pprint.pprint(cfg)

    if not args.randomize:
        np.random.seed(cfg.RNG_SEED)

    setID = args.setID
    repeat = args.repeat
    size = args.size

    roidb, annoCount = load_mixture_set(setID, repeat, size)
    numAnnos = computeTotalAnnosFromAnnoCount(annoCount)

    print("\n\n-=-=-=-=-=-=-=-=-\n\n")
    print("Report:\n\n")
    print("Mixture Dataset: {} {} {}\n\n".format(setID, repeat, size))

    print("number of images: {}".format(len(roidb)))
    print("number of annotations: {}".format(numAnnos))
    print("size of roidb in memory: {}kB".format(
        len(roidb) * sys.getsizeof(roidb[0]) / 1024.))
    print("example roidb:")
    for k, v in roidb[0].items():
        print("\t==> {},{}".format(k, type(v)))
        print("\t\t{}".format(v))
Example #5
0
    print(args)

    if args.cfg_file is not None:
        cfg_from_file(args.cfg_file)

    print('Using config:')
    pprint.pprint(cfg)

    if not args.randomize:
        np.random.seed(cfg.RNG_SEED)

    setID = args.setID
    repeat = args.repeat
    size = args.size

    mixedData = load_mixture_set(setID, repeat, size)
    train, test = mixedData["train"], mixedData["test"]
    roidbTr = train[0]
    annoCountTr = train[1]
    roidbTe = test[0]
    annoCountTe = test[1]

    print_report(roidbTr, annoCountTr, roidbTe, annoCountTe, setID, repeat,
                 size)

    print("-=" * 50)

    clsToSet = loadDatasetIndexDict()

    # add the "HOG" field to pyroidb
    if args.appendHog: