PaddleClas/deploy/python/ppshitu_v2/engine/pop_engine.py

19 lines
545 B
Python
Raw Normal View History

2022-03-11 20:26:57 +08:00
import importlib
2022-03-10 22:20:15 +08:00
from processor.algo_mod import AlgoMod
2022-03-08 20:52:47 +08:00
class POPEngine:
def __init__(self, config):
2022-03-10 22:20:15 +08:00
self.algo_list = []
2022-03-11 20:26:57 +08:00
current_mod = importlib.import_module(__name__)
for mod_config in config["Modules"]:
mod_type = mod_config.get("type")
mod = getattr(current_mod, mod_type)(mod_config)
self.algo_list.append(mod)
2022-03-08 20:52:47 +08:00
2022-03-11 20:26:57 +08:00
def process(self, input_data):
2022-03-10 22:20:15 +08:00
for algo_module in self.algo_list:
2022-03-11 20:26:57 +08:00
input_data = algo_module.process(input_data)
return input_data