pyanomaly/core/utils.py
def save_score_results(score, cfg, logger, verbose=None, config_name='None', current_step=0, time_stamp='time_step'): 
    """Save scores.
    This method is used to store the normal/abnormal scores of frames which are used for the evaluation functions

    Args:
        score(list): The scores of all of the videos.
        cfg(fvcore.common.config.CfgNode): The configuration object
        logger: The logger object
        verbose: Comments
        config_name(str): The name of the configuration name
        current_step: The current iteration number of the whole training process
        time_stamp: The time string records when the training process starts

    Returns:
        result_paths(list): The list records where the results store. Each item is an individual result. 

    """
    # Smooth  function
    def smooth_value(value, sigma):
        new_value = []
        for index, _ in enumerate(value):
            temp = gaussian_filter1d(value[index], sigma)
            new_value.append(temp)
        return new_value
    
    # if not os.path.exists(cfg.TEST.result_output):
    #     os.mkdir(cfg.TEST.result_output)
    if not os.path.exists(cfg.VAL.result_output):
        os.mkdir(cfg.VAL.result_output)

    # result_path = os.path.join(cfg.TEST.result_output, f'{verbose}_cfg#{config_name}#step{current_step}@{time_stamp}_results.pkl')
    # result_paths = list()
    result_paths = OrderedDict()

    result_perfix_name = f'{verbose}_cfg#{config_name}#step{current_step}@{time_stamp}'
    # result_keys = kwargs.keys()
    result_dict = OrderedDict()
    result_dict['dataset'] = cfg.DATASET.name
    result_dict['num_videos'] = len(score)
    
    if cfg.DATASET.smooth.guassian:
        for sigma in cfg.DATASET.smooth.guassian_sigma:
            new_score = smooth_value(score, sigma)
            result_name = result_perfix_name + f'_sigma{sigma}_results.pkl'
            result_dict['score'] = new_score
            result_path = os.path.join(cfg.VAL.result_output, result_name)
            # result_dict[f'score_smooth_{sigma}'] = new_score
            with open(result_path, 'wb') as writer:
                pickle.dump(result_dict, writer, pickle.HIGHEST_PROTOCOL)
            # result_paths.append(result_path) 
            result_paths[f'sigma_{sigma}'] = result_path       
            logger.info(f'Smooth the value with sigma:{sigma}')
    else:
        result_name = result_perfix_name + f'_sigmaNone_results.pkl'
        result_path = os.path.join(cfg.VAL.result_output, result_name)
        result_paths['sigma_None'] = result_path
        # result_paths.append(result_path)
        logger.info(f'Smooth the value with sigma: None')
        
    return result_paths
Save scores.
    This method is used to store the normal/abnormal scores of frames which are used for the evaluation functions

    Args:
        score(list): The scores of all of the videos.
        cfg(fvcore.common.config.CfgNode): The configuration object
        logger: The logger object
        verbose: Comments
        config_name(str): The name of the configuration name
        current_step: The current iteration number of the whole training process
        time_stamp: The time string records when the training process starts

    Returns:
        result_paths(list): The list records where the results store. Each item is an individual result. 

    
