MediaImageLabel.py 527 B

1234567891011121314151617181920
  1. from pycs.database.Result import Result
  2. #pylint: disable=too-few-public-methods
  3. class MediaImageLabel:
  4. """
  5. An image label with an optional frame index for videos.
  6. """
  7. def __init__(self, result: Result):
  8. self.label = result.label
  9. self.frame = result.data['frame'] if 'frame' in result.data else None
  10. def serialize(self) -> dict:
  11. """
  12. serialize all object properties to a dict
  13. :return: dict
  14. """
  15. return dict({'type': 'image-label'}, **self.__dict__)