Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

#546 Features/sg 409 check all params used

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:features/SG-409-check-all-params-used
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
  1. from typing import Tuple
  2. from super_gradients.training.utils.bbox_formats.bbox_format import (
  3. BoundingBoxFormat,
  4. )
  5. from super_gradients.training.utils.bbox_formats.normalized_xyxy import (
  6. normalized_xyxy_to_xyxy_inplace,
  7. xyxy_to_normalized_xyxy_inplace,
  8. xyxy_to_normalized_xyxy,
  9. )
  10. from super_gradients.training.utils.bbox_formats.xywh import xywh_to_xyxy_inplace, xywh_to_xyxy, xyxy_to_xywh_inplace
  11. __all__ = [
  12. "xyxy_to_normalized_xywh",
  13. "normalized_xywh_to_xyxy_inplace",
  14. "xyxy_to_normalized_xywh_inplace",
  15. "normalized_xywh_to_xyxy",
  16. "NormalizedXYWHCoordinateFormat",
  17. ]
  18. def normalized_xywh_to_xyxy(bboxes, image_shape: Tuple[int, int]):
  19. normalized_xyxy = xywh_to_xyxy(bboxes, image_shape) # Out-of-place
  20. return normalized_xyxy_to_xyxy_inplace(normalized_xyxy, image_shape) # Can be done inplace
  21. def normalized_xywh_to_xyxy_inplace(bboxes, image_shape: Tuple[int, int]):
  22. normalized_xyxy = xywh_to_xyxy_inplace(bboxes, image_shape)
  23. return normalized_xyxy_to_xyxy_inplace(normalized_xyxy, image_shape)
  24. def xyxy_to_normalized_xywh(bboxes, image_shape: Tuple[int, int]):
  25. normalized_xyxy = xyxy_to_normalized_xyxy(bboxes, image_shape)
  26. return xyxy_to_xywh_inplace(normalized_xyxy, image_shape) # Can be done inplace
  27. def xyxy_to_normalized_xywh_inplace(bboxes, image_shape: Tuple[int, int]):
  28. normalized_xyxy = xyxy_to_normalized_xyxy_inplace(bboxes, image_shape)
  29. return xyxy_to_xywh_inplace(normalized_xyxy, image_shape)
  30. class NormalizedXYWHCoordinateFormat(BoundingBoxFormat):
  31. def __init__(self):
  32. self.format = "normalized_xywh"
  33. self.normalized = True
  34. def get_to_xyxy(self, inplace: bool):
  35. if inplace:
  36. return normalized_xywh_to_xyxy_inplace
  37. else:
  38. return normalized_xywh_to_xyxy
  39. def get_from_xyxy(self, inplace: bool):
  40. if inplace:
  41. return xyxy_to_normalized_xywh_inplace
  42. else:
  43. return xyxy_to_normalized_xywh
Discard
Tip!

Press p or to see the previous file or, n or to see the next file