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

#587 Feature/sg 521 gpu tests

Merged
Ghost merged 1 commits into Deci-AI:master from deci-ai:feature/SG-521_gpu_tests
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
  1. import unittest
  2. from pathlib import Path
  3. from super_gradients.training.datasets import COCODetectionDataset
  4. from super_gradients.training.exceptions.dataset_exceptions import DatasetValidationException, ParameterMismatchException
  5. class DetectionDatasetTest(unittest.TestCase):
  6. def setUp(self) -> None:
  7. self.mini_coco_data_dir = str(Path(__file__).parent.parent / "data" / "tinycoco")
  8. def test_normal_coco_dataset_creation(self):
  9. train_dataset_params = {
  10. "data_dir": self.mini_coco_data_dir,
  11. "subdir": "images/train2017",
  12. "json_file": "instances_train2017.json",
  13. "cache": False,
  14. "input_dim": [512, 512],
  15. }
  16. COCODetectionDataset(**train_dataset_params)
  17. def test_coco_dataset_creation_with_wrong_classes(self):
  18. train_dataset_params = {
  19. "data_dir": self.mini_coco_data_dir,
  20. "subdir": "images/train2017",
  21. "json_file": "instances_train2017.json",
  22. "cache": False,
  23. "input_dim": [512, 512],
  24. "all_classes_list": ["One", "Two", "Three"],
  25. }
  26. with self.assertRaises(DatasetValidationException):
  27. COCODetectionDataset(**train_dataset_params)
  28. def test_coco_dataset_creation_with_subset_classes(self):
  29. train_dataset_params = {
  30. "data_dir": self.mini_coco_data_dir,
  31. "subdir": "images/train2017",
  32. "json_file": "instances_train2017.json",
  33. "cache": False,
  34. "input_dim": [512, 512],
  35. "all_classes_list": ["car", "person", "bird"],
  36. }
  37. with self.assertRaises(ParameterMismatchException):
  38. COCODetectionDataset(**train_dataset_params)
  39. if __name__ == "__main__":
  40. unittest.main()
Discard
Tip!

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