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

depth_estimation_dataset_test.py 1.1 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
  1. import unittest
  2. from pathlib import Path
  3. import os
  4. import numpy as np
  5. from super_gradients.training.datasets.depth_estimation_datasets import NYUv2DepthEstimationDataset
  6. class DepthEstimationDatasetTest(unittest.TestCase):
  7. def setUp(self) -> None:
  8. self.mini_nyuv2_data_dir = str(Path(__file__).parent.parent / "data" / "nyu2_mini_test")
  9. self.mini_nyuv2_df_path = os.path.join(self.mini_nyuv2_data_dir, "nyu2_mini_test.csv")
  10. def test_normal_nyuv2_creation(self):
  11. dataset = NYUv2DepthEstimationDataset(root=self.mini_nyuv2_data_dir, df_path=self.mini_nyuv2_df_path)
  12. for i, (image, depth_map) in enumerate(dataset):
  13. self.assertTrue(isinstance(image, np.ndarray))
  14. self.assertTrue(isinstance(depth_map, np.ndarray))
  15. self.assertTrue(len(dataset) == 10 and i == 9)
  16. def test_depth_estimation_plot(self):
  17. dataset = NYUv2DepthEstimationDataset(root=self.mini_nyuv2_data_dir, df_path=self.mini_nyuv2_df_path)
  18. dataset.plot(max_samples_per_plot=8)
  19. if __name__ == "__main__":
  20. unittest.main()
Tip!

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

Comments

Loading...