src package

Submodules

src.Imagenet_c_transformations module

src.Imagenet_c_transformations.brightness(x, i)
src.Imagenet_c_transformations.contrast(x, i)
src.Imagenet_c_transformations.defocus_blur(x, i)
src.Imagenet_c_transformations.disk(radius, alias_blur=0.1, dtype=<class 'numpy.float32'>)
src.Imagenet_c_transformations.frost(x, i)
src.Imagenet_c_transformations.gaussian_noise(x, i)
src.Imagenet_c_transformations.jpeg_compression(x, i) <module 'PIL.Image' from '/Users/caroline/anaconda3/envs/IQA_3.7/lib/python3.7/site-packages/PIL/Image.py'>
src.Imagenet_c_transformations.save_array(dest, arr)

src.bootstrap module

class src.bootstrap.Bootstrapper(num_sample_iter: int, sample_size: int, source: Union[str, Path], destination: Union[str, Path], dataset_info: DatasetInfo, transformation_type: str, threshold: float)

Bases: ABC

static check_output(self, bootstrap_df: DataFrame)
run()
src.bootstrap.bootstrap(images_info_df: DataFrame, num_sample_iter: int, sample_size: int, transformation_type: str, threshold: float, bootstrap_path) DataFrame

Run bootstrap and make the transformation decisions. Input dataset info dataframe should contain the following columns: - id - filename - path - width - height

Output dataframe contains the following columns: - iteration_id - within_iter_id - image_id - transformation_type - transformation_parameter - original_image_path - target_image_path - vd_score

Parameters
  • images_info_df (pd.DataFrame) – DataFrame containing image info, contains columns: id, filename, path, width, height

  • num_sample_iter (int) – number of bootstrap iteration

  • sample_size (str) – number of images sampled for each bootstrap iteration

  • transformation_type – transformation type

  • threshold

:type threshold float :param matlab_engine :return: bootstrap info dataframe :rtype: pd.DataFrame

src.bootstrap.bootstrap_transform(original_image: Union[ImageFile, ndarray], transformation: str) Tuple[ndarray, int]

src.constant module

src.dataset module

class src.dataset.CustomPascalVOCDataset(root: str, orig_root: str, year: str = '2012', image_set: str = 'train', download: bool = False, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, transforms: Optional[Callable] = None)

Bases: Dataset

class src.dataset.DatasetInfo

Bases: ABC

abstract image_info_df() DataFrame

Should have columns - id - filename - path - width - height

Raises

NotImplementedError – [description]

Returns

pandas DataFrame with very basic image info data

Return type

pd.DataFrame

class src.dataset.PascalVOCDatasetInfo(root: Path, image_set: str = 'val')

Bases: DatasetInfo

image_info_df() DataFrame
Returns

image info dataframe

Return type

pd.DataFrame

verify_root_validity() bool

whether the image_root and annotation_root used to initialize this dataset info object is valid, or compatible image files is what we look at, and annotation files can be a super set of image files :return: is valid

src.utils module

src.utils.clear_dir(path: Union[str, Path])
src.utils.get_image_based_on_transformation(transformation: str, image_path: str) Union[ImageFile, ndarray]

Module contents