pyanomaly.datatools.abstract package

Submodules

pyanomaly.datatools.abstract.abstract_datasets_builder module

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

class pyanomaly.datatools.abstract.abstract_datasets_builder.AbstractBuilder

Bases: object

abstract build() → torch.utils.data.dataloader.DataLoader

the method to build the dataloader the building process includes three parts:

  1. dataset

  2. sampler

  3. collect_fn

===> dataloader

pyanomaly.datatools.abstract.abstract_datasets_factory module

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

class pyanomaly.datatools.abstract.abstract_datasets_factory.AbstractDatasetFactory(cfg, aug, is_training=True)

Bases: object

class pyanomaly.datatools.abstract.abstract_datasets_factory.GetClusterDataset

Bases: object

class pyanomaly.datatools.abstract.abstract_datasets_factory.GetWDataset

Bases: object

pyanomaly.datatools.abstract.abstract_evaluate_method module

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

class pyanomaly.datatools.abstract.abstract_evaluate_method.AbstractEvalMethod(cfg)

Bases: object

abstract compute(result_file_dict)

Aim to get the final result

abstract eval_method(result, gt)

The actual method to get the eval metrics

abstract load_ground_truth()

Aim to load the gt of dataset.

abstract load_results(result_file)

pyanomaly.datatools.abstract.image_dataset module

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

class pyanomaly.datatools.abstract.image_dataset.AbstractImageDataset(dataset_folder, transforms)

Bases: torch.utils.data.dataset.Dataset

aug_batch_image()

Use the transforms to augment one batch image

aug_image()

Use the transforms to augment one single image

get_image(image_name)

Get one single image

pyanomaly.datatools.abstract.readers module

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

class pyanomaly.datatools.abstract.readers.GroundTruthLoader

Bases: object

Avenue = 'Avenue'
Ped1 = 'Ped1'
Ped2 = 'Ped2'
Shanghai = 'Shanghai'
read(dataset_name, gt_path, data_path)
set_data_path(data_path)
set_gt_path(gt_path)
set_name(dataset_name)
class pyanomaly.datatools.abstract.readers.ImageLoader(read_format='pillow', channel_num=3, channel_name='rgb', params=None, transforms=None, normalize=False, mean=None, std=None, deterministic=False)

Bases: object

read(name, flag='other', array_type='tensor')

name: the absolute path of the image flag: use the torchvision transforms ----> 'torchvision'

use other opensource transforms, like imgaug -----> 'other'

array_type: the return type of the image. 'tensor' | 'ndarray'

class pyanomaly.datatools.abstract.readers.VideoLoader(image_loader, params=None, transforms=None, normalize=False, mean=None, std=None)

Bases: object

read(frames_list, start, end, clip_length=2, step=1, array_type='tensor')

array_type: the output format of the video array. The shape of the video data is [C,D,H,W]

pyanomaly.datatools.abstract.video_dataset module

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

class pyanomaly.datatools.abstract.video_dataset.AbstractVideoDataset(frames_folder, clip_length, sampled_clip_length, frame_step=1, clip_step=1, video_format='mp4', fps=10, transforms=None, is_training=True, one_video=False, mini=False, cfg=None, **kwargs)

Bases: torch.utils.data.dataset.Dataset

abstract_setup()
class pyanomaly.datatools.abstract.video_dataset.FrameLevelVideoDataset(frames_folder, clip_length, sampled_clip_length, frame_step=1, clip_step=1, video_format='.mp4', fps=10, transforms=None, is_training=True, one_video=False, only_frame=True, mini=False, extra=False, cfg=None, **kwargs)

Bases: pyanomaly.datatools.abstract.video_dataset.AbstractVideoDataset

abstract custom_setup()
setup()

Module contents

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