Example #1
0
 def _get_meta(self, data: Data, **kwargs) -> None:
     # pylint: disable=arguments-differ
     """Get metadata for some data.
     """
     data.add_attribute('frame', batch=True)  # usually the same a index
     data.add_attribute('time', batch=True)
     super()._get_meta(data, **kwargs)
Example #2
0
 def _get_meta(self, data: Data, **kwargs) -> None:
     # pylint: disable=arguments-differ
     """Get metadata for some data.
     """
     if self._label_from_directory:
         data.add_attribute('label', batch=True)
     super()._get_meta(data, **kwargs)
Example #3
0
    def test_batch3(self):
        """Testing attributes with `initalize` argument.
        """
        data = Data(batch=3)
        data.add_attribute('a')
        data.add_attribute('b', batch=True, initialize=True)
        data.a = 5
        data[1].b = 3
        data.b[2] = 4

        self.assertEqual(data.a, 5)
        self.assertEqual(data[1].a, 5)
        self.assertEqual(data[1].b, 3)
        self.assertEqual(data.b[1], 3)
        self.assertEqual(data[2].b, 4)
        self.assertEqual(data.b[2], 4)
Example #4
0
 def _get_meta(self, data: Data, **kwargs) -> None:
     # pylint: disable=arguments-differ
     if self._identities is not None:
         data.add_attribute('identity', batch=True)
     if self._landmarks is not None:
         data.add_attribute('landmarks', batch=True)
     if self._bboxes is not None:
         data.add_attribute('bbox', batch=True)
     if self._attr_names is not None:
         for name in self._attr_names:
             data.add_attribute(name, batch=True)
     super()._get_meta(data, **kwargs)
Example #5
0
 def _get_meta(self, data: Data, filename: str = None, **kwargs) -> None:
     # pylint: disable=arguments-differ
     if filename is not None and not data.datasource_argument:
         data.datasource_argument = 'filename'
         data.datasource_value = filename
     data.add_attribute('filename', batch=True)
     if self._filenames is not None:
         data.add_attribute('index', batch=True)
     if self._loader_kind != 'array':
         data.add_attribute(self._loader_kind, batch=True)
     super()._get_meta(data, **kwargs)
Example #6
0
    def test_batch2(self):
        """Using batch and non-batch attributes.
        """
        data = Data(batch=3)
        data.add_attribute('a')
        data.add_attribute('b', batch=True)
        data.add_attribute('c', batch=False)

        self.assertFalse(data.is_batch_attribute('a'))
        self.assertTrue(data.is_batch_attribute('b'))
        self.assertFalse(data.is_batch_attribute('c'))
        self.assertFalse(data.is_batch_attribute('d'))
 def _get_meta(self, data: Data, **kwargs) -> None:
     data.add_attribute('label', batch=True)
     super()._get_meta(data, **kwargs)
Example #8
0
 def _get_meta(self, data: Data, **kwargs) -> None:
     # pylint: disable=arguments-differ
     if self._ffhq_meta is not None:
         data.add_attribute('url', batch=True)
     super()._get_meta(data, **kwargs)