summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/faceSearch/faceSearch.result.js4
-rw-r--r--megapixels/app/models/sql_factory.py22
-rw-r--r--megapixels/app/processors/faiss.py3
-rw-r--r--megapixels/app/server/api.py1
-rw-r--r--site/assets/css/applets.css2
5 files changed, 19 insertions, 13 deletions
diff --git a/client/faceSearch/faceSearch.result.js b/client/faceSearch/faceSearch.result.js
index 95534830..c2509033 100644
--- a/client/faceSearch/faceSearch.result.js
+++ b/client/faceSearch/faceSearch.result.js
@@ -72,8 +72,8 @@ class FaceSearchResult extends Component {
}
const els = results.map((result, i) => {
const distance = distances[i]
- const { uuid } = result.uuid
- const { x, y, w, h } = result.roi
+ const { uuid } = result.file_record
+ const { x, y, w, h } = result.face_roi
const { fullname, gender, description, images } = result.identity
const bbox = {
left: (100 * x) + '%',
diff --git a/megapixels/app/models/sql_factory.py b/megapixels/app/models/sql_factory.py
index a71eabb0..5b3cb5a3 100644
--- a/megapixels/app/models/sql_factory.py
+++ b/megapixels/app/models/sql_factory.py
@@ -96,22 +96,24 @@ class SqlDataset:
Get an identity given an ID.
"""
# id += 1
- print('fetching {}'.format(id))
-
file_record_table = self.get_table('file_record')
file_record = file_record_table.query.filter(file_record_table.id == id).first()
+ if not file_record:
+ return None
+
identity_table = self.get_table('identity')
identity = identity_table.query.filter(identity_table.id == file_record.identity_id).first()
- if file_record and identity:
- return {
- 'file_record': file_record.toJSON(),
- 'identity': identity.toJSON(),
- 'face_roi': self.select('face_roi', id),
- 'face_pose': self.select('face_pose', id),
- }
- return {}
+ if not identity:
+ return None
+
+ return {
+ 'file_record': file_record.toJSON(),
+ 'identity': identity.toJSON(),
+ 'face_roi': self.select('face_roi', id),
+ 'face_pose': self.select('face_pose', id),
+ }
def search_name(self, q):
"""
diff --git a/megapixels/app/processors/faiss.py b/megapixels/app/processors/faiss.py
index 5156ad71..ab067fd0 100644
--- a/megapixels/app/processors/faiss.py
+++ b/megapixels/app/processors/faiss.py
@@ -30,6 +30,9 @@ def build_faiss_database(name, recipe):
vec_fn = os.path.join(cfg.DIR_FAISS_METADATA, name, "vecs.csv")
index_fn = os.path.join(cfg.DIR_FAISS_INDEXES, name + ".index")
+ if not os.path.exists(vec_fn):
+ return
+
index = faiss.index_factory(recipe.dim, recipe.factory_type)
keys, rows = load_csv_safe(vec_fn)
diff --git a/megapixels/app/server/api.py b/megapixels/app/server/api.py
index af3db4d0..5f80a0c4 100644
--- a/megapixels/app/server/api.py
+++ b/megapixels/app/server/api.py
@@ -114,6 +114,7 @@ def upload(dataset_name):
ids.append(_i+1)
identities = [ dataset.get_identity(int(_i)) for _i in ids ]
+ identities = list(filter(None, identities))
# print(distances)
# print(ids)
diff --git a/site/assets/css/applets.css b/site/assets/css/applets.css
index b2b3c85e..b64da4b7 100644
--- a/site/assets/css/applets.css
+++ b/site/assets/css/applets.css
@@ -60,7 +60,7 @@
.img .bbox {
position: absolute;
color: rgba(255,255,255,1);
- background: rgba(255,255,255,255.05);
+ background: rgba(255,255,255,0.05);
border: 1px solid;
}
.cta {