pyanomaly.utils package

Submodules

pyanomaly.utils.recorders module

pyanomaly.utils.recorders.create_logger(root_path, cfg, cfg_name, phase='trian', verbose='None')

Create the root logger. The rest of log file is using the same time as this time Args:

root_path: Path object, the root path of the project cfg: the config class of the whole process cfg_name: the name of the config file(yaml file) phase: the flag indicate the stage, trian, val or test verbose: some note

Returns:

logger: the logger instance final_output_dir: the dir of final output to store the results, such as the accuracy, the images or some thing tensorboard_log_dir: cfg_name time_str

pyanomaly.utils.recorders.get_tensorboard(tensorboard_log_dir, time_stamp, model_name, final_log_file_name)

Get the tensorboard writer of Args:

tensorboard_log_dir: the root of the tensorboard time_stamp: the time when the training start model_name: the model type

pyanomaly.utils.system module

This file is to set up the setting about the system, torch, CUDA, cudnn and so on based on the xxx.yaml

pyanomaly.utils.system.parse_args()
pyanomaly.utils.system.system_setup(args, cfg)

pyanomaly.utils.tools module

class pyanomaly.utils.tools.Statistic(model=None, mode='cuda', input_size=None, test_iters=3)

Bases: object

pyanomaly.utils.tools.compute_color(u, v)

compute optical flow color map :param u: horizontal optical flow :param v: vertical optical flow :return:

class pyanomaly.utils.tools.data_prefetcher(loader)

Bases: object

next()
preload()
pyanomaly.utils.tools.flow2Y(flow_data)

convert optical flow into color image :param flow_data: :return: color image

pyanomaly.utils.tools.flow2img(flow_data, output_format)

Make the flow to 3 channel

pyanomaly.utils.tools.make_color_wheel()

Generate color wheel according Middlebury color code :return: Color wheel

pyanomaly.utils.tools.readFlow(fn)

Read .flo file in Middlebury format

pyanomaly.utils.tools.writeFlow(filename, uv, v=None)

Write optical flow to file.

If v is None, uv is assumed to contain both u and v channels, stacked in depth. Original code by Deqing Sun, adapted from Daniel Scharstein.

Module contents