aboutsummaryrefslogtreecommitdiffstats
path: root/test/extractor/image/face
diff options
context:
space:
mode:
Diffstat (limited to 'test/extractor/image/face')
-rw-r--r--test/extractor/image/face/test_detect.py8
-rw-r--r--test/extractor/image/face/test_identify.py15
2 files changed, 14 insertions, 9 deletions
diff --git a/test/extractor/image/face/test_detect.py b/test/extractor/image/face/test_detect.py
index 92375a2..89a3461 100644
--- a/test/extractor/image/face/test_detect.py
+++ b/test/extractor/image/face/test_detect.py
@@ -8,8 +8,9 @@ import unittest
# bsie imports
from bsie.extractor import base
+from bsie.matcher import nodes
from bsie.reader.face import FaceExtract
-from bsie.utils import bsfs, node as _node, ns
+from bsie.utils import bsfs, ns
# objects to test
from bsie.extractor.image.face.detect import FaceDetect, bsf
@@ -31,10 +32,11 @@ class TestFaceDetect(unittest.TestCase):
# setup
rdr = FaceExtract()
ext = FaceDetect()
- subject = _node.Node(ns.bsfs.Entity)
+ subject = nodes.Entity(ucid='abc123')
content = rdr(os.path.join(os.path.dirname(__file__), 'testface1.jpg'))
principals = set(ext.principals)
- face = _node.Node(ns.bsn.Face, ucid='2a7203c1515e0caa66a7461452c0b4552f1433a613cb3033e59ed2361790ad45')
+ face = nodes.Face(
+ ucid='2a7203c1515e0caa66a7461452c0b4552f1433a613cb3033e59ed2361790ad45')
triples = list(ext.extract(subject, content, principals))
# principals is bse:face
self.assertSetEqual(principals, {ext.schema.predicate(ns.bse.face)})
diff --git a/test/extractor/image/face/test_identify.py b/test/extractor/image/face/test_identify.py
index dde41db..2d52353 100644
--- a/test/extractor/image/face/test_identify.py
+++ b/test/extractor/image/face/test_identify.py
@@ -10,8 +10,9 @@ import requests
# bsie imports
from bsie.extractor import base
+from bsie.matcher import nodes
from bsie.reader.face import FaceExtract
-from bsie.utils import bsfs, node as _node, ns
+from bsie.utils import bsfs, ns
# objects to test
from bsie.extractor.image.face.identify import FaceIdentify, bsf
@@ -106,11 +107,12 @@ class TestFaceIdentify(unittest.TestCase):
os.path.join(os.path.dirname(__file__), 'ref_embeds.npy'),
os.path.join(os.path.dirname(__file__), 'ref_mapping.csv'),
)
- subject = _node.Node(ns.bsfs.Entity)
+ subject = nodes.Entity(ucid='abc123')
content = rdr(os.path.join(os.path.dirname(__file__), 'testface1.jpg'))
principals = set(ext.principals)
- face = _node.Node(ns.bsn.Face, ucid='2a7203c1515e0caa66a7461452c0b4552f1433a613cb3033e59ed2361790ad45')
- person = _node.Node(ns.bsn.Person, uri='https://example.com/user/Angelina_Jolie')
+ face = nodes.Face(
+ ucid='2a7203c1515e0caa66a7461452c0b4552f1433a613cb3033e59ed2361790ad45')
+ person = nodes.Person(uri='https://example.com/user/Angelina_Jolie')
triples = list(ext.extract(subject, content, principals))
# principls is bse:face, bsf:depicts
self.assertSetEqual(set(ext.principals), {
@@ -128,10 +130,11 @@ class TestFaceIdentify(unittest.TestCase):
self.assertListEqual(list(ext.extract(subject, content, principals)), [])
# identifies the correct person despite somewhat similar options
content = rdr(os.path.join(os.path.dirname(__file__), 'testface3.jpg'))
- face = _node.Node(ns.bsn.Face, ucid='f61fac01ef686ee05805afef1e7a10ba54c30dc1aa095d9e77d79ccdfeb40dc5')
+ face = nodes.Face(
+ ucid='f61fac01ef686ee05805afef1e7a10ba54c30dc1aa095d9e77d79ccdfeb40dc5')
triples = list(ext.extract(subject, content, principals))
self.assertEqual(len(triples), 2)
- person = _node.Node(ns.bsn.Person, uri='https://example.com/user/Paul_Rudd')
+ person = nodes.Person(uri='https://example.com/user/Paul_Rudd')
self.assertIn((subject, ext.schema.predicate(ns.bse.face), face), triples)
self.assertIn((face, ext.schema.predicate(bsf.depicts), person), triples)
# no triples on principal mismatch