Fangrui Liu commited on
Commit
1e639d2
1 Parent(s): c7cf43e

revised query strategy

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. query_model.py +2 -2
app.py CHANGED
@@ -118,7 +118,7 @@ def query(xq, exclude_list=None):
118
  IMG_DB_NAME,
119
  OBJ_DB_NAME,
120
  exclude_list=exclude_list,
121
- topk=5000,
122
  )
123
  img_ids = [r["img_id"] for r in matches]
124
  if "topk_img_id" not in st.session_state:
@@ -141,7 +141,7 @@ def query(xq, exclude_list=None):
141
  IMG_DB_NAME,
142
  OBJ_DB_NAME,
143
  thresh=-1,
144
- topk=5000,
145
  )
146
  status_bar[0].write("Retrieving Non-TopK in Another TopK Images...")
147
  pbar.progress(75)
 
118
  IMG_DB_NAME,
119
  OBJ_DB_NAME,
120
  exclude_list=exclude_list,
121
+ topk=10,
122
  )
123
  img_ids = [r["img_id"] for r in matches]
124
  if "topk_img_id" not in st.session_state:
 
141
  IMG_DB_NAME,
142
  OBJ_DB_NAME,
143
  thresh=-1,
144
+ topk=10,
145
  )
146
  status_bar[0].write("Retrieving Non-TopK in Another TopK Images...")
147
  pbar.progress(75)
query_model.py CHANGED
@@ -22,8 +22,8 @@ def topk_obj_query(client, xq, IMG_DB_NAME, OBJ_DB_NAME,
22
  WHERE obj_id IN (
23
  SELECT obj_id FROM (
24
  SELECT obj_id, distance(prelogit, {_xq}) AS dist FROM {OBJ_DB_NAME}
25
- ORDER BY dist DESC LIMIT {topk}
26
- ) {_cond} LIMIT 10
27
  )
28
  """)
29
  _subq_str = ' UNION ALL '.join(_subq_str)
 
22
  WHERE obj_id IN (
23
  SELECT obj_id FROM (
24
  SELECT obj_id, distance(prelogit, {_xq}) AS dist FROM {OBJ_DB_NAME}
25
+ ORDER BY dist DESC LIMIT 5000
26
+ ) {_cond} LIMIT {topk}
27
  )
28
  """)
29
  _subq_str = ' UNION ALL '.join(_subq_str)