Explorar o código

向量匹配视频 匹配参数修改

wangyunpeng hai 5 días
pai
achega
284465cab8

+ 3 - 0
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/model/dto/RecallVideoScoreParam.java

@@ -28,6 +28,9 @@ public class RecallVideoScoreParam {
     /** 相似度下界(粗筛阈值),默认 0.7 */
     private Double simMin;
 
+    /** ROV 最小值限制,低于此值的视频将被过滤;为空则不限制 */
+    private Double rovMin;
+
     /** 指标数据日期维度(天),默认 7 */
     private Integer days;
 }

+ 7 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -533,9 +533,11 @@ public class CoreServiceImpl implements CoreService {
         }
         RecallVideoScoreParam param = new RecallVideoScoreParam();
         param.setQueryText(matchContent.getTitle());
-        param.setTopN(3);
+        param.setTopN(10);
         param.setAlpha(0.6);
         param.setSimMin(0.6);
+        param.setRovMin(0.0);
+        param.setDays(30);
         if (StringUtils.isNotEmpty(recallVideoConfigCode)) {
             param.setConfigCode(recallVideoConfigCode);
         }
@@ -545,6 +547,10 @@ public class CoreServiceImpl implements CoreService {
             return;
         }
         log.info("recallWithScore results, contentId={}, total={}", matchContent.getSourceId(), result.getTotal());
+        // 截取前三条
+        if (result.getItems().size() > 3) {
+            result.setItems(result.getItems().subList(0, 3));
+        }
         int savedCount = 0;
         for (RecallVideoScoreVO.ScoredVideoItem item : result.getItems()) {
             if (item.getVideoId() == null) {

+ 7 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/NewMatchVideoServiceImpl.java

@@ -247,9 +247,11 @@ public class NewMatchVideoServiceImpl implements NewMatchVideoService {
         // 调用向量召回
         RecallVideoScoreParam param = new RecallVideoScoreParam();
         param.setQueryText(title);
-        param.setTopN(3);
+        param.setTopN(10);
         param.setAlpha(0.6);
         param.setSimMin(0.6);
+        param.setRovMin(0.0);
+        param.setDays(30);
         if (StringUtils.isNotEmpty(recallVideoConfigCode)) {
             param.setConfigCode(recallVideoConfigCode);
         }
@@ -265,6 +267,10 @@ public class NewMatchVideoServiceImpl implements NewMatchVideoService {
             return;
         }
         log.info("recallWithScore results, contentId={}, total={}", article.getContentId(), result.getTotal());
+        // 截取前三条
+        if (result.getItems().size() > 3) {
+            result.setItems(result.getItems().subList(0, 3));
+        }
         int savedCount = 0;
         for (RecallVideoScoreVO.ScoredVideoItem item : result.getItems()) {
             if (item.getVideoId() == null) {