Beispiel #1
0
    return dataset, cfg


if __name__ == "__main__":
    ### let's save some things
    ### save the images, labels, boxes for all test and train
    logger.info("starting.....")
    loader = UADetracLoader()
    """
    images = loader.load_images(dir='/nethome/jbang36/eva_jaeho/data/ua_detrac/4_images')
    labels, boxes = loader.load_labels('/nethome/jbang36/eva_jaeho/data/ua_detrac/4_xml')
    assert(len(images) == len(boxes))
    loader.save_images(name = 'uad_train_images.npy', vi_name='uad_train_vi.npy')
    loader.save_labels(name = 'uad_train_labels.npy')
    loader.save_boxes(name = 'uad_train_boxes.npy')

    logger.info("Saved all train data!")
    """
    test_images = loader.load_images(
        dir='/nethome/jbang36/eva_jaeho/data/ua_detrac/5_images')
    test_labels, test_boxes = loader.load_labels(
        '/nethome/jbang36/eva_jaeho/data/ua_detrac/5_xml')
    assert (len(test_images) == len(test_boxes))

    loader.save_images(name='uad_test_images.npy', vi_name='uad_test_vi.npy')
    loader.save_labels(name='uad_test_labels.npy')
    loader.save_boxes(name='uad_test_boxes.npy')

    logger.info("Saved all test data!")
Beispiel #2
0
    return rec, prec, ap


if __name__ == '__main__':
    # load net
    num_classes = len(labelmap) + 1  # +1 for background
    net = build_ssd('test', 300, num_classes)  # initialize SSD
    net.load_state_dict(torch.load(args.trained_model))
    net.eval()
    print('Finished loading model!')
    # load data
    loader = UADetracLoader()

    images = loader.load_images(
        dir=os.path.join(home_dir, 'data', 'ua_detrac', '5_images'))
    labels, boxes = loader.load_labels(
        dir=os.path.join(home_dir, 'data', 'ua_detrac', '5_xml'))
    labels = labels['vehicle']

    images, labels, boxes = loader.filter_input3(images, labels, boxes)

    dataset = UADDetection(transform=BaseTransform(300, dataset_mean),
                           target_transform=UADAnnotationTransform())
    dataset.set_images(images)
    dataset.set_labels(labels)
    dataset.set_boxes(boxes)

    if args.cuda:
        net = net.cuda()
        cudnn.benchmark = True
    # evaluation
    """
Beispiel #3
0
    def _loadSegmentedImages(self):
        eva_dir = config.eva_dir
        dir = os.path.join(eva_dir, 'eva_storage', 'tmp_data', 'segmented_images.npy')
        if os.path.exists(dir):
            self.segmented_images = np.load(dir)
        else:
            print("path", dir, "does not exist..")











if __name__ == "__main__":
    loader = UADetracLoader()
    images = loader.load_images()
    labels = loader.load_labels()
    boxes = loader.load_boxes()
    video_start_indices = loader.get_video_start_indices()
    #images loaded as 300x300 - prepare the images
    preprocessor = PreprocessingModule()
    segmented_images = preprocessor.run(images, video_start_indices)