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

test_predict.py 1000 B

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 os
  2. import unittest
  3. import tempfile
  4. from super_gradients.common.object_names import Models
  5. from super_gradients.training import models
  6. class TestModelPredict(unittest.TestCase):
  7. def setUp(self) -> None:
  8. rootdir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
  9. self.images = [
  10. os.path.join(rootdir, "documentation", "source", "images", "examples", "countryside.jpg"),
  11. os.path.join(rootdir, "documentation", "source", "images", "examples", "street_busy.jpg"),
  12. "https://deci-datasets-research.s3.amazonaws.com/image_samples/beatles-abbeyroad.jpg",
  13. ]
  14. def test_classification_models(self):
  15. model = models.get(Models.RESNET18, pretrained_weights="imagenet")
  16. with tempfile.TemporaryDirectory() as tmp_dirname:
  17. predictions = model.predict(self.images)
  18. predictions.show()
  19. predictions.save(output_folder=tmp_dirname)
  20. if __name__ == "__main__":
  21. unittest.main()
Tip!

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

Comments

Loading...