Example #1
0
                                            by_box=False,
                                            fraction_of_no_box=0)

    #create train/test loaders, with CUSTOM COLLATE function
    dataloader = torch.utils.data.DataLoader(dataset,
                                             batch_size=1,
                                             shuffle=True,
                                             collate_fn=AVD.collate)

    id_to_name = GetDataSet.get_class_id_to_name_dict(data_path)
    name_to_id = {}
    for cid in id_to_name.keys():
        name_to_id[id_to_name[cid]] = cid

    target_images = get_target_images(target_path,
                                      name_to_id.keys(),
                                      for_testing=True,
                                      means=means)

    #test multiple trained nets
    for model_name in trained_model_names:
        print model_name
        # load net
        net = TDID()
        network.load_net(trained_model_path + model_name + '.h5', net)
        print('load model successfully!')

        net.cuda()
        net.eval()

        # evaluation
        test_net(model_name,
#i.e. target_path/target_0/* has one type of target image for each object
#     target_path/target_1/* has another type of target image
#type of target image can mean different things, 
#probably different type is different view
#each type can have multiple images, 
#i.e. target_0/* can have multiple images per object
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/AVD_single_bb_targets/'
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/sygen_many_bb_similar_targets/'
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/AVD_BB_exact_few/'
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen/'
#target_path = '/net/bvisionserver3/playpen10/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen_160_varied/'
#target_path = '/net/bvisionserver3/playpen10/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen_160/'
target_path = '/net/bvisionserver3/playpen10/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen_and_AVD_ns_BB_160/'
#val_target_path = '/net/bvisionserver3/playpen10/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen_160/'
val_target_path = target_path
target_images = get_target_images(target_path,name_to_id.keys(),
                                  preload_images=preload_target_images,means=None)
if use_torch_vgg:
    val_target_images = get_target_images(target_path,name_to_id.keys(),
                                          for_testing=True, bn_normalize=True)
else:
    val_target_images = get_target_images(target_path,name_to_id.keys(),
                                          for_testing=True, means=means)




#make sure only targets that have ids, and have target images are chosen
chosen_ids = list(set(set(chosen_ids) & set(name_to_id.values())))
for vci in val_chosen_ids:
    vci = list(set(set(vci) & set(name_to_id.values())))
for cid in chosen_ids:
Example #3
0
means = np.array([[[102.9801, 115.9465, 122.7717]]])

#path that holds dirs of all targets
#i.e. target_path/target_0/* has one type of target image for each object
#     target_path/target_1/* has another type of target image
#type of target image can mean different things,
#probably different type is different view
#each type can have multiple images,
#i.e. target_0/* can have multiple images per object
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/AVD_single_bb_targets/'
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/sygen_many_bb_similar_targets/'
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/AVD_BB_exact_few/'
#target_path = '/net/bvisionserver3/playpen/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen/'
target_path = '/net/bvisionserver3/playpen10/ammirato/Data/instance_detection_targets/AVD_BB_exact_few_and_other_BB_gen_and_AVD_ns_BB_80/'
target_images = get_target_images(target_path,
                                  name_to_id.keys(),
                                  preload_images=preload_target_images)
val_target_images = get_target_images(target_path,
                                      name_to_id.keys(),
                                      for_testing=True,
                                      means=means)

#make sure only targets that have ids, and have target images are chosen
chosen_ids = list(set(set(chosen_ids) & set(name_to_id.values())))
for vci in val_chosen_ids:
    vci = list(set(set(vci) & set(name_to_id.values())))
for cid in chosen_ids:
    if cid == 0:
        continue
    if ((len(target_images[id_to_name[cid]]) < 1)
            or (len(target_images[id_to_name[cid]][0])) < 1):