<jupyter_start><jupyter_text>Load evaluation module for image classification<jupyter_code>from detail import detaileval_cls 
from importlib import reload
reload(detaileval_cls)
detaileval = detaileval_cls.DetailEvalCls(detailsGt)<jupyter_output>Total category #59, total img #10100<jupyter_text>Fake result json for evaluation<jupyter_code>## fake a result json for evaluation
detailRes = []
count = 0
for gt_img in detaileval.gt_imgs:
    detailRes.append({'image_id': gt_img['image_id'], 'category_score': np.ndarray.tolist(np.zeros(59))})
    if(2 in gt_img['categories']):
        detailRes[-1]['category_score'][0] = 1
    if(23 in gt_img['categories'] and count < 200):
        count += 1
        detailRes[-1]['category_score'][1] = 1
    '''
    for k in gt_img['categories']:
        cat_idx = detaileval.cat_idxs[k]
        detailRes[-1]['category_score'][cat_idx] = 1
    '''
result = {}
result['pred'] = detailRes
detail_res_file = '../res/detail_cls_fake_result.json'
json.dump(result, open(detail_res_file, 'w'), indent = 4)

detailRes = json.load(open('../res/detail_cls_fake_result.json', 'r'))['pred']

# start evaluation
detaileval.loadRes(detailRes)
detaileval.evaluate()<jupyter_output>Evaluate annotation type cls
{'category_id': 2, 'name': 'aeroplane', 'ap': 1.0}
{'category_id': 23, 'name': 'bicycle', 'ap': 0.53237909908101999}
{'category_id': 25, 'name': 'bird', 'ap': 0.067996680116887975}
{'category_id': 31, 'name': 'boat', 'ap': 0.043053950463692578}
{'category_id': 34, 'name': 'bottle', 'ap': 0.061904164575358474}
{'category_id': 45, 'name': 'bus', 'ap': 0.046632527524791287}
{'category_id': 59, 'name': 'car', 'ap': 0.10270417895347403}
{'category_id': 65, 'name': 'cat', 'ap': 0.11623565408709849}
{'category_id': 72, 'name': 'chair', 'ap': 0.10793164449217801}
{'category_id': 98, 'name': 'cow', 'ap': 0.030388715944581562}
{'category_id': 397, 'name': 'diningtable', 'ap': 0.056767440231770362}
{'category_id': 113, 'name': 'dog', 'ap': 0.13950492488909666}
{'category_id': 207, 'name': 'horse', 'ap': 0.043407806625990732}
{'category_id': 258, 'name': 'motorbike', 'ap': 0.047173460352343571}
{'category_id': 284, 'name': 'person', 'ap': 0.36780788155087263}
{'categor[...]
{'fraction_non_alphanumeric': 0.18860244233378562, 'fraction_numerical': 0.1456354590682949, 'mean_word_length': 6.276315789473684, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '298182', 'license': 'MIT', 'n_tokens_mistral': 1068, 'n_tokens_neox': 862, 'n_words': 176, 'path': 'PythonAPI/ipynb/detailDemoEvalCls.ipynb', 'repo_name': 'sennnnn/detail-api', 'size': '2211'}