Files
sora_python/app/service/outfit_matcher/service.py
2024-03-12 12:11:26 +08:00

26 lines
1.1 KiB
Python

import json
from app.service.outfit_matcher.dataset import FashionDataset
from app.service.outfit_matcher.outfit_evaluator import OutfitMaterTypeAware
if __name__ == '__main__':
with open("./test_param/recommendation_test.json", "r") as f:
param = json.load(f)
fashion_dataset = FashionDataset(param["database"])
for item in param["query"]:
outfits = fashion_dataset.generate_outfit(item, param["topk"], param["max_outfits"])
service = OutfitMaterTypeAware()
scores = service.get_result(outfits)
print(scores)
# service.visualize(outfits, scores, param["topk"], best=True,
# output_path=os.path.join(
# r"E:\workspace\outfit_matcher\2024 SS Outfit",
# f"{item['item_name']}_best_{param['topk']}.png"
# ))
# service.visualize(outfits, scores, param["topk"], best=False,
# output_path=os.path.join(
# r"E:\workspace\outfit_matcher\2024 SS Outfit",
# f"{item['item_name']}_worst_{param['topk']}.png"
# ))