chore: import upstream snapshot with attribution
build / build (macos-latest) (push) Has been cancelled
build / build (ubuntu-latest) (push) Has been cancelled
build / build (windows-latest) (push) Has been cancelled
minimal / deploy (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:38:00 +08:00
commit 3a7c47b2a6
623 changed files with 133790 additions and 0 deletions
@@ -0,0 +1,40 @@
"""
Objects module tests
"""
import unittest
from txtai.pipeline import Objects
# pylint: disable=C0411
from utils import Utils
class TestObjects(unittest.TestCase):
"""
Object detection tests.
"""
def testClassification(self):
"""
Test object detection using an image classification model
"""
objects = Objects(classification=True, threshold=0.3)
self.assertEqual(objects(Utils.PATH + "/books.jpg")[0][0], "library")
def testDetection(self):
"""
Test object detection using an object detection model
"""
objects = Objects()
self.assertEqual(objects(Utils.PATH + "/books.jpg")[0][0], "book")
def testFlatten(self):
"""
Test object detection using an object detection model, flatten to return only objects
"""
objects = Objects()
self.assertEqual(objects(Utils.PATH + "/books.jpg", flatten=True)[0], "book")