增加一些设置。
This commit is contained in:
@@ -133,10 +133,12 @@ class FAISSIndexBuilder:
|
||||
print(f"类别 '{class_name}': {len(image_files)} 张图片")
|
||||
|
||||
for image_file in image_files:
|
||||
image_path = os.path.join(class_dir, image_file)
|
||||
image_paths.append(image_path)
|
||||
class_names.append(class_name)
|
||||
labels.append(class_idx)
|
||||
# 可以不添加那些增强的图片
|
||||
if image_file.startswith("img"):
|
||||
image_path = os.path.join(class_dir, image_file)
|
||||
image_paths.append(image_path)
|
||||
class_names.append(class_name)
|
||||
labels.append(class_idx)
|
||||
|
||||
print(f"总计扫描到 {len(image_paths)} 张图片")
|
||||
return image_paths, class_names, labels
|
||||
@@ -477,9 +479,13 @@ class FAISSSearcher:
|
||||
def main():
|
||||
"""主函数"""
|
||||
# 配置参数
|
||||
MODEL_PATH = "../model/embedding_20251011_133653/best_embedding_model.pth"
|
||||
TRAIN_DIR = "../dataset/train"
|
||||
OUTPUT_DIR = "faiss_index"
|
||||
# MODEL_PATH = "../model/embedding_20251011_133653/best_embedding_model.pth"
|
||||
MODEL_PATH = "../model/WholeIngredientRecognition/embedding_20251017_145836/best_embedding_model.pth"
|
||||
# MODEL_PATH = "../model/DishClassification/embedding_20251011_133653/best_embedding_model.pth"
|
||||
TRAIN_DIR = "../dataset/WholeIngredientRecognition/train"
|
||||
# TRAIN_DIR = "../dataset/DishClassification/train"
|
||||
OUTPUT_DIR = "WholeIngredientRecognition/faiss_index"
|
||||
# OUTPUT_DIR = "DishClassification/faiss_index"
|
||||
BATCH_SIZE = 16
|
||||
INDEX_TYPE = 'flat' # 'flat', 'ivf', 'hnsw'
|
||||
EMBEDDING_DIM = 512
|
||||
|
||||
Reference in New Issue
Block a user