Esempio n. 1
0
    def __init__(self, args, train):
        self.path = args.datapath
        self.videoshape = args.videoshape
        self.train = train
        self.dataset = args.dataset

        if self.train:
            self.trainlist = './datasets/' + str(
                args.dataset) + '_%d' % (args.cropshape[1]) + '.txt'
            self.imglist = default_list_reader(self.trainlist)
            self.train_dir = join(self.path, args.dataset, 'training')
            self.train_transform = transforms.Compose([
                ToFloatTensor3D(),
                Normalize(),
                ToSpatialCrops(args.videoshape, args.cropshape)
            ])
        else:
            self.test_dir = join(self.path, args.dataset, 'testing')
            self.cur_video_id = None
            self.cur_video_frames = None
            self.cur_video_gt = None
            self.cur_background = None
            self.cur_len = 0
            self.test_transform = transforms.Compose([
                RemoveBackground(threshold=128),
                ToFloatTensor3D(),
                Normalize(),
                ToCenterCrops(args.videoshape, args.cropshape)
            ])
    def __init__(self, path, exrta_paras_dict):
        # type: (str) -> None
        """
        Class constructor.

        :param path: The folder in which UCSD is stored.
        """
        super(UCSDPed2_deepSVDD_TRAIN, self).__init__()

        self.path = join(path, 'UCSDped2')  # 这个path通用于 Train or Test
        self.window_size = int(exrta_paras_dict['train_window_size'])

        # Train directory
        self.train_dir = join(self.path, 'Train')

        # Transform
        # TODO: Training还需要其他的Data Augmentation 吗? 问下论文作者!
        self.transform = transforms.Compose(
            [ToFloatTensor3D(),
             ToCrops(self.raw_shape, self.crop_shape)])
        # 上面考虑加个去背景mog,从shanghaitech那里找代码, TODO

        # Load all train ids
        self.train_ids = self.load_train_ids()

        # Other utilities
        self.cur_len = 0
        self.cur_video_id = None  # Train 下面的所有 TrainXXX(XXX:001~016) 目录名
        self.cur_video_frames = None
    def __init__(self, path, exrta_paras_dict):
        # type: (str) -> None
        """
        Class constructor.

        :param path: The folder in which UCSD is stored.
        """
        super(UCSDPed2_deepSVDD, self).__init__()

        self.path = join(path, 'UCSDped2')
        self.window_size = int(exrta_paras_dict['test_window_size'])

        # Test directory
        self.test_dir = join(self.path, 'Test')

        # Transform
        self.transform = transforms.Compose(
            [ToFloatTensor3D(),
             ToCrops(self.raw_shape, self.crop_shape)])

        # Load all test ids
        self.test_ids = self.load_test_ids()

        # Other utilities
        self.cur_len = 0
        self.cur_video_id = None
        self.cur_video_frames = None
        self.cur_video_gt = None
    def __init__(self, path):
        # type: (str) -> None
        """
        Class constructor.

        :param path: The folder in which UCSD is stored.
        """
        super(UCSDPed1_TRAIN, self).__init__()

        self.path = join(path, 'UCSDped1')  # 这个path通用于 Train or Test

        # Train directory
        self.train_dir = join(self.path, 'Train')

        # Transform
        # TODO: Training还需要其他的Data Augmentation 吗? 问下论文作者!
        self.transform = transforms.Compose(
            [ToFloatTensor3D(),
             ToCrops(self.raw_shape, self.crop_shape)])

        # Load all train ids
        self.train_ids = self.load_train_ids()

        # Other utilities
        self.cur_len = 0
        self.cur_video_id = None  # Train 下面的所有 TrainXXX(XXX:001~016) 目录名
        self.cur_video_frames = None
Esempio n. 5
0
    def __init__(self, path):
        # type: (str) -> None
        """
        Class constructor.

        :param path: The folder in which ShanghaiTech is stored.
        """
        super(SHANGHAITECH, self).__init__()

        self.path = path

        # Test directory
        self.test_dir = join(path, 'testing')

        # Transform
        self.transform = transforms.Compose(
            [RemoveBackground(threshold=128),
             ToFloatTensor3D(normalize=True)])

        # Load all test ids
        self.test_ids = self.load_test_ids()

        # Other utilities
        self.cur_len = 0
        self.cur_video_id = None
        self.cur_video_frames = None
        self.cur_video_gt = None
        self.cur_background = None