不要类别加权

This commit is contained in:
2025-11-26 14:50:00 +08:00
parent 99d9eea757
commit 0e8a1df590
5 changed files with 28 additions and 21 deletions
+5 -5
View File
@@ -17,9 +17,9 @@ def main():
# 1. 加载训练好的embedding模型权重
# base_model = create_resnet50_embedding(embedding_dim=512, pretrained=True)
base_model = create_mobile_resnet50_embedding(embedding_dim=512, pretrained=True)
# model_path = "../model/DishClassification/cosface_20251110_144822/best_cosface_model.pth"
model_path = "../model/DishClassification/grid_search_20251121_102723/model_s56.0_m0.4.pth"
# model_path = "../model/WholeIngredientRecognition/cosface_20251106_134718/best_cosface_model.pth"
model_path = "../model/WholeIngredientRecognition/grid_search_20251113_095659/model_s68.0_m0.4.pth"
# model_path = "../model/WholeIngredientRecognition/grid_search_20251120_205839/model_s68.0_m0.38.pth"
# model_path = "../model/ProcessedIngredientRecognition/embedding_20251029_173607/best_embedding_model.pth"
if not os.path.exists(model_path):
@@ -92,9 +92,9 @@ def main():
# 使用trace方法转换
traced_model = torch.jit.trace(mobile_wrapper, single_input)
# 保存模型
# output_path = "../model/DishClassification/cosface_20251110_144822/best_embedding_model_mobile.pt"
output_path = "../model/WholeIngredientRecognition/grid_search_20251113_095659/best_embedding_model_mobile.pt"
# 保存模型,一定不要乱改,防止模型覆盖!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
output_path = "../model/DishClassification/grid_search_20251121_102723/best_embedding_model_mobile.pt"
# output_path = "../model/WholeIngredientRecognition/grid_search_20251120_205839/best_embedding_model_mobile.pt"
# output_path = "../model/WholeIngredientRecognition/cosface_20251106_134718/best_embedding_model_mobile.pt"
# output_path = "../model/ProcessedIngredientRecognition/embedding_20251029_173607/best_embedding_model_mobile.pt"
traced_model.save(output_path)