Bläddra i källkod

bugfix: dont pass index_type and metric_type in append_index()

gaotingquan 1 år sedan
förälder
incheckning
6fd3944c4f

+ 4 - 1
paddlex/inference/components/retrieval/faiss.py

@@ -333,8 +333,11 @@ class FaissBuilder:
             else:
                 index.train(gallery_features)
 
-        if not metric_type in cls.BINARY_METRIC_TYPE:
+        if metric_type not in cls.BINARY_METRIC_TYPE:
             index.add_with_ids(gallery_features, ids_now)
+        # TODO(gaotingquan): how append when using hamming metric type
+        # else:
+        #   pass
 
         for i, d in zip(list(ids_now), gallery_docs):
             ids[i] = d

+ 2 - 9
paddlex/inference/pipelines/pp_shitu_v2.py

@@ -133,27 +133,20 @@ class ShiTuV2Pipeline(BasePipeline):
             self.rec_model.predict,
             metric_type=metric_type,
             index_type=index_type,
-            **kwargs
         )
 
-    def remove_index(self, remove_ids, index, **kwargs):
-        return FaissBuilder.remove(remove_ids, index, **kwargs)
+    def remove_index(self, remove_ids, index):
+        return FaissBuilder.remove(remove_ids, index)
 
     def append_index(
         self,
         gallery_imgs,
         gallery_label,
         index,
-        id_map=None,
-        metric_type="IP",
-        index_type="HNSW32",
-        **kwargs
     ):
         return FaissBuilder.append(
             gallery_imgs,
             gallery_label,
             self.rec_model.predict,
             index,
-            metric_type=metric_type,
-            **kwargs
         )