|
from datetime import datetime |
|
|
|
from utils.operate_csv import * |
|
from utils.utils import * |
|
from utils.app import * |
|
|
|
|
|
|
|
def eval_model_csv(csv_file_path='./data/temp/temp.csv'): |
|
scores_predict = get_field_values(csv_file_path, "fashion_score_predict") |
|
scores_true = get_field_values(csv_file_path, "fashion_score_true") |
|
result = calculate_loss(scores_predict, scores_true) |
|
data = count_model_csv(csv_file_path) |
|
result.update(data) |
|
result['date'] = datetime.now().strftime("%Y-%m-%d") |
|
result['source'] = csv_file_path |
|
append_to_csv(result, './data/suanfamama-fashion-guangzhou-dataset/log.csv') |
|
|
|
|
|
|
|
def eval_model(): |
|
data = app_get_user() |
|
scores_predict = [row["fashion_score_predict"] for row in data if "fashion_score_predict" in row] |
|
scores_true = [row["fashion_score_true"] for row in data if "fashion_score_true" in row] |
|
result = calculate_loss(scores_predict, scores_true) |
|
result['date'] = datetime.now().strftime("%Y-%m-%d") |
|
result['source'] = 'users' |
|
append_to_csv(result, './data/suanfamama-fashion-guangzhou-dataset/log.csv') |
|
|
|
|
|
|
|
def count_model_csv(csv_file_path='./data/temp/temp.csv'): |
|
field_names = ['type', 'upper_garment', 'lower_garment', 'headgear', |
|
'sock', 'shoe', 'accessory', 'backpack', 'scene', |
|
'action', 'countenance', 'base_model'] |
|
results = {} |
|
for field_name in field_names: |
|
data = get_field_values(csv_file_path, field_name) |
|
result = count_words_in_strings(data) |
|
results[field_name] = result |
|
return results |
|
|
|
if __name__ == '__main__': |
|
|
|
|
|
print(datetime.now()) |
|
eval_model_csv("./data/suanfamama-fashion-guangzhou-dataset/20240731.csv") |
|
print(datetime.now()) |
|
|