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

deci_yolo_test.py 2.2 KB

You have to be logged in to leave a comment. Sign In
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
  1. import unittest
  2. from super_gradients.training import models
  3. from super_gradients.training.dataloaders import coco2017_val_deci_yolo
  4. from super_gradients.training import Trainer
  5. from super_gradients.training.metrics import DetectionMetrics
  6. from super_gradients.training.models.detection_models.pp_yolo_e import PPYoloEPostPredictionCallback
  7. class DeciYoloTest(unittest.TestCase):
  8. def test_deciyolo_s_coco(self):
  9. trainer = Trainer("test_deci_yolo_s")
  10. model = models.get("deciyolo_s", num_classes=80, pretrained_weights="coco")
  11. dl = coco2017_val_deci_yolo()
  12. metrics = [
  13. DetectionMetrics(
  14. post_prediction_callback=PPYoloEPostPredictionCallback(score_threshold=0.03, nms_top_k=1000, max_predictions=300, nms_threshold=0.65),
  15. num_cls=80,
  16. )
  17. ]
  18. map_result = trainer.test(model=model, test_loader=dl, test_metrics_list=metrics)[2]
  19. self.assertAlmostEqual(map_result, 0.475, delta=0.001)
  20. def test_deciyolo_m_coco(self):
  21. trainer = Trainer("test_deci_yolo_m")
  22. model = models.get("deciyolo_m", num_classes=80, pretrained_weights="coco")
  23. dl = coco2017_val_deci_yolo()
  24. metrics = [
  25. DetectionMetrics(
  26. post_prediction_callback=PPYoloEPostPredictionCallback(score_threshold=0.03, nms_top_k=1000, max_predictions=300, nms_threshold=0.65),
  27. num_cls=80,
  28. )
  29. ]
  30. map_result = trainer.test(model=model, test_loader=dl, test_metrics_list=metrics)[2]
  31. self.assertAlmostEqual(map_result, 0.5155, delta=0.001)
  32. def test_deciyolo_l_coco(self):
  33. trainer = Trainer("test_deci_yolo_l")
  34. model = models.get("deciyolo_l", num_classes=80, pretrained_weights="coco")
  35. dl = coco2017_val_deci_yolo()
  36. metrics = [
  37. DetectionMetrics(
  38. post_prediction_callback=PPYoloEPostPredictionCallback(score_threshold=0.03, nms_top_k=1000, max_predictions=300, nms_threshold=0.65),
  39. num_cls=80,
  40. )
  41. ]
  42. map_result = trainer.test(model=model, test_loader=dl, test_metrics_list=metrics)[2]
  43. self.assertAlmostEqual(map_result, 0.5222, delta=0.001)
  44. if __name__ == "__main__":
  45. unittest.main()
Tip!

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

Comments

Loading...