pyanomaly.core package

Subpackages

Submodules

pyanomaly.core.utils module

@author: Yuhao Cheng @contact: yuhao.cheng[at]outlook.com

class pyanomaly.core.utils.AverageMeter(name='default')

Bases: object

Computes and store the average the current value

get_name()
update(val, n=1)
class pyanomaly.core.utils.ParamSet(name='default', **kwargs)

Bases: object

A set of a group of params with samiliar meaning

get_name()
get_params_names()
pyanomaly.core.utils.flow_batch_estimate(flow_model, tensor_batch, normalize, output_format='xym', optical_size=None, output_size=None)
output_format:

general: u,v xym: u,v,mag hsv: rgb:

pyanomaly.core.utils.frame_gradient(x)

The input is a video clip and get the gradient on the image Args:

x: the video with bs. [bs, d, 1, h, w]

Returns:

dx: [bs, d, 1, h, w] the gradient on x-axis dy: [bs, d, 1, h, w] the gradient on y-axis

pyanomaly.core.utils.get_batch_dets(det_model, batch_image)

Use the detecron2

pyanomaly.core.utils.grid_crop(bottom, bbox, object_size=(64, 64))

[ x2-x1 x1 + x2 - W + 1 ] [ ----- 0 --------------- ] [ W - 1 W - 1 ] [ ] [ y2-y1 y1 + y2 - H + 1 ] [ 0 ----- --------------- ] [ H - 1 H - 1 ]

pyanomaly.core.utils.image_gradient(image)
Args:

x: the image with bs. [bs,c,h,w]

Returns:

dx: [bs,c,h,w] the gradient on x-axis dy: [bs,c,h,w] the gradient on y-axis

pyanomaly.core.utils.make_info_message(current_step, max_step, model_type, batch_time, batch_size, data_time, loss_list)
pyanomaly.core.utils.modeldist(model)

To make the model in dist

pyanomaly.core.utils.modelparallel(model)

To make the model parallel

pyanomaly.core.utils.multi_obj_grid_crop(bottom, bbox, object_size=(64, 64))

[ x2-x1 x1 + x2 - W + 1 ] [ ----- 0 --------------- ] [ W - 1 W - 1 ] [ ] [ y2-y1 y1 + y2 - H + 1 ] [ 0 ----- --------------- ] [ H - 1 H - 1 ]

pyanomaly.core.utils.save_score_results(score, cfg, logger, verbose=None, config_name='None', current_step=0, time_stamp='time_step')

This method is used to store the normal/abnormal scores which are used for the evaluation functions The

pyanomaly.core.utils.tensorboard_vis_images(vis_objects, writer, global_step, normalize)

Visualize the images in tensorboard Args:

vis_objects: the dict of visualized images.{'name1':iamge, ...} writer: tensorboard global_step: the step normalize: {'use':..., 'mean':..., 'std':...}

pyanomaly.core.utils.tsne_vis(feature, feature_labels, vis_path)
pyanomaly.core.utils.vis_optical_flow(batch_optical, output_format, output_size, normalize)

Module contents

@author: Yuhao Cheng @contact: yuhao.cheng[at]outlook.com