Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

clean

roryclear63cb902c1737
diff --git a/clearcam.py b/clearcam.py
index a221071..467b7eb 100644
--- a/clearcam.py
+++ b/clearcam.py
@@ -634,7 +634,7 @@ def point_not_in_polygon(coords, poly):
return True
def run_encode_text(return_q, searcher, text):
- res = searcher._encode_text(text, realize=True)
+ res = searcher._encode_text(text).numpy()
return_q.put(res)
return res
diff --git a/clip_search.py b/clip_search.py
index c1c9806..51c78e7 100644
--- a/clip_search.py
+++ b/clip_search.py
@@ -124,15 +124,13 @@ class CLIPSearch:
print(f"\nTotal images loaded: {total_loaded}")
- def _encode_text(self, query, realize=False):
+ def _encode_text(self, query):
tokens = [49406]
tokens += self.tokenizer.encode(query)
tokens.append(49407)
if len(tokens) < 77: tokens += [0] * (77 - len(tokens))
tokens = Tensor([tokens])
- text_emb = encode_text(self.model, tokens)
- if realize: return text_emb.numpy()
- return text_emb
+ return encode_text(self.model, tokens)
def search(self, query=None, top_k=10, cam_name=None, timestamp=None, text_embedding=None):
if not self.image_embeddings: