predict.py 808 字节
Newer Older
G
gaotingquan 已提交
1 2 3 4 5 6 7 8 9 10
import os
import sys
__dir__ = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.abspath(os.path.join(__dir__, '../')))

import cv2

from engine import build_engine
from utils import config
from utils.get_image_list import get_image_list
W
weishengyu 已提交
11 12 13 14 15 16 17 18 19


def main():
    args = config.parse_args()
    config_dict = config.get_config(
        args.config, overrides=args.override, show=False)
    config_dict.profiler_options = args.profiler_options
    engine = build_engine(config_dict)

G
gaotingquan 已提交
20 21 22 23 24 25 26
    image_list = get_image_list(config_dict["Global"]["infer_imgs"])
    for idx, image_file in enumerate(image_list):
        img = cv2.imread(image_file)[:, :, ::-1]
        input_data = {"input_image": img}
        output = engine.process(input_data)
        print(output)

W
weishengyu 已提交
27 28 29

if __name__ == '__main__':
    main()