Browse Source

Merge branch 'sort_debug_20230811' into test

linfan 1 year ago
parent
commit
c8f116efef
1 changed files with 9 additions and 2 deletions
  1. 9 2
      video_rank.py

+ 9 - 2
video_rank.py

@@ -643,6 +643,7 @@ def video_new_rank2(data, size, top_K, flow_pool_P, ab_code, mid, exp_config=Non
         #print("env_dict:", env_dict)
         feature_dict = get_featurs(mid, data, size, top_K, flow_pool_P, rec_recall_vid_list,env_dict, video_static_info, video_hour_static_info)
         score_result = get_tf_serving_sores(feature_dict)
+
         #print("score_result:", score_result)
         if video_scores and len(video_scores)>0  and rec_recall_item_list and score_result and len(score_result) > 0\
                 and len(score_result) == len(rec_recall_item_list) and len(video_scores)== len(score_result):
@@ -656,27 +657,33 @@ def video_new_rank2(data, size, top_K, flow_pool_P, ab_code, mid, exp_config=Non
                         else:
                             total_score = return_score * score_result[i][0]
                         rec_recall_item_list[i]['sort_score'] = total_score
+                        rec_recall_item_list[i]['base_rov_score'] = 0.0
+                        rec_recall_item_list[i]['share_score'] = return_score
                     else:
                         video_score_str = json.loads(video_scores[i])
                         # sore_index :10 = model score
+                        return_score = 0.000000001
                         if sort_index == 10:
                             total_score = score_result[i][0]
                         else:
-                            return_score  = 0.000000001
                             if len(video_score_str)>= sort_index and  len(video_score_str)>0:
                                 return_score = video_score_str[sort_index]
                             total_score = return_score * score_result[i][0]
                             #print("total_score:", total_score, " model score :", score_result[i][0], "return_score:",
                              #     return_score)
                         rec_recall_item_list[i]['sort_score'] = total_score
+                        rec_recall_item_list[i]['base_rov_score'] = video_score_str[0]
+                        rec_recall_item_list[i]['share_score'] = return_score
                 except Exception as e:
                     #print('exception: {}:', e)
+                    return_score = 0.000000001
                     if sort_index == 10:
                         total_score = 0.00000001
                     else:
-                        return_score = 0.000000001
                         total_score = return_score * 0.00000001
                     rec_recall_item_list[i]['sort_score'] = total_score
+                    rec_recall_item_list[i]['base_rov_score'] = video_score_str[0]
+                    rec_recall_item_list[i]['share_score'] = return_score
                 rec_recall_item_list[i]['flag_call_service'] = 1
             rov_recall_rank = sorted(rec_recall_item_list, key=lambda k: k.get('sort_score', 0), reverse=True)
         else: