修改配置

This commit is contained in:
2025-10-09 09:59:36 +08:00
parent f3e3bd048a
commit a14aa7f8e1
4 changed files with 4 additions and 3 deletions
+1
View File
@@ -3,3 +3,4 @@
/model/ /model/
/faiss_vector_db/demo_faiss_index/ /faiss_vector_db/demo_faiss_index/
/faiss_vector_db/faiss_index/ /faiss_vector_db/faiss_index/
/faiss_vector_db/faiss_index092901/
+1 -1
View File
@@ -61,7 +61,7 @@ class EmbeddingFoodClassifierApp:
"""加载训练好的embedding模型和FAISS索引""" """加载训练好的embedding模型和FAISS索引"""
try: try:
# 模型路径 # 模型路径
model_path = "../model/embedding_20250929_151102/best_embedding_model.pth" model_path = "../model/embedding_20250930_102826/best_embedding_model.pth"
# FAISS索引目录 # FAISS索引目录
index_dir = "../faiss_vector_db/faiss_index" index_dir = "../faiss_vector_db/faiss_index"
+1 -1
View File
@@ -27,7 +27,7 @@ for class_name in os.listdir(input_root):
input_dir = os.path.join(input_root, class_name) input_dir = os.path.join(input_root, class_name)
output_dir = os.path.join(output_root, class_name) output_dir = os.path.join(output_root, class_name)
os.makedirs(output_dir, exist_ok=True) os.makedirs(output_dir, exist_ok=True)
if class_name == "麻婆豆腐": if class_name == "肉沫酸豆角":
# 读取类别下所有图片路径 # 读取类别下所有图片路径
img_files = [f for f in os.listdir(input_dir) if f.lower().endswith(('.jpg', '.png', '.jpeg'))] img_files = [f for f in os.listdir(input_dir) if f.lower().endswith(('.jpg', '.png', '.jpeg'))]
img_paths = [os.path.join(input_dir, f) for f in img_files] img_paths = [os.path.join(input_dir, f) for f in img_files]
+1 -1
View File
@@ -477,7 +477,7 @@ class FAISSSearcher:
def main(): def main():
"""主函数""" """主函数"""
# 配置参数 # 配置参数
MODEL_PATH = "../model/embedding_20250929_151102/best_embedding_model.pth" MODEL_PATH = "../model/embedding_20250930_102826/best_embedding_model.pth"
TRAIN_DIR = "../dataset/train" TRAIN_DIR = "../dataset/train"
OUTPUT_DIR = "faiss_index" OUTPUT_DIR = "faiss_index"
BATCH_SIZE = 16 BATCH_SIZE = 16