(
self,
file_metas: List[Dict[str, str]],
p_long_prompt: float,
file_backend_cfg: Mapping[str, Any],
out_size: int,
crop_type: str,
use_hflip: bool,
use_rot: bool,
# blur kernel settings of the first degradation stage
blur_kernel_size: int,
kernel_list: Sequence[str],
kernel_prob: Sequence[float],
blur_sigma: Sequence[float],
betag_range: Sequence[float],
betap_range: Sequence[float],
sinc_prob: float,
# blur kernel settings of the second degradation stage
blur_kernel_size2: int,
kernel_list2: Sequence[str],
kernel_prob2: Sequence[float],
blur_sigma2: Sequence[float],
betag_range2: Sequence[float],
betap_range2: Sequence[float],
sinc_prob2: float,
final_sinc_prob: float,
p_empty_prompt: float,
)
| 17 | class RealESRGANDataset(data.Dataset): |
| 18 | |
| 19 | def __init__( |
| 20 | self, |
| 21 | file_metas: List[Dict[str, str]], |
| 22 | p_long_prompt: float, |
| 23 | file_backend_cfg: Mapping[str, Any], |
| 24 | out_size: int, |
| 25 | crop_type: str, |
| 26 | use_hflip: bool, |
| 27 | use_rot: bool, |
| 28 | # blur kernel settings of the first degradation stage |
| 29 | blur_kernel_size: int, |
| 30 | kernel_list: Sequence[str], |
| 31 | kernel_prob: Sequence[float], |
| 32 | blur_sigma: Sequence[float], |
| 33 | betag_range: Sequence[float], |
| 34 | betap_range: Sequence[float], |
| 35 | sinc_prob: float, |
| 36 | # blur kernel settings of the second degradation stage |
| 37 | blur_kernel_size2: int, |
| 38 | kernel_list2: Sequence[str], |
| 39 | kernel_prob2: Sequence[float], |
| 40 | blur_sigma2: Sequence[float], |
| 41 | betag_range2: Sequence[float], |
| 42 | betap_range2: Sequence[float], |
| 43 | sinc_prob2: float, |
| 44 | final_sinc_prob: float, |
| 45 | p_empty_prompt: float, |
| 46 | ) -> "RealESRGANDataset": |
| 47 | super(RealESRGANDataset, self).__init__() |
| 48 | self.file_metas = file_metas |
| 49 | self.image_files = load_file_metas(file_metas) |
| 50 | self.p_long_prompt = p_long_prompt |
| 51 | assert ( |
| 52 | 0 <= p_long_prompt <= 1 |
| 53 | ), f"p_long_prompt {p_long_prompt} should be a probability between [0, 1]" |
| 54 | self.file_backend = instantiate_from_config(file_backend_cfg) |
| 55 | self.out_size = out_size |
| 56 | self.crop_type = crop_type |
| 57 | assert self.crop_type in ["none", "center", "random"] |
| 58 | |
| 59 | self.blur_kernel_size = blur_kernel_size |
| 60 | self.kernel_list = kernel_list |
| 61 | self.kernel_prob = kernel_prob |
| 62 | self.blur_sigma = blur_sigma |
| 63 | self.betag_range = betag_range |
| 64 | self.betap_range = betap_range |
| 65 | self.sinc_prob = sinc_prob |
| 66 | |
| 67 | self.blur_kernel_size2 = blur_kernel_size2 |
| 68 | self.kernel_list2 = kernel_list2 |
| 69 | self.kernel_prob2 = kernel_prob2 |
| 70 | self.blur_sigma2 = blur_sigma2 |
| 71 | self.betag_range2 = betag_range2 |
| 72 | self.betap_range2 = betap_range2 |
| 73 | self.sinc_prob2 = sinc_prob2 |
| 74 | |
| 75 | # a final sinc filter |
| 76 | self.final_sinc_prob = final_sinc_prob |
nothing calls this directly
no test coverage detected