Пример #1
0
def _get_cityscapes_path(exists=False):
    return settings.get_data_path(config_name='cityscapes',
                                  dnnlib_template=os.path.join(
                                      '<DATASETS>', 'research', 'gfrench',
                                      'cityscapes_full',
                                      'cityscapes_segmentation.zip'),
                                  exists=exists)
Пример #2
0
def _get_isic2017_path(exists=False):
    return settings.get_data_path(
        config_name='isic2017',
        dnnlib_template=os.path.join('<DATASETS>', 'research', 'gfrench', 'isic2017',
                                     'isic2017_segmentation.zip'),
        exists=exists
    )
Пример #3
0
    def __init__(self, n_val, val_rng, trainval_perm):
        super(CamVidDataSource, self).__init__(
            settings.get_data_path(config_name='camvid',
                                   dnnlib_template=os.path.join(
                                       '<DATASETS>', 'research', 'gfrench',
                                       'camvid', 'CamVidData.zip')))

        sample_names = set()
        sample_name_to_dir_name = {}

        for filename in self.zip_file.namelist():
            dir_name, sample_name = os.path.split(filename)

            if not dir_name.endswith('annot') and os.path.splitext(
                    sample_name)[1].lower() == '.png':
                sample_names.add(sample_name)
                sample_name_to_dir_name[sample_name] = dir_name
        sample_names = list(sample_names)
        sample_names.sort()

        self.x_names = [
            sample_name_to_dir_name[name] + '/' + name for name in sample_names
        ]
        self.y_names = [
            sample_name_to_dir_name[name] + 'annot/' + name
            for name in sample_names
        ]
        self.sample_names = sample_names

        self.train_ndx = np.array([
            i for i in range(len(self.x_names))
            if os.path.split(self.x_names[i])[0].endswith('train')
        ])
        self.val_ndx = np.array([
            i for i in range(len(self.x_names))
            if os.path.split(self.x_names[i])[0].endswith('val')
        ])
        self.test_ndx = np.array([
            i for i in range(len(self.x_names))
            if os.path.split(self.x_names[i])[0].endswith('test')
        ])

        if n_val > 0 and n_val < len(self.val_ndx):
            self.val_ndx = self.val_ndx[val_rng.permutation(len(
                self.val_ndx))[:n_val]]

        # weights when using median frequency balancing used in SegNet paper
        # https://arxiv.org/pdf/1511.00561.pdf
        # The numbers were generated by https://github.com/yandex/segnet-torch/blob/master/datasets/camvid-gen.lua
        self.class_weights = np.array([
            0.58872014284134, 0.51052379608154, 2.6966278553009,
            0.45021694898605, 1.1785038709641, 0.77028578519821,
            2.4782588481903, 2.5273461341858, 1.0122526884079, 3.2375309467316,
            4.1312313079834, 0
        ])

        self.class_names = [
            'Sky', 'Building', 'Pole', 'Road', 'Pavement', 'Tree',
            'SignSymbol', 'Fence', 'Car', 'Pedestrian', 'Bicyclist', 'void'
        ]

        self.num_classes_all = len(self.class_names)
        self.num_classes = len(self.class_names) - 1
Пример #4
0
def _get_pascal_path(exists=False):
    return settings.get_data_path(config_name='pascal_voc',
                                  dnnlib_template=os.path.join(
                                      '<DATASETS>', 'research', 'pascal_voc'),
                                  exists=exists)
Пример #5
0
def _get_pascal_path(exists=False):
    return settings.get_data_path(config_name='pascal_voc', exists=exists)