Save scores.
This method is used to store the normal/abnormal scores of frames which are used for the evaluation functions
Save scores . This method is used to store the normal / abnormal scores of frames which are used for the evaluation functions
def save_score_results(score, cfg, logger, verbose=None, config_name='None', current_step=0, time_stamp='time_step'): 
    def smooth_value(value, sigma):
        new_value = []
        for index, _ in enumerate(value):
            temp = gaussian_filter1d(value[index], sigma)
            new_value.append(temp)
        return new_value
    if not os.path.exists(cfg.VAL.result_output):
        os.mkdir(cfg.VAL.result_output)
    result_paths = OrderedDict()
    result_perfix_name = f'{verbose}_cfg#{config_name}#step{current_step}@{time_stamp}'
    result_dict = OrderedDict()
    result_dict['dataset'] = cfg.DATASET.name
    result_dict['num_videos'] = len(score)
    if cfg.DATASET.smooth.guassian:
        for sigma in cfg.DATASET.smooth.guassian_sigma:
            new_score = smooth_value(score, sigma)
            result_name = result_perfix_name + f'_sigma{sigma}_results.pkl'
            result_dict['score'] = new_score
            result_path = os.path.join(cfg.VAL.result_output, result_name)
            with open(result_path, 'wb') as writer:
                pickle.dump(result_dict, writer, pickle.HIGHEST_PROTOCOL)
            result_paths[f'sigma_{sigma}'] = result_path       
            logger.info(f'Smooth the value with sigma:{sigma}')
    else:
        result_name = result_perfix_name + f'_sigmaNone_results.pkl'
        result_path = os.path.join(cfg.VAL.result_output, result_name)
        result_paths['sigma_None'] = result_path
        logger.info(f'Smooth the value with sigma: None')
    return result_paths
def save_score_results ( score , cfg , logger , verbose = None , config_name = 'None' , current_step = 0 , time_stamp = 'time_step' ) : def smooth_value ( value , sigma ) : new_value = [ ] for index , _ in enumerate ( value ) : temp = gaussian_filter1d ( value [ index ] , sigma ) new_value . append ( temp ) return new_value if not os . path . exists ( cfg . VAL . result_output ) : os . mkdir ( cfg . VAL . result_output ) result_paths = OrderedDict ( ) result_perfix_name = f'{verbose}_cfg#{config_name}#step{current_step}@{time_stamp}' result_dict = OrderedDict ( ) result_dict [ 'dataset' ] = cfg . DATASET . name result_dict [ 'num_videos' ] = len ( score ) if cfg . DATASET . smooth . guassian : for sigma in cfg . DATASET . smooth . guassian_sigma : new_score = smooth_value ( score , sigma ) result_name = result_perfix_name + f'_sigma{sigma}_results.pkl' result_dict [ 'score' ] = new_score result_path = os . path . join ( cfg . VAL . result_output , result_name ) with open ( result_path , 'wb' ) as writer : pickle . dump ( result_dict , writer , pickle . HIGHEST_PROTOCOL ) result_paths [ f'sigma_{sigma}' ] = result_path logger . info ( f'Smooth the value with sigma:{sigma}' ) else : result_name = result_perfix_name + f'_sigmaNone_results.pkl' result_path = os . path . join ( cfg . VAL . result_output , result_name ) result_paths [ 'sigma_None' ] = result_path logger . info ( f'Smooth the value with sigma: None' ) return result_paths
Save scores.
Save scores .
"""Save scores.
    This method is used to store the normal/abnormal scores of frames which are used for the evaluation functions

    Args:
        score(list): The scores of all of the videos.
        cfg(fvcore.common.config.CfgNode): The configuration object
        logger: The logger object
        verbose: Comments
        config_name(str): The name of the configuration name
        current_step: The current iteration number of the whole training process
        time_stamp: The time string records when the training process starts

    Returns:
        result_paths(list): The list records where the results store. Each item is an individual result. 

    """ # Smooth  function
 # if not os.path.exists(cfg.TEST.result_output):
 #     os.mkdir(cfg.TEST.result_output)
 # result_path = os.path.join(cfg.TEST.result_output, f'{verbose}_cfg#{config_name}#step{current_step}@{time_stamp}_results.pkl')
 # result_paths = list()
 # result_keys = kwargs.keys()
 # result_dict[f'score_smooth_{sigma}'] = new_score
 # result_paths.append(result_path) 
 # result_paths.append(result_path)

The list records where the results store. Each item is an individual result.
The list records where the results store . Each item is an individual result .
result_paths(list)
score
The scores of all of the videos.
The scores of all of the videos .
cfg
The configuration object
The configuration object
logger
The logger object
The logger object
verbose
None
config_name
The name of the configuration name
The name of the configuration name
current_step
The current iteration number of the whole training process
The current iteration number of the whole training process
time_stamp
The time string records when the training process starts
The time string records when the training process starts