demo.py
def main(args, cfg, logger, cfg_name, time_stamp, is_training):
    """Main function to execute the training or inference process.

    The function indicates the corret order to use the APIs. If you want to use these API, please follow the order shown in this function.

    Args:
        args: The arguments from the command line.
        cfg: The configuration object.
        logger: The logger object to print the log information in the files and screen.
        writer_dict: The tensorboard writer dictionary. 
        cfg_name: The configuration file's name.
        time_stamp: The time string is when the main process starts.
        log_file_nam: The name of the log file.
        is_training: Indicate whether the process is training or not
    
    Returns:
        None

    """
    video_path = ''

    # the system setting
    parallel_flag = system_setup(args, cfg)
    
    # get the model structure
    ma = ModelAPI(cfg)
    model_dict = ma()

    # get the evaluate function
    ea = EvaluateAPI(cfg, is_training)
    evaluate_function = ea()

    # # Build hook
    ha = HookAPI(cfg)
    hooks = ha(is_training)

    # Get the engine
    engine_api = EngineAPI(cfg, is_training)
    engine = engine_api.build()
    service = engine(model_dict=model_dict, config=cfg, parallel=parallel_flag, 
                     verbose=args.verbose, time_stamp=time_stamp, model_type=cfg.MODEL.name, config_name=cfg_name,
                     hooks=hooks, evaluate_function=evaluate_function
                    )
    logger.info('Finish initializing the model')
    
    video, video_info = torchvision.io.read_video(video_path)
    # import ipdb; ipdb.set_trace()
    result_dict = service.execute(video)
    
    # model_result_path = trainer.result_path

    # logger.info(f'The model path is {model_result_path}')
    logger.info('Finish Using the anomaly detection service')
Main function to execute the training or inference process.

    The function indicates the corret order to use the APIs. If you want to use these API, please follow the order shown in this function.

    Args:
        args: The arguments from the command line.
        cfg: The configuration object.
        logger: The logger object to print the log information in the files and screen.
        writer_dict: The tensorboard writer dictionary. 
        cfg_name: The configuration file's name.
        time_stamp: The time string is when the main process starts.
        log_file_nam: The name of the log file.
        is_training: Indicate whether the process is training or not
    
    Returns:
        None

    
Main function to execute the training or inference process.
The function indicates the corret order to use the APIs. If you want to use these API, please follow the order shown in this function.
Main function to execute the training or inference process . The function indicates the corret order to use the APIs . If you want to use these API please follow the order shown in this function .
def main(args, cfg, logger, cfg_name, time_stamp, is_training):
    video_path = ''
    parallel_flag = system_setup(args, cfg)
    ma = ModelAPI(cfg)
    model_dict = ma()
    ea = EvaluateAPI(cfg, is_training)
    evaluate_function = ea()
    ha = HookAPI(cfg)
    hooks = ha(is_training)
    engine_api = EngineAPI(cfg, is_training)
    engine = engine_api.build()
    service = engine(model_dict=model_dict, config=cfg, parallel=parallel_flag, 
                     verbose=args.verbose, time_stamp=time_stamp, model_type=cfg.MODEL.name, config_name=cfg_name,
                     hooks=hooks, evaluate_function=evaluate_function
                    )
    logger.info('Finish initializing the model')
    video, video_info = torchvision.io.read_video(video_path)
    result_dict = service.execute(video)
    logger.info('Finish Using the anomaly detection service')
def main ( args , cfg , logger , cfg_name , time_stamp , is_training ) : video_path = '' parallel_flag = system_setup ( args , cfg ) ma = ModelAPI ( cfg ) model_dict = ma ( ) ea = EvaluateAPI ( cfg , is_training ) evaluate_function = ea ( ) ha = HookAPI ( cfg ) hooks = ha ( is_training ) engine_api = EngineAPI ( cfg , is_training ) engine = engine_api . build ( ) service = engine ( model_dict = model_dict , config = cfg , parallel = parallel_flag , verbose = args . verbose , time_stamp = time_stamp , model_type = cfg . MODEL . name , config_name = cfg_name , hooks = hooks , evaluate_function = evaluate_function ) logger . info ( 'Finish initializing the model' ) video , video_info = torchvision . io . read_video ( video_path ) result_dict = service . execute ( video ) logger . info ( 'Finish Using the anomaly detection service' )
Main function to execute the training or inference process.
Main function to execute the training or inference process .
"""Main function to execute the training or inference process.

    The function indicates the corret order to use the APIs. If you want to use these API, please follow the order shown in this function.

    Args:
        args: The arguments from the command line.
        cfg: The configuration object.
        logger: The logger object to print the log information in the files and screen.
        writer_dict: The tensorboard writer dictionary. 
        cfg_name: The configuration file's name.
        time_stamp: The time string is when the main process starts.
        log_file_nam: The name of the log file.
        is_training: Indicate whether the process is training or not
    
    Returns:
        None

    """ # the system setting
 # get the model structure
 # get the evaluate function
 # # Build hook
 # Get the engine
 # import ipdb; ipdb.set_trace()
 # model_result_path = trainer.result_path
 # logger.info(f'The model path is {model_result_path}')

None
args
The arguments from the command line.
The arguments from the command line .
cfg
The configuration object.
The configuration object .
logger
The logger object to print the log information in the files and screen.
The logger object to print the log information in the files and screen .
cfg_name
The configuration file's name.
The configuration file ' s name .
time_stamp
The time string is when the main process starts.
The time string is when the main process starts .
is_training
Indicate whether the process is training or not
Indicate whether the process is training or not
writer_dict
The tensorboard writer dictionary.
The tensorboard writer dictionary .
log_file_nam
The name of the log file.
The name of the log file .