增加配置文件
This commit is contained in:
@@ -480,14 +480,15 @@ def main():
|
||||
"""主函数"""
|
||||
# 配置参数
|
||||
# MODEL_PATH = "../model/embedding_20251011_133653/best_embedding_model.pth"
|
||||
# MODEL_PATH = "../model/ProcessedIngredientRecognition/embedding_20251029_170904/best_embedding_model.pth"
|
||||
MODEL_PATH = "../model/WholeIngredientRecognition/embedding_20251030_135024/best_embedding_model.pth"
|
||||
MODEL_PATH = "../model/ProcessedIngredientRecognition/embedding_20251103_172012/best_embedding_model.pth"
|
||||
# MODEL_PATH = "../model/WholeIngredientRecognition/embedding_20251030_135024/best_embedding_model.pth"
|
||||
# MODEL_PATH = "../model/DishClassification/embedding_20251022_093635/best_embedding_model.pth"
|
||||
# TRAIN_DIR = "../dataset/ProcessedIngredientRecognition/train"
|
||||
TRAIN_DIR = "../dataset/WholeIngredientRecognition/train"
|
||||
TRAIN_DIR = "../dataset/ProcessedIngredientRecognition/train"
|
||||
# TRAIN_DIR = "../dataset/WholeIngredientRecognition/train"
|
||||
# TRAIN_DIR = "../dataset/DishClassification/train"
|
||||
# OUTPUT_DIR = "ProcessedIngredientRecognition/faiss_index"
|
||||
OUTPUT_DIR = "WholeIngredientRecognition/faiss_index"
|
||||
|
||||
OUTPUT_DIR = "ProcessedIngredientRecognition/faiss_index"
|
||||
# OUTPUT_DIR = "WholeIngredientRecognition/faiss_index"
|
||||
# OUTPUT_DIR = "DishClassification/faiss_index"
|
||||
BATCH_SIZE = 16
|
||||
INDEX_TYPE = 'flat' # 'flat', 'ivf', 'hnsw'
|
||||
|
||||
@@ -163,11 +163,11 @@ def plot_2d(Z: np.ndarray, y: np.ndarray, title: str, out_path: Optional[str] =
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="可视化高维 embedding 并进行坍塌诊断")
|
||||
# parser.add_argument("--embeddings", type=str, default=os.path.join("DishClassification/faiss_index", "embeddings.json"), help="embeddings.json 路径")
|
||||
parser.add_argument("--embeddings", type=str, default=os.path.join("WholeIngredientRecognition/faiss_index", "embeddings.json"), help="embeddings.json 路径")
|
||||
# parser.add_argument("--embeddings", type=str, default=os.path.join("ProcessedIngredientRecognition/faiss_index", "embeddings.json"), help="embeddings.json 路径")
|
||||
# parser.add_argument("--embeddings", type=str, default=os.path.join("WholeIngredientRecognition/faiss_index", "embeddings.json"), help="embeddings.json 路径")
|
||||
parser.add_argument("--embeddings", type=str, default=os.path.join("ProcessedIngredientRecognition/faiss_index", "embeddings.json"), help="embeddings.json 路径")
|
||||
# parser.add_argument("--labels", type=str, default=os.path.join("DishClassification/faiss_index", "labels.json"), help="labels.json 路径")
|
||||
parser.add_argument("--labels", type=str, default=os.path.join("WholeIngredientRecognition/faiss_index", "labels.json"), help="labels.json 路径")
|
||||
# parser.add_argument("--labels", type=str, default=os.path.join("ProcessedIngredientRecognition/faiss_index", "labels.json"), help="labels.json 路径")
|
||||
# parser.add_argument("--labels", type=str, default=os.path.join("WholeIngredientRecognition/faiss_index", "labels.json"), help="labels.json 路径")
|
||||
parser.add_argument("--labels", type=str, default=os.path.join("ProcessedIngredientRecognition/faiss_index", "labels.json"), help="labels.json 路径")
|
||||
parser.add_argument("--method", type=str, default="pca", choices=["pca", "tsne", "umap"], help="降维方法")
|
||||
parser.add_argument("--seed", type=int, default=42)
|
||||
parser.add_argument("--max_points", type=int, default=None, help="抽样上限,避免t-SNE/UMAP过慢;None为全量")
|
||||
|
||||
@@ -821,6 +821,6 @@ if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("task", choices=list(TASKS.keys()), nargs="?", default="dish")
|
||||
args = parser.parse_args()
|
||||
# main("processed_ingredient")
|
||||
main("whole_ingredient")
|
||||
main("processed_ingredient")
|
||||
# main("whole_ingredient")
|
||||
# main("dish")
|
||||
Reference in New Issue
Block a user