修改配置。

This commit is contained in:
2025-11-07 09:40:54 +08:00
parent 3ca5d6e7d0
commit 45ed6b905a
5 changed files with 20 additions and 19 deletions
+4 -4
View File
@@ -17,8 +17,8 @@ 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_20251105_200551/best_cosface_model.pth"
# model_path = "../model/WholeIngredientRecognition/embedding_20251030_135024/best_embedding_model.pth"
# model_path = "../model/DishClassification/cosface_20251105_200551/best_cosface_model.pth"
model_path = "../model/WholeIngredientRecognition/cosface_20251106_134718/best_cosface_model.pth"
# model_path = "../model/ProcessedIngredientRecognition/embedding_20251029_173607/best_embedding_model.pth"
if not os.path.exists(model_path):
@@ -92,8 +92,8 @@ def main():
traced_model = torch.jit.trace(mobile_wrapper, single_input)
# 保存模型
output_path = "../model/DishClassification/cosface_20251105_200551/best_embedding_model_mobile.pt"
# output_path = "../model/WholeIngredientRecognition/embedding_20251030_135024/best_embedding_model_mobile.pt"
# output_path = "../model/DishClassification/cosface_20251105_200551/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)
print(f"✓ TorchScript模型保存成功: {output_path}")