# /*--------------------------------------------------------------------------------------------- # * Copyright (c) 2022 STMicroelectronics. # * All rights reserved. # * This software is licensed under terms that can be found in the LICENSE file in # * the root directory of this software component. # * If no LICENSE file comes with this software, it is provided AS-IS. # *--------------------------------------------------------------------------------------------*/ import logging import os import sys import warnings import hydra import mlflow from hydra.core.hydra_config import HydraConfig from omegaconf import DictConfig, OmegaConf from temp_scripts.tmp import stm32ai_deploy warnings.filterwarnings("ignore") os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorflow as tf logger = tf.get_logger() logger.setLevel(logging.ERROR) sys.path.append(os.path.abspath('../evaluate')) sys.path.append(os.path.abspath('../utils')) sys.path.append(os.path.abspath('../utils/models')) sys.path.append(os.path.abspath('../../../common')) from evaluate import evaluate_model from utils import get_config, mlflow_ini, setup_seed @hydra.main(version_base=None, config_path="", config_name="user_config") def main(cfg: DictConfig) -> None: # Initilize configuration & mlflow configs = get_config(cfg) mlflow_ini(configs) # Set all seeds setup_seed(42) # Evaluate model performance / footprints evaluate_model(cfg, c_header=True, c_code=True) stm32ai_deploy(cfg, debug=False) # Record the whole hydra working directory to get all infos mlflow.log_artifact(HydraConfig.get().runtime.output_dir) mlflow.end_run() if __name__ == "__main__": main()