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

#970 Update YoloNASQuickstart.md

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:bugfix/SG-000_fix_readme_yolonas_snippets
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
  1. from typing import Tuple
  2. from torch import Tensor
  3. class RescoringPoseEstimationDecodeCallback:
  4. """
  5. A special adapter callback to be used with PoseEstimationMetrics to use the outputs from rescoring model inside metric class.
  6. """
  7. def __init__(self, apply_sigmoid: bool):
  8. """
  9. :param apply_sigmoid: If True, apply the sigmoid activation on heatmap. This is needed when heatmap is not
  10. bound to [0..1] range and trained with logits (E.g focal loss)
  11. """
  12. super().__init__()
  13. self.apply_sigmoid = apply_sigmoid
  14. def __call__(self, predictions: Tuple[Tensor, Tensor]) -> Tuple[Tensor, Tensor]:
  15. """ """
  16. poses, scores = predictions
  17. if self.apply_sigmoid:
  18. scores = scores.sigmoid()
  19. return poses, scores.squeeze(-1) # Pose Estimation Callback expects that scores don't have the dummy dimension
Discard
Tip!

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