6
0

Fit.py 760 B

12345678910111213141516171819202122232425
  1. from pycs.pipeline.Job import Job
  2. class Fit(Job):
  3. def __init__(self, project, data: dict):
  4. super().__init__(project, data)
  5. self.result = []
  6. for identifier in data['predictionResults']:
  7. if data['predictionResults'][identifier]['origin'] != 'user':
  8. continue
  9. copy = data['predictionResults'][identifier].copy()
  10. del copy['id']
  11. del copy['origin']
  12. # TODO remove and add in webui endpoint
  13. if 'x' not in copy:
  14. copy['type'] = 'labeled-image'
  15. elif 'label' in copy:
  16. copy['type'] = 'labeled-bounding-box'
  17. else:
  18. copy['type'] = 'bounding-box'
  19. self.result.append(copy)