File size: 774 Bytes
d866b52
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import *
import os

from examples import examples as exp_dict

MODEL_DIR = "models"
IMAGE_DIR = "images"

def get_models() -> List[str]:
    """List all model names in MODEL_DIR."""
    model_names = []
    for p in os.listdir(MODEL_DIR):
        if os.path.isdir(os.path.join(MODEL_DIR, p)):
            model_names.append(p)
    return model_names

def populate_examples() -> List[Any]:
    """Populate example inputs into a list."""
    examples = []
    for m in get_models():
        if m in exp_dict:
            for img, thres in exp_dict[m]:
                examples.append([
                    f"{IMAGE_DIR}/{m}/{img}",
                    thres,
                    "CPU",
                    f"{MODEL_DIR}/{m}"
                ])
    return examples