SYMBOL INDEX (2540 symbols across 186 files) FILE: MangaStudio_Data/app/core/config_loader.py class ConfigLoader (line 8) | class ConfigLoader: method __init__ (line 9) | def __init__(self, project_base_dir): method _find_python_executable (line 25) | def _find_python_executable(self): method _load_backend_schema (line 34) | def _load_backend_schema(self): method _parse_schema_output (line 58) | def _parse_schema_output(self, stdout): method _strip_ansi (line 73) | def _strip_ansi(self, text): method _load_ui_map (line 77) | def _load_ui_map(self): method _load_tasks_config (line 86) | def _load_tasks_config(self): method _get_definition_from_ref (line 100) | def _get_definition_from_ref(self, ref_path): method _parse_factory_defaults (line 110) | def _parse_factory_defaults(self): method _build_full_config_data (line 126) | def _build_full_config_data(self): method get_tasks_config (line 166) | def get_tasks_config(self): method get_factory_defaults (line 170) | def get_factory_defaults(self): method get_tab_order (line 173) | def get_tab_order(self): FILE: MangaStudio_Data/app/core/pipeline.py class Pipeline (line 13) | class Pipeline: method __init__ (line 16) | def __init__(self, app, python_executable, temp_dir): method run (line 25) | def run(self, job, output_path, config_dict, log_callback, is_verbose=... method run_single_image_test (line 72) | def run_single_image_test(self, test_image_path, output_path, config_d... method _execute_subprocess (line 118) | def _execute_subprocess(self, log_callback, command): method stop (line 168) | def stop(self, log_callback): method _cleanup_memory (line 182) | def _cleanup_memory(self, log_callback): FILE: MangaStudio_Data/app/ui/main_window.py class DynamicHeightListWidget (line 41) | class DynamicHeightListWidget(QListWidget): method __init__ (line 49) | def __init__(self, parent=None): method minimumSizeHint (line 53) | def minimumSizeHint(self) -> QSize: method sizeHint (line 58) | def sizeHint(self) -> QSize: method wheelEvent (line 63) | def wheelEvent(self, event: QEvent): method _get_content_height (line 67) | def _get_content_height(self) -> int: class NoScrollComboBox (line 83) | class NoScrollComboBox(QComboBox): method wheelEvent (line 86) | def wheelEvent(self, event: QEvent): class TranslatorStudioApp (line 91) | class TranslatorStudioApp(QMainWindow): method __init__ (line 96) | def __init__(self): method _initialize_app (line 142) | def _initialize_app(self): method _create_main_layout (line 153) | def _create_main_layout(self): method _create_left_panel (line 178) | def _create_left_panel(self) -> QWidget: method _create_right_panel (line 266) | def _create_right_panel(self) -> QWidget: method _create_settings_tab_container (line 292) | def _create_settings_tab_container(self) -> QWidget: method _create_visual_compare_tab (line 325) | def _create_visual_compare_tab(self) -> QWidget: method _build_dynamic_tab_content (line 403) | def _build_dynamic_tab_content(self, tab_name: str, settings_list: lis... method _build_tasks_tab_content (line 491) | def _build_tasks_tab_content(self) -> QWidget: method _create_setting_row (line 614) | def _create_setting_row(self, info: dict, context_key: str = None) -> ... method _create_segmented_button (line 717) | def _create_segmented_button(self, info: dict) -> QWidget: method _create_combobox (line 738) | def _create_combobox(self, info: dict) -> QComboBox: method _create_checkbox (line 759) | def _create_checkbox(self, info: dict) -> QCheckBox: method _create_slider (line 767) | def _create_slider(self, info: dict) -> QWidget: method _create_entry (line 829) | def _create_entry(self, info: dict) -> QLineEdit: method _create_language_checkbox_grid (line 842) | def _create_language_checkbox_grid(self, info: dict) -> QWidget: method _create_font_combobox (line 875) | def _create_font_combobox(self, info: dict) -> QComboBox: method _create_entry_with_button (line 890) | def _create_entry_with_button(self, info: dict) -> QWidget: method _create_translator_chain_builder (line 908) | def _create_translator_chain_builder(self, info: dict) -> QWidget: method _create_chain_step_widget (line 956) | def _create_chain_step_widget(self) -> QWidget: method _add_chain_step (line 995) | def _add_chain_step(self): method _remove_chain_step (line 1007) | def _remove_chain_step(self): method _get_translator_chain_string (line 1018) | def _get_translator_chain_string(self) -> str: method _rebuild_chain_from_string (line 1043) | def _rebuild_chain_from_string(self, chain_string: str): method _create_grid_segmented_button (line 1072) | def _create_grid_segmented_button(self, info: dict) -> QWidget: method _create_preset_manager (line 1102) | def _create_preset_manager(self, info: dict) -> QWidget: method _get_font_list (line 1140) | def _get_font_list(self) -> list: method _update_chain_ui_state (line 1156) | def _update_chain_ui_state(self): method _update_chain_list_height (line 1186) | def _update_chain_list_height(self): method _update_translator_tooltip (line 1208) | def _update_translator_tooltip(self, translator_name: str): method _handle_widget_button_click (line 1235) | def _handle_widget_button_click(self, key: str, associated_widget: QWi... method _refresh_profile_list (line 1273) | def _refresh_profile_list(self): method _save_profile (line 1287) | def _save_profile(self): method _load_profile (line 1316) | def _load_profile(self): method _delete_profile (line 1364) | def _delete_profile(self): method _create_bottom_panel (line 1387) | def _create_bottom_panel(self) -> QWidget: method _create_font_scale_widget (line 1425) | def _create_font_scale_widget(self) -> QWidget: method _on_font_scale_changed (line 1446) | def _on_font_scale_changed(self, text: str): method _connect_widget_signal (line 1458) | def _connect_widget_signal(self, key: str, widget: QWidget, context_ke... method _on_setting_changed (line 1511) | def _on_setting_changed(self, key: str, context_key: str = None): method _on_translator_changed (line 1529) | def _on_translator_changed(self, translator_name: str): method _filter_language_dropdown (line 1538) | def _filter_language_dropdown(self, translator_name: str, lang_combo: ... method _get_value_from_widget (line 1577) | def _get_value_from_widget(self, key: str, widget: QWidget) -> any: method _set_widget_value (line 1634) | def _set_widget_value(self, key: str, value: any, widget: QWidget): method _add_job (line 1696) | def _add_job(self): method _add_job_from_path (line 1708) | def _add_job_from_path(self, path): method dragEnterEvent (line 1742) | def dragEnterEvent(self, event): method dragMoveEvent (line 1748) | def dragMoveEvent(self, event): method dropEvent (line 1754) | def dropEvent(self, event): method _remove_selected_jobs_from_queue (line 1766) | def _remove_selected_jobs_from_queue(self): method _duplicate_selected_jobs (line 1774) | def _duplicate_selected_jobs(self): method _clear_queue (line 1808) | def _clear_queue(self): method _clear_history (line 1823) | def _clear_history(self): method _move_job (line 1838) | def _move_job(self, direction: str): method _update_job_list_ui (line 1861) | def _update_job_list_ui(self): method _update_history_list_ui (line 1889) | def _update_history_list_ui(self): method _on_job_selection_changed (line 1923) | def _on_job_selection_changed(self): method _populate_settings_panel (line 1938) | def _populate_settings_panel(self): method _get_selected_job_index (line 1990) | def _get_selected_job_index(self) -> int | None: method _load_test_image (line 1999) | def _load_test_image(self): method _fit_image_to_view (line 2031) | def _fit_image_to_view(self): method _wheel_event_zoom (line 2040) | def _wheel_event_zoom(self, event): method _update_zoom_label (line 2079) | def _update_zoom_label(self): method _run_visual_test_thread (line 2085) | def _run_visual_test_thread(self): method _run_visual_test (line 2099) | def _run_visual_test(self): method _display_test_result (line 2163) | def _display_test_result(self, image_path: str): method _on_visual_test_finished (line 2182) | def _on_visual_test_finished(self): method _create_log_tab (line 2187) | def _create_log_tab(self) -> QWidget: method log (line 2210) | def log(self, level: str, message: str): method _insert_log_text (line 2237) | def _insert_log_text(self, color: str, message: str): method _clear_log (line 2245) | def _clear_log(self): method _start_pipeline_thread (line 2249) | def _start_pipeline_thread(self): method _update_colorize_restore_ui_state (line 2263) | def _update_colorize_restore_ui_state(self): method _build_final_config_for_job (line 2274) | def _build_final_config_for_job(self, job: dict) -> dict: method _run_pipeline (line 2341) | def _run_pipeline(self): method _stop_pipeline (line 2481) | def _stop_pipeline(self): method _toggle_ui_state (line 2494) | def _toggle_ui_state(self, is_running: bool, running_job_id: str = None): method _set_settings_panel_enabled (line 2518) | def _set_settings_panel_enabled(self, is_enabled: bool): method _update_progress (line 2529) | def _update_progress(self, percent: float, text: str): method _reset_task_settings (line 2534) | def _reset_task_settings(self, task_key: str): method _assign_task_to_selection (line 2556) | def _assign_task_to_selection(self, task_key: str): method _on_pipeline_finished (line 2625) | def _on_pipeline_finished(self): method closeEvent (line 2637) | def closeEvent(self, event): method _load_app_state (line 2653) | def _load_app_state(self): method _save_app_state (line 2672) | def _save_app_state(self): method _create_theme_manager_widget (line 2689) | def _create_theme_manager_widget(self) -> QWidget: method _load_themes (line 2727) | def _load_themes(self): method _apply_theme (line 2753) | def _apply_theme(self, theme_name: str): method _show_queue_context_menu (line 2916) | def _show_queue_context_menu(self, position): method _apply_settings_to_selection (line 2947) | def _apply_settings_to_selection(self): method _remove_selected_jobs_from_queue (line 2965) | def _remove_selected_jobs_from_queue(self): method _save_settings_to_job (line 2984) | def _save_settings_to_job(self): method _load_settings_from_job (line 3006) | def _load_settings_from_job(self): method _create_api_manager_widget (line 3022) | def _create_api_manager_widget(self, info: dict) -> QWidget: method _handle_create_env_file (line 3039) | def _handle_create_env_file(self): method _requeue_job (line 3102) | def _requeue_job(self): method _show_history_context_menu (line 3130) | def _show_history_context_menu(self, position): method _build_font_map (line 3145) | def _build_font_map(self): method _create_font_combobox (line 3160) | def _create_font_combobox(self, info: dict) -> QComboBox: FILE: devscripts/make_readme.py function take_section (line 36) | def take_section(text, start=None, end=None, *, shift=0): function apply_patch (line 43) | def apply_patch(text, patch): FILE: devscripts/utils.py function read_file (line 8) | def read_file(fname): function write_file (line 13) | def write_file(fname, content, mode='w'): function get_filename_args (line 18) | def get_filename_args(has_infile=False, default_outfile=None): function compose_functions (line 31) | def compose_functions(*functions): function run_process (line 35) | def run_process(*args, **kwargs): FILE: docker_prepare.py function download (line 17) | async def download(dict): function main (line 32) | async def main(): FILE: examples/response.cpp type Color (line 9) | struct Color { type Translation (line 14) | struct Translation { type TranslationResponse (line 27) | struct TranslationResponse { function read_u32 (line 31) | uint32_t read_u32(const std::vector& bytes, size_t& offset) { function read_f32 (line 39) | float read_f32(const std::vector& bytes, size_t& offset) { function read_u8 (line 47) | uint8_t read_u8(const std::vector& bytes, size_t& offset) { function read_bool (line 53) | bool read_bool(const std::vector& bytes, size_t& offset) { function read_chunk (line 59) | std::vector read_chunk(const std::vector& bytes, size_... function read_str (line 66) | std::string read_str(const std::vector& bytes, size_t& offset) { function read_map (line 72) | std::unordered_map read_map(const std::vector<... function Translation (line 83) | Translation from_bytes(const std::vector& bytes, size_t& offset) { function TranslationResponse (line 101) | TranslationResponse from_bytes_response(const std::vector& byte... function main (line 112) | int main() { FILE: examples/response.rs type Color (line 2) | struct Color { type Translation (line 8) | struct Translation { method from_bytes (line 43) | fn from_bytes(bytes: &[u8], offset: &mut usize) -> Self { type TranslationResponse (line 22) | struct TranslationResponse { method from_bytes (line 27) | fn from_bytes(bytes: &[u8]) -> Self { function read_u32 (line 36) | fn read_u32(bytes: &[u8], offset: &mut usize) -> u32 { FILE: front/app/components/Header.tsx type Props (line 4) | type Props = {}; FILE: front/app/components/ImageHandlingArea.tsx type ImageHandlingAreaProps (line 6) | interface ImageHandlingAreaProps { FILE: front/app/components/ImageQueue.tsx type ImageQueueProps (line 6) | interface ImageQueueProps { FILE: front/app/components/LabeledInput.tsx type LabeledInputProps (line 4) | type LabeledInputProps = { FILE: front/app/components/LabeledSelect.tsx type LabeledSelectOption (line 4) | type LabeledSelectOption = { type LabeledSelectProps (line 9) | type LabeledSelectProps = { FILE: front/app/components/OptionsPanel.tsx type Props (line 15) | type Props = { FILE: front/app/components/ResultGallery.tsx type ResultGalleryProps (line 5) | interface ResultGalleryProps { FILE: front/app/root.tsx function Layout (line 26) | function Layout({ children }: { children: React.ReactNode }) { function App (line 44) | function App() { function ErrorBoundary (line 48) | function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { FILE: front/app/routes/home.tsx function meta (line 4) | function meta({}: Route.MetaArgs) { function Home (line 11) | function Home() { FILE: front/app/types.ts type StatusKey (line 1) | type StatusKey = type ChunkProcessingResult (line 21) | interface ChunkProcessingResult { type TranslatorKey (line 38) | type TranslatorKey = type FileStatus (line 89) | interface FileStatus { type QueuedImage (line 98) | interface QueuedImage { type TranslationSettings (line 107) | interface TranslationSettings { type FinishedImage (line 120) | interface FinishedImage { FILE: front/app/utils/getTranslatorName.ts function getTranslatorName (line 3) | function getTranslatorName(key: TranslatorKey): string { FILE: front/app/utils/localStorage.ts constant SETTINGS_KEY (line 3) | const SETTINGS_KEY = 'manga-translator-settings'; constant FINISHED_IMAGES_KEY (line 4) | const FINISHED_IMAGES_KEY = 'manga-translator-finished-images'; FILE: manga_translator/__main__.py function dispatch (line 23) | async def dispatch(args: Namespace): FILE: manga_translator/args.py function url_decode (line 13) | def url_decode(s): function path (line 20) | def path(string): function file_path (line 28) | def file_path(string): function dir_path (line 36) | def dir_path(string): class HelpFormatter (line 54) | class HelpFormatter(argparse.HelpFormatter): method __init__ (line 59) | def __init__(self, prog: str, indent_increment: int = 2, max_help_posi... method _format_action_invocation (line 62) | def _format_action_invocation(self, action: argparse.Action) -> str: function general_parser (line 79) | def general_parser(g_parser): function reparse (line 105) | def reparse(arr: list): FILE: manga_translator/colorization/__init__.py function get_colorizer (line 12) | def get_colorizer(key: Colorizer, *args, **kwargs) -> CommonColorizer: function prepare (line 20) | async def prepare(key: Colorizer): function dispatch (line 25) | async def dispatch(key: Colorizer, device: str = 'cpu', **kwargs) -> Ima... function unload (line 31) | async def unload(key: Colorizer): FILE: manga_translator/colorization/common.py class CommonColorizer (line 6) | class CommonColorizer(InfererModule): method colorize (line 9) | async def colorize(self, image: Image.Image, colorization_size: int, *... method _colorize (line 13) | async def _colorize(self, image: Image.Image, colorization_size: int, ... class OfflineColorizer (line 16) | class OfflineColorizer(CommonColorizer, ModelWrapper): method _colorize (line 19) | async def _colorize(self, *args, **kwargs): method _infer (line 23) | async def _infer(self, image: Image.Image, colorization_size: int, **k... FILE: manga_translator/colorization/manga_colorization_v2.py class MangaColorizationV2 (line 14) | class MangaColorizationV2(OfflineColorizer): method _load (line 30) | async def _load(self, device: str): method _unload (line 38) | async def _unload(self): method _infer (line 42) | async def _infer(self, image: Image.Image, colorization_size: int, den... FILE: manga_translator/colorization/manga_colorization_v2_utils/denoising/denoiser.py class FFDNetDenoiser (line 26) | class FFDNetDenoiser: method __init__ (line 27) | def __init__(self, _device, _sigma = 25, _weights_dir = 'denoising/mod... method load_weights (line 37) | def load_weights(self): method get_denoised_image (line 51) | def get_denoised_image(self, imorig, sigma = None): FILE: manga_translator/colorization/manga_colorization_v2_utils/denoising/functions.py function concatenate_input_noise_map (line 16) | def concatenate_input_noise_map(input, noise_sigma): class UpSampleFeaturesFunction (line 56) | class UpSampleFeaturesFunction(Function): method forward (line 64) | def forward(ctx, input): method backward (line 83) | def backward(ctx, grad_output): FILE: manga_translator/colorization/manga_colorization_v2_utils/denoising/models.py class UpSampleFeatures (line 17) | class UpSampleFeatures(nn.Module): method __init__ (line 20) | def __init__(self): method forward (line 22) | def forward(self, x): class IntermediateDnCNN (line 25) | class IntermediateDnCNN(nn.Module): method __init__ (line 29) | def __init__(self, input_features, middle_features, num_conv_layers): method forward (line 64) | def forward(self, x): class FFDNet (line 68) | class FFDNet(nn.Module): method __init__ (line 71) | def __init__(self, num_input_channels): method forward (line 95) | def forward(self, x, noise_sigma): FILE: manga_translator/colorization/manga_colorization_v2_utils/denoising/utils.py function variable_to_cv2_image (line 18) | def variable_to_cv2_image(varim): function normalize (line 36) | def normalize(data): function remove_dataparallel_wrapper (line 39) | def remove_dataparallel_wrapper(state_dict): function is_rgb (line 55) | def is_rgb(im_path): FILE: manga_translator/colorization/manga_colorization_v2_utils/networks/extractor.py class Selayer (line 8) | class Selayer(nn.Module): method __init__ (line 9) | def __init__(self, inplanes): method forward (line 17) | def forward(self, x): class BottleneckX_Origin (line 27) | class BottleneckX_Origin(nn.Module): method __init__ (line 30) | def __init__(self, inplanes, planes, cardinality, stride=1, downsample... method forward (line 48) | def forward(self, x): class SEResNeXt_Origin (line 72) | class SEResNeXt_Origin(nn.Module): method __init__ (line 73) | def __init__(self, block, layers, input_channels=3, cardinality=32, nu... method _make_layer (line 98) | def _make_layer(self, block, planes, blocks, stride=1): method forward (line 115) | def forward(self, x): FILE: manga_translator/colorization/manga_colorization_v2_utils/networks/models.py function l2normalize (line 13) | def l2normalize(v, eps=1e-12): class SpectralNorm (line 17) | class SpectralNorm(nn.Module): method __init__ (line 18) | def __init__(self, module, name='weight', power_iterations=1): method _update_u_v (line 26) | def _update_u_v(self): method _made_params (line 40) | def _made_params(self): method _make_params (line 50) | def _make_params(self): method forward (line 68) | def forward(self, *args): class Selayer (line 72) | class Selayer(nn.Module): method __init__ (line 73) | def __init__(self, inplanes): method forward (line 81) | def forward(self, x): class SelayerSpectr (line 90) | class SelayerSpectr(nn.Module): method __init__ (line 91) | def __init__(self, inplanes): method forward (line 99) | def forward(self, x): class ResNeXtBottleneck (line 108) | class ResNeXtBottleneck(nn.Module): method __init__ (line 109) | def __init__(self, in_channels=256, out_channels=256, stride=1, cardin... method forward (line 125) | def forward(self, x): class SpectrResNeXtBottleneck (line 136) | class SpectrResNeXtBottleneck(nn.Module): method __init__ (line 137) | def __init__(self, in_channels=256, out_channels=256, stride=1, cardin... method forward (line 153) | def forward(self, x): class FeatureConv (line 164) | class FeatureConv(nn.Module): method __init__ (line 165) | def __init__(self, input_dim=512, output_dim=512): method forward (line 182) | def forward(self, x): class Generator (line 185) | class Generator(nn.Module): method __init__ (line 186) | def __init__(self, ngf=64): method _make_encoder_block (line 270) | def _make_encoder_block(self, inplanes, planes): method _make_encoder_block_first (line 278) | def _make_encoder_block_first(self, inplanes, planes): method forward (line 286) | def forward(self, sketch): class Colorizer (line 311) | class Colorizer(nn.Module): method __init__ (line 312) | def __init__(self): method forward (line 317) | def forward(self, x, extractor_grad = False): FILE: manga_translator/colorization/manga_colorization_v2_utils/utils/utils.py function resize_pad (line 4) | def resize_pad(img, size = 256): FILE: manga_translator/config.py class TranslatorChain (line 12) | class TranslatorChain: method __init__ (line 13) | def __init__(self, string: str): method has_offline (line 33) | def has_offline(self) -> bool: method __eq__ (line 40) | def __eq__(self, __o: object) -> bool: function translator_chain (line 46) | def translator_chain(string): function hex2rgb (line 55) | def hex2rgb(h): class Renderer (line 59) | class Renderer(str, Enum): class Alignment (line 65) | class Alignment(str, Enum): class Direction (line 71) | class Direction(str, Enum): class InpaintPrecision (line 76) | class InpaintPrecision(str, Enum): method __str__ (line 81) | def __str__(self): class Detector (line 84) | class Detector(str, Enum): class Inpainter (line 92) | class Inpainter(str, Enum): class Colorizer (line 100) | class Colorizer(str, Enum): class Ocr (line 104) | class Ocr(str, Enum): class Translator (line 110) | class Translator(str, Enum): method __str__ (line 138) | def __str__(self): method _missing_ (line 143) | def _missing_(cls, value): class Upscaler (line 149) | class Upscaler(str, Enum): class RenderConfig (line 154) | class RenderConfig(BaseModel): method font_color_fg (line 186) | def font_color_fg(self): method font_color_bg (line 198) | def font_color_bg(self): class UpscaleConfig (line 209) | class UpscaleConfig(BaseModel): class TranslatorConfig (line 217) | class TranslatorConfig(BaseModel): method translator_gen (line 247) | def translator_gen(self): method chatgpt_config (line 263) | def chatgpt_config(self): class DetectorConfig (line 270) | class DetectorConfig(BaseModel): class InpainterConfig (line 291) | class InpainterConfig(BaseModel): class ColorizerConfig (line 299) | class ColorizerConfig(BaseModel): class OcrConfig (line 307) | class OcrConfig(BaseModel): class Config (line 319) | class Config(BaseModel): method re_filter_text (line 347) | def re_filter_text(self): FILE: manga_translator/detection/__init__.py function get_detector (line 22) | def get_detector(key: Detector, *args, **kwargs) -> CommonDetector: function prepare (line 30) | async def prepare(detector_key: Detector): function dispatch (line 35) | async def dispatch(detector_key: Detector, image: np.ndarray, detect_siz... function unload (line 42) | async def unload(detector_key: Detector): FILE: manga_translator/detection/common.py class CommonDetector (line 10) | class CommonDetector(InfererModule): method detect (line 12) | async def detect(self, image: np.ndarray, detect_size: int, text_thres... method _detect (line 67) | async def _detect(self, image: np.ndarray, detect_size: int, text_thre... method _add_border (line 71) | def _add_border(self, image: np.ndarray, target_side_length: int): method _remove_border (line 81) | def _remove_border(self, image: np.ndarray, old_w: int, old_h: int, te... method _add_rotation (line 101) | def _add_rotation(self, image: np.ndarray): method _remove_rotation (line 104) | def _remove_rotation(self, textlines, raw_mask, mask, img_w, img_h): method _add_inversion (line 115) | def _add_inversion(self, image: np.ndarray): method _add_gamma_correction (line 118) | def _add_gamma_correction(self, image: np.ndarray): method _add_histogram_equalization (line 126) | def _add_histogram_equalization(self, image: np.ndarray): class OfflineDetector (line 137) | class OfflineDetector(CommonDetector, ModelWrapper): method _detect (line 140) | async def _detect(self, *args, **kwargs): method _infer (line 144) | async def _infer(self, image: np.ndarray, detect_size: int, text_thres... FILE: manga_translator/detection/common_rust.py function get_session (line 7) | def get_session(): class RustDetector (line 14) | class RustDetector: method __init__ (line 15) | def __init__(self, det): method parse_args (line 18) | def parse_args(self, args: TranslatorConfig): method is_downloaded (line 22) | def is_downloaded(self) -> bool: method download (line 26) | async def download(self, force=False): method model_dir (line 31) | def model_dir(self): method infer (line 35) | async def infer(self, *args, **kwargs): method detect (line 39) | async def detect(self, image: np.ndarray, detect_size: int, text_thres... method reload (line 52) | async def reload(self, device: str, *args, **kwargs): method load (line 56) | async def load(self, device: str, *args, **kwargs): method unload (line 59) | async def unload(self): method is_loaded (line 62) | def is_loaded(self) -> bool: FILE: manga_translator/detection/craft.py class double_conv (line 29) | class double_conv(nn.Module): method __init__ (line 30) | def __init__(self, in_ch, mid_ch, out_ch): method forward (line 41) | def forward(self, x): class CRAFT (line 46) | class CRAFT(nn.Module): method __init__ (line 47) | def __init__(self, pretrained=False, freeze=False): method forward (line 74) | def forward(self, x): function copyStateDict (line 100) | def copyStateDict(state_dict): class CRAFTDetector (line 111) | class CRAFTDetector(OfflineDetector): method __init__ (line 125) | def __init__(self, *args, **kwargs): method _load (line 133) | async def _load(self, device: str): method _unload (line 147) | async def _unload(self): method _infer (line 150) | async def _infer(self, image: np.ndarray, detect_size: int, text_thres... FILE: manga_translator/detection/craft_utils/refiner.py class RefineNet (line 14) | class RefineNet(nn.Module): method __init__ (line 15) | def __init__(self): method forward (line 54) | def forward(self, y, upconv4): FILE: manga_translator/detection/craft_utils/vgg16_bn.py function init_weights (line 8) | def init_weights(modules): class vgg16_bn (line 21) | class vgg16_bn(torch.nn.Module): method __init__ (line 22) | def __init__(self, pretrained=True, freeze=True): method forward (line 58) | def forward(self, X): FILE: manga_translator/detection/ctd.py function preprocess_img (line 17) | def preprocess_img(img, input_size=(1024, 1024), device='cpu', bgr2rgb=T... function postprocess_mask (line 30) | def postprocess_mask(img: Union[torch.Tensor, np.ndarray], thresh=None): function postprocess_yolo (line 46) | def postprocess_yolo(det, conf_thresh, nms_thresh, resize_ratio, sort_fu... class ComicTextDetector (line 62) | class ComicTextDetector(OfflineDetector): method __init__ (line 76) | def __init__(self, *args, **kwargs): method _load (line 84) | async def _load(self, device: str, input_size=1024, half=False, nms_th... method _unload (line 104) | async def _unload(self): method det_batch_forward_ctd (line 107) | def det_batch_forward_ctd(self, batch: np.ndarray, device: str) -> Tup... method _infer (line 130) | async def _infer(self, image: np.ndarray, detect_size: int, text_thres... FILE: manga_translator/detection/ctd_utils/basemodel.py class double_conv_up_c3 (line 15) | class double_conv_up_c3(nn.Module): method __init__ (line 16) | def __init__(self, in_ch, mid_ch, out_ch, act=True): method forward (line 25) | def forward(self, x): class double_conv_c3 (line 28) | class double_conv_c3(nn.Module): method __init__ (line 29) | def __init__(self, in_ch, out_ch, stride=1, act=True): method forward (line 35) | def forward(self, x): class UnetHead (line 41) | class UnetHead(nn.Module): method __init__ (line 42) | def __init__(self, act=True) -> None: method forward (line 56) | def forward(self, f160, f80, f40, f20, f3, forward_mode=TEXTDET_MASK): method init_weight (line 74) | def init_weight(self, init_func): class DBHead (line 77) | class DBHead(nn.Module): method __init__ (line 78) | def __init__(self, in_channels, k = 50, shrink_with_sigmoid=True, act=... method forward (line 100) | def forward(self, f80, f40, u40, shrink_with_sigmoid=True, step_eval=F... method init_weight (line 121) | def init_weight(self, init_func): method _init_thresh (line 124) | def _init_thresh(self, inner_channels, serial=False, smooth=False, bia... method _init_upsample (line 139) | def _init_upsample(self, in_channels, out_channels, smooth=False, bias... method step_function (line 153) | def step_function(self, x, y): class TextDetector (line 156) | class TextDetector(nn.Module): method __init__ (line 157) | def __init__(self, weights, map_location='cpu', forward_mode=TEXTDET_M... method train_mask (line 171) | def train_mask(self): method initialize_db (line 176) | def initialize_db(self, unet_weights): method train_db (line 188) | def train_db(self): method forward (line 194) | def forward(self, x): function get_base_det_models (line 205) | def get_base_det_models(model_path, device='cpu', half=False, act='leaky'): class TextDetBase (line 216) | class TextDetBase(nn.Module): method __init__ (line 217) | def __init__(self, model_path, device='cpu', half=False, fuse=False, a... method fuse (line 223) | def fuse(self): method forward (line 234) | def forward(self, features): class TextDetBaseDNN (line 240) | class TextDetBaseDNN: method __init__ (line 241) | def __init__(self, input_size, model_path): method __call__ (line 246) | def __call__(self, im_in): FILE: manga_translator/detection/ctd_utils/textmask.py function get_topk_color (line 16) | def get_topk_color(color_list, bins, k=3, color_var=10, bin_tol=0.001): function minxor_thresh (line 29) | def minxor_thresh(threshed, mask, dilate=False): function get_otsuthresh_masklist (line 43) | def get_otsuthresh_masklist(img, pred_mask, per_channel=False) -> List[n... function get_topk_masklist (line 56) | def get_topk_masklist(im_grey, pred_mask): function merge_mask_list (line 73) | def merge_mask_list(mask_list, pred_mask, blk: Quadrilateral = None, pre... function refine_undetected_mask (line 135) | def refine_undetected_mask(img: np.ndarray, mask_pred: np.ndarray, mask_... function refine_mask (line 158) | def refine_mask(img: np.ndarray, pred_mask: np.ndarray, blk_list: List[Q... FILE: manga_translator/detection/ctd_utils/utils/db_utils.py function iou_rotate (line 11) | def iou_rotate(box_a, box_b, method='union'): class SegDetectorRepresenter (line 32) | class SegDetectorRepresenter(): method __init__ (line 33) | def __init__(self, thresh=0.3, box_thresh=0.7, max_candidates=1000, un... method __call__ (line 40) | def __call__(self, batch, pred, is_output_polygon=False, height=None, ... method binarize (line 75) | def binarize(self, pred) -> np.ndarray: method polygons_from_bitmap (line 78) | def polygons_from_bitmap(self, pred, _bitmap, dest_width, dest_height): method boxes_from_bitmap (line 127) | def boxes_from_bitmap(self, pred, _bitmap, dest_width, dest_height): method unclip (line 173) | def unclip(self, box, unclip_ratio=1.5): method get_mini_boxes (line 181) | def get_mini_boxes(self, contour): method box_score_fast (line 202) | def box_score_fast(self, bitmap, _box): class AverageMeter (line 218) | class AverageMeter(object): method __init__ (line 221) | def __init__(self): method reset (line 224) | def reset(self): method update (line 230) | def update(self, val, n=1): class DetectionIoUEvaluator (line 238) | class DetectionIoUEvaluator(object): method __init__ (line 239) | def __init__(self, is_output_polygon=False, iou_constraint=0.5, area_p... method evaluate_image (line 244) | def evaluate_image(self, gt, pred): method combine_results (line 420) | def combine_results(self, results): class QuadMetric (line 442) | class QuadMetric(): method __init__ (line 443) | def __init__(self, is_output_polygon=False): method measure (line 447) | def measure(self, batch, output, box_thresh=0.6): method validate_measure (line 478) | def validate_measure(self, batch, output, box_thresh=0.6): method evaluate_measure (line 481) | def evaluate_measure(self, batch, output): method gather_measure (line 484) | def gather_measure(self, raw_metrics): function shrink_polygon_py (line 506) | def shrink_polygon_py(polygon, shrink_ratio): function shrink_polygon_pyclipper (line 517) | def shrink_polygon_pyclipper(polygon, shrink_ratio): class MakeShrinkMap (line 532) | class MakeShrinkMap(): method __init__ (line 538) | def __init__(self, min_text_size=4, shrink_ratio=0.4, shrink_type='pyc... method __call__ (line 544) | def __call__(self, data: dict) -> dict: method validate_polygons (line 577) | def validate_polygons(self, polygons, ignore_tags, h, w): method polygon_area (line 596) | def polygon_area(self, polygon): class MakeBorderMap (line 600) | class MakeBorderMap(): method __init__ (line 601) | def __init__(self, shrink_ratio=0.4, thresh_min=0.3, thresh_max=0.7): method __call__ (line 606) | def __call__(self, data: dict) -> dict: method draw_border_map (line 629) | def draw_border_map(self, polygon, canvas, mask): method distance (line 679) | def distance(self, xs, ys, point_1, point_2): method extend_line (line 699) | def extend_line(self, point_1, point_2, result): FILE: manga_translator/detection/ctd_utils/utils/imgproc_utils.py function hex2bgr (line 6) | def hex2bgr(hex): function union_area (line 14) | def union_area(bboxa, bboxb): function get_yololabel_strings (line 23) | def get_yololabel_strings(clslist, labellist): function xywh2xyxypoly (line 32) | def xywh2xyxypoly(xywh, to_int=True): function xyxy2yolo (line 40) | def xyxy2yolo(xyxy, w: int, h: int): function yolo_xywh2xyxy (line 54) | def yolo_xywh2xyxy(xywh: np.array, w: int, h: int, to_int=True): function letterbox (line 69) | def letterbox(im, new_shape=(640, 640), color=(0, 0, 0), auto=False, sca... function resize_keepasp (line 102) | def resize_keepasp(im, new_shape=640, scaleup=True, interpolation=cv2.IN... function enlarge_window (line 134) | def enlarge_window(rect, im_w, im_h, ratio=2.5, aspect_ratio=1.0) -> List: function draw_connected_labels (line 152) | def draw_connected_labels(num_labels, labels, stats, centroids, names="d... FILE: manga_translator/detection/ctd_utils/utils/io_utils.py class NumpyEncoder (line 16) | class NumpyEncoder(json.JSONEncoder): method default (line 17) | def default(self, obj): function find_all_imgs (line 29) | def find_all_imgs(img_dir, abs_path=False): function imread (line 42) | def imread(imgpath, read_type=cv2.IMREAD_COLOR): function imwrite (line 48) | def imwrite(img_path, img, ext='.png'): FILE: manga_translator/detection/ctd_utils/utils/weight_init.py function constant_init (line 4) | def constant_init(module, val, bias=0): function xavier_init (line 9) | def xavier_init(module, gain=1, bias=0, distribution='normal'): function normal_init (line 19) | def normal_init(module, mean=0, std=1, bias=0): function uniform_init (line 25) | def uniform_init(module, a=0, b=1, bias=0): function kaiming_init (line 31) | def kaiming_init(module, function bilinear_kernel (line 75) | def bilinear_kernel(in_channels, out_channels, kernel_size): function init_weights (line 91) | def init_weights(m): FILE: manga_translator/detection/ctd_utils/utils/yolov5_utils.py function scale_img (line 10) | def scale_img(img, ratio=1.0, same_shape=False, gs=32): # img(16,3,256,... function fuse_conv_and_bn (line 22) | def fuse_conv_and_bn(conv, bn): function check_anchor_order (line 44) | def check_anchor_order(m): function initialize_weights (line 52) | def initialize_weights(model): function make_divisible (line 63) | def make_divisible(x, divisor): function intersect_dicts (line 69) | def intersect_dicts(da, db, exclude=()): function check_version (line 73) | def check_version(current='0.0.0', minimum='0.0.0', name='version ', pin... class Colors (line 83) | class Colors: method __init__ (line 85) | def __init__(self): method __call__ (line 92) | def __call__(self, i, bgr=False): method hex2rgb (line 97) | def hex2rgb(h): # rgb order (PIL) function box_iou (line 100) | def box_iou(box1, box2): function non_max_suppression (line 124) | def non_max_suppression(prediction, conf_thres=0.25, iou_thres=0.45, cla... function xywh2xyxy (line 220) | def xywh2xyxy(x): function draw_bbox (line 230) | def draw_bbox(pred, img, lang_list=None): FILE: manga_translator/detection/ctd_utils/yolov5/common.py function autopad (line 24) | def autopad(k, p=None): # kernel, padding class Conv (line 30) | class Conv(nn.Module): method __init__ (line 32) | def __init__(self, c1, c2, k=1, s=1, p=None, g=1, act=True): # ch_in,... method forward (line 45) | def forward(self, x): method forward_fuse (line 48) | def forward_fuse(self, x): class DWConv (line 52) | class DWConv(Conv): method __init__ (line 54) | def __init__(self, c1, c2, k=1, s=1, act=True): # ch_in, ch_out, kern... class TransformerLayer (line 58) | class TransformerLayer(nn.Module): method __init__ (line 60) | def __init__(self, c, num_heads): method forward (line 69) | def forward(self, x): class TransformerBlock (line 75) | class TransformerBlock(nn.Module): method __init__ (line 77) | def __init__(self, c1, c2, num_heads, num_layers): method forward (line 86) | def forward(self, x): class Bottleneck (line 94) | class Bottleneck(nn.Module): method __init__ (line 96) | def __init__(self, c1, c2, shortcut=True, g=1, e=0.5, act=True): # ch... method forward (line 103) | def forward(self, x): class BottleneckCSP (line 107) | class BottleneckCSP(nn.Module): method __init__ (line 109) | def __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5): # ch_in, ... method forward (line 120) | def forward(self, x): class C3 (line 126) | class C3(nn.Module): method __init__ (line 128) | def __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5, act=True): ... method forward (line 137) | def forward(self, x): class C3TR (line 141) | class C3TR(C3): method __init__ (line 143) | def __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5): class C3SPP (line 149) | class C3SPP(C3): method __init__ (line 151) | def __init__(self, c1, c2, k=(5, 9, 13), n=1, shortcut=True, g=1, e=0.5): class C3Ghost (line 157) | class C3Ghost(C3): method __init__ (line 159) | def __init__(self, c1, c2, n=1, shortcut=True, g=1, e=0.5): class SPP (line 165) | class SPP(nn.Module): method __init__ (line 167) | def __init__(self, c1, c2, k=(5, 9, 13)): method forward (line 174) | def forward(self, x): class SPPF (line 181) | class SPPF(nn.Module): method __init__ (line 183) | def __init__(self, c1, c2, k=5): # equivalent to SPP(k=(5, 9, 13)) method forward (line 190) | def forward(self, x): class Focus (line 199) | class Focus(nn.Module): method __init__ (line 201) | def __init__(self, c1, c2, k=1, s=1, p=None, g=1, act=True): # ch_in,... method forward (line 206) | def forward(self, x): # x(b,c,w,h) -> y(b,4c,w/2,h/2) class GhostConv (line 211) | class GhostConv(nn.Module): method __init__ (line 213) | def __init__(self, c1, c2, k=1, s=1, g=1, act=True): # ch_in, ch_out,... method forward (line 219) | def forward(self, x): class GhostBottleneck (line 224) | class GhostBottleneck(nn.Module): method __init__ (line 226) | def __init__(self, c1, c2, k=3, s=1): # ch_in, ch_out, kernel, stride method forward (line 235) | def forward(self, x): class Contract (line 239) | class Contract(nn.Module): method __init__ (line 241) | def __init__(self, gain=2): method forward (line 245) | def forward(self, x): class Expand (line 253) | class Expand(nn.Module): method __init__ (line 255) | def __init__(self, gain=2): method forward (line 259) | def forward(self, x): class Concat (line 267) | class Concat(nn.Module): method __init__ (line 269) | def __init__(self, dimension=1): method forward (line 273) | def forward(self, x): class Classify (line 277) | class Classify(nn.Module): method __init__ (line 279) | def __init__(self, c1, c2, k=1, s=1, p=None, g=1): # ch_in, ch_out, k... method forward (line 285) | def forward(self, x): FILE: manga_translator/detection/ctd_utils/yolov5/yolo.py class Detect (line 7) | class Detect(nn.Module): method __init__ (line 11) | def __init__(self, nc=80, anchors=(), ch=(), inplace=True): # detecti... method forward (line 23) | def forward(self, x): method _make_grid (line 46) | def _make_grid(self, nx=20, ny=20, i=0): class Model (line 57) | class Model(nn.Module): method __init__ (line 58) | def __init__(self, cfg='yolov5s.yaml', ch=3, nc=None, anchors=None): ... method forward (line 96) | def forward(self, x, augment=False, profile=False, visualize=False, de... method _forward_once (line 115) | def _forward_once(self, x, profile=False, visualize=False, detect=False): method _descale_pred (line 136) | def _descale_pred(self, p, flips, scale, img_size): method _clip_augmented (line 153) | def _clip_augmented(self, y): method _profile_one_layer (line 164) | def _profile_one_layer(self, m, x, dt): method _initialize_biases (line 170) | def _initialize_biases(self, cf=None): # initialize biases into Detec... method _print_biases (line 180) | def _print_biases(self): method fuse (line 185) | def fuse(self): # fuse model Conv2d() + BatchNorm2d() layers method _apply (line 197) | def _apply(self, fn): function parse_model (line 208) | def parse_model(d, ch): # model_dict, input_channels(3) function load_yolov5 (line 261) | def load_yolov5(weights, map_location='cuda', fuse=True, inplace=True, o... function load_yolov5_ckpt (line 286) | def load_yolov5_ckpt(weights, map_location='cpu', fuse=True, inplace=Tru... FILE: manga_translator/detection/dbnet_convnext.py class Downsample (line 20) | class Downsample(nn.Module): method __init__ (line 22) | def __init__(self, in_chs, out_chs, stride=1, dilation=1): method forward (line 36) | def forward(self, x): class ConvNeXtBlock (line 42) | class ConvNeXtBlock(nn.Module): method __init__ (line 53) | def __init__( method forward (line 112) | def forward(self, x): class ConvNeXtStage (line 130) | class ConvNeXtStage(nn.Module): method __init__ (line 132) | def __init__( method forward (line 190) | def forward(self, x): class ConvNeXt (line 196) | class ConvNeXt(nn.Module): method __init__ (line 201) | def __init__( method group_matcher (line 323) | def group_matcher(self, coarse=False): method set_grad_checkpointing (line 334) | def set_grad_checkpointing(self, enable=True): method get_classifier (line 339) | def get_classifier(self): method forward_features (line 342) | def forward_features(self, x): function _init_weights (line 347) | def _init_weights(module, name=None, head_init_scale=1.0): class UpconvSkip (line 359) | class UpconvSkip(nn.Module) : method __init__ (line 360) | def __init__(self, ch1, ch2, out_ch) -> None: method forward (line 377) | def forward(self, x) : class DBHead (line 382) | class DBHead(nn.Module): method __init__ (line 383) | def __init__(self, in_channels, k = 50): method forward (line 400) | def forward(self, x): method weights_init (line 410) | def weights_init(self, m): method _init_thresh (line 418) | def _init_thresh(self, inner_channels, serial=False, smooth=False, bia... method _init_upsample (line 433) | def _init_upsample(self, in_channels, out_channels, smooth=False, bias... method step_function (line 447) | def step_function(self, x, y): class DBNetConvNext (line 450) | class DBNetConvNext(nn.Module) : method __init__ (line 451) | def __init__(self) : method forward (line 474) | def forward(self, x) : function det_batch_forward_default (line 499) | def det_batch_forward_default(batch: np.ndarray, device: str): class DBConvNextDetector (line 512) | class DBConvNextDetector(OfflineDetector): method __init__ (line 521) | def __init__(self, *args, **kwargs): method _load (line 527) | async def _load(self, device: str): method _unload (line 538) | async def _unload(self): method _infer (line 541) | async def _infer(self, image: np.ndarray, detect_size: int, text_thres... FILE: manga_translator/detection/default.py function det_batch_forward_default (line 15) | def det_batch_forward_default(batch: np.ndarray, device: str): class DefaultDetector (line 27) | class DefaultDetector(OfflineDetector): method __init__ (line 36) | def __init__(self, *args, **kwargs): method _load (line 42) | async def _load(self, device: str): method _unload (line 53) | async def _unload(self): method _infer (line 56) | async def _infer(self, image: np.ndarray, detect_size: int, text_thres... FILE: manga_translator/detection/default_utils/CRAFT_resnet34.py class ImageMultiheadSelfAttention (line 12) | class ImageMultiheadSelfAttention(nn.Module): method __init__ (line 13) | def __init__(self, planes): method forward (line 16) | def forward(self, x): class double_conv (line 24) | class double_conv(nn.Module): method __init__ (line 25) | def __init__(self, in_ch, mid_ch, out_ch, stride = 1, planes = 256): method forward (line 47) | def forward(self, x): class CRAFT_net (line 53) | class CRAFT_net(nn.Module): method __init__ (line 54) | def __init__(self): method forward_train (line 96) | def forward_train(self, x): method forward (line 123) | def forward(self, x): FILE: manga_translator/detection/default_utils/DBHead.py class DBHead (line 7) | class DBHead(nn.Module): method __init__ (line 8) | def __init__(self, in_channels, out_channels, k = 50): method forward (line 25) | def forward(self, x): method weights_init (line 35) | def weights_init(self, m): method _init_thresh (line 43) | def _init_thresh(self, inner_channels, serial=False, smooth=False, bia... method _init_upsample (line 58) | def _init_upsample(self, in_channels, out_channels, smooth=False, bias... method step_function (line 72) | def step_function(self, x, y): FILE: manga_translator/detection/default_utils/DBNet_resnet101.py class ImageMultiheadSelfAttention (line 11) | class ImageMultiheadSelfAttention(nn.Module): method __init__ (line 12) | def __init__(self, planes): method forward (line 15) | def forward(self, x): class double_conv (line 23) | class double_conv(nn.Module): method __init__ (line 24) | def __init__(self, in_ch, mid_ch, out_ch, stride = 1, planes = 256): method forward (line 46) | def forward(self, x): class double_conv_up (line 52) | class double_conv_up(nn.Module): method __init__ (line 53) | def __init__(self, in_ch, mid_ch, out_ch, stride = 1, planes = 256): method forward (line 78) | def forward(self, x): class TextDetection (line 84) | class TextDetection(nn.Module): method __init__ (line 85) | def __init__(self, pretrained=None): method forward (line 116) | def forward(self, x): FILE: manga_translator/detection/default_utils/DBNet_resnet34.py class ImageMultiheadSelfAttention (line 11) | class ImageMultiheadSelfAttention(nn.Module): method __init__ (line 12) | def __init__(self, planes): method forward (line 15) | def forward(self, x): class double_conv (line 23) | class double_conv(nn.Module): method __init__ (line 24) | def __init__(self, in_ch, mid_ch, out_ch, stride = 1, planes = 256): method forward (line 49) | def forward(self, x): class double_conv_up (line 55) | class double_conv_up(nn.Module): method __init__ (line 56) | def __init__(self, in_ch, mid_ch, out_ch, planes = 256): method forward (line 72) | def forward(self, x): class TextDetection (line 76) | class TextDetection(nn.Module): method __init__ (line 77) | def __init__(self, pretrained=None): method forward (line 103) | def forward(self, x): FILE: manga_translator/detection/default_utils/craft_utils.py function warpCoord (line 13) | def warpCoord(Minv, pt): function getDetBoxes_core (line 19) | def getDetBoxes_core(textmap, linkmap, text_threshold, link_threshold, l... function getPoly_core (line 82) | def getPoly_core(boxes, labels, mapper, linkmap): function getDetBoxes (line 228) | def getDetBoxes(textmap, linkmap, text_threshold, link_threshold, low_te... function adjustResultCoordinates (line 238) | def adjustResultCoordinates(polys, ratio_w, ratio_h, ratio_net = 2): FILE: manga_translator/detection/default_utils/dbnet_utils.py class SegDetectorRepresenter (line 8) | class SegDetectorRepresenter(): method __init__ (line 9) | def __init__(self, thresh=0.6, box_thresh=0.8, max_candidates=1000, un... method __call__ (line 16) | def __call__(self, batch, pred, is_output_polygon=False): method binarize (line 45) | def binarize(self, pred): method polygons_from_bitmap (line 48) | def polygons_from_bitmap(self, pred, _bitmap, dest_width, dest_height): method boxes_from_bitmap (line 97) | def boxes_from_bitmap(self, pred, _bitmap, dest_width, dest_height): method unclip (line 146) | def unclip(self, box, unclip_ratio=1.8): method get_mini_boxes (line 154) | def get_mini_boxes(self, contour): method box_score_fast (line 175) | def box_score_fast(self, bitmap, _box): FILE: manga_translator/detection/default_utils/imgproc.py function loadImage (line 11) | def loadImage(img_file): function normalizeMeanVariance (line 20) | def normalizeMeanVariance(in_img, mean=(0.485, 0.456, 0.406), variance=(... function denormalizeMeanVariance (line 28) | def denormalizeMeanVariance(in_img, mean=(0.485, 0.456, 0.406), variance... function resize_aspect_ratio (line 37) | def resize_aspect_ratio(img, square_size, interpolation, mag_ratio=1): function cvt2HeatmapImg (line 72) | def cvt2HeatmapImg(img): FILE: manga_translator/detection/none.py class NoneDetector (line 5) | class NoneDetector(CommonDetector): method _detect (line 6) | async def _detect(self, image: np.ndarray, detect_size: int, text_thre... FILE: manga_translator/detection/paddle_rust.py class PaddleDetector (line 4) | class PaddleDetector(RustDetector): method __init__ (line 5) | def __init__(self): FILE: manga_translator/detection/panel_finder.py function panel_process_image (line 12) | def panel_process_image(img: Image.Image): function remove_contained_contours (line 41) | def remove_contained_contours(polygons): function calc_panel_contours (line 82) | def calc_panel_contours(im: Image.Image): function determine_panel_order_from_contours (line 101) | def determine_panel_order_from_contours(contours): function draw_contours (line 108) | def draw_contours(im, contours): function save_draw_contours (line 139) | def save_draw_contours(pth: Path | str): function order_panels (line 160) | def order_panels(contours, img_gray): function generate_vertical_bounding_box_groups_indices (line 195) | def generate_vertical_bounding_box_groups_indices(bounding_boxes): function check_overlap (line 237) | def check_overlap(range1, range2): FILE: manga_translator/inpainting/__init__.py function get_inpainter (line 23) | def get_inpainter(key: Inpainter, *args, **kwargs) -> CommonInpainter: function prepare (line 31) | async def prepare(inpainter_key: Inpainter, device: str = 'cpu'): function dispatch (line 37) | async def dispatch(inpainter_key: Inpainter, image: np.ndarray, mask: np... function unload (line 44) | async def unload(inpainter_key: Inpainter): FILE: manga_translator/inpainting/booru_tagger.py function make_square (line 15) | def make_square(img, target_size): function smart_resize (line 32) | def smart_resize(img, size): class Tagger (line 40) | class Tagger : method __init__ (line 41) | def __init__(self, filename) -> None: method label (line 47) | def label(self, image: Image) -> Dict[str, float] : method label_cv2_bgr (line 80) | def label_cv2_bgr(self, image: np.ndarray) -> Dict[str, float] : FILE: manga_translator/inpainting/common.py class CommonInpainter (line 7) | class CommonInpainter(InfererModule): method inpaint (line 9) | async def inpaint(self, image: np.ndarray, mask: np.ndarray, config: I... method _inpaint (line 13) | async def _inpaint(self, image: np.ndarray, mask: np.ndarray, config: ... class OfflineInpainter (line 16) | class OfflineInpainter(CommonInpainter, ModelWrapper): method _inpaint (line 19) | async def _inpaint(self, *args, **kwargs): method _infer (line 23) | async def _infer(self, image: np.ndarray, mask: np.ndarray, config: In... FILE: manga_translator/inpainting/guided_ldm_inpainting.py class GuidedDDIMSample (line 26) | class GuidedDDIMSample(DDIMSampler) : method __init__ (line 27) | def __init__(self, *args, **kwargs): method p_sample_ddim (line 31) | def p_sample_ddim(self, x, c, t, index, repeat_noise=False, use_origin... method decode (line 88) | def decode(self, x_latent, cond, t_start, init_latent=None, nmask=None... function get_inpainting_image_condition (line 113) | def get_inpainting_image_condition(model, image, mask) : function get_empty_image_condition (line 130) | def get_empty_image_condition(latent) : function fill_mask_input (line 135) | def fill_mask_input(image, mask): class GuidedLDM (line 152) | class GuidedLDM(LatentDiffusion): method __init__ (line 153) | def __init__(self, *args, **kwargs): method img2img_inpaint (line 157) | def img2img_inpaint( function get_state_dict (line 236) | def get_state_dict(d): function load_state_dict (line 240) | def load_state_dict(ckpt_path, location='cpu'): function create_model (line 251) | def create_model(config_path): FILE: manga_translator/inpainting/inpainting_aot.py class AotInpainter (line 11) | class AotInpainter(LamaMPEInpainter): method __init__ (line 20) | def __init__(self, *args, **kwargs): method _load (line 26) | async def _load(self, device: str): function relu_nf (line 36) | def relu_nf(x): function gelu_nf (line 39) | def gelu_nf(x): function silu_nf (line 42) | def silu_nf(x): class LambdaLayer (line 45) | class LambdaLayer(nn.Module): method __init__ (line 46) | def __init__(self, f): method forward (line 50) | def forward(self, x): class ScaledWSConv2d (line 53) | class ScaledWSConv2d(nn.Conv2d): method __init__ (line 55) | def __init__(self, in_channels, out_channels, kernel_size, method get_weight (line 70) | def get_weight(self): method forward (line 79) | def forward(self, x): class ScaledWSTransposeConv2d (line 84) | class ScaledWSTransposeConv2d(nn.ConvTranspose2d): method __init__ (line 86) | def __init__(self, in_channels: int, method get_weight (line 105) | def get_weight(self): method forward (line 114) | def forward(self, x, output_size: Optional[List[int]] = None): class GatedWSConvPadded (line 120) | class GatedWSConvPadded(nn.Module): method __init__ (line 121) | def __init__(self, in_ch, out_ch, ks, stride = 1, dilation = 1): method forward (line 129) | def forward(self, x): class GatedWSTransposeConvPadded (line 135) | class GatedWSTransposeConvPadded(nn.Module): method __init__ (line 136) | def __init__(self, in_ch, out_ch, ks, stride = 1): method forward (line 143) | def forward(self, x): class ResBlock (line 148) | class ResBlock(nn.Module): method __init__ (line 149) | def __init__(self, ch, alpha = 0.2, beta = 1.0, dilation = 1): method forward (line 156) | def forward(self, x): function my_layer_norm (line 163) | def my_layer_norm(feat): class AOTBlock (line 170) | class AOTBlock(nn.Module): method __init__ (line 171) | def __init__(self, dim, rates = [2, 4, 8, 16]): method forward (line 188) | def forward(self, x): class ResBlockDis (line 196) | class ResBlockDis(nn.Module): method __init__ (line 197) | def __init__(self, in_planes, planes, stride=1): method forward (line 213) | def forward(self, x): class Discriminator (line 219) | class Discriminator(nn.Module): method __init__ (line 220) | def __init__(self, in_ch = 3, in_planes = 64, blocks = [2, 2, 2], alph... method forward (line 236) | def forward(self, x): class AOTGenerator (line 240) | class AOTGenerator(nn.Module): method __init__ (line 241) | def __init__(self, in_ch = 4, out_ch = 3, ch = 32, alpha = 0.0): method forward (line 266) | def forward(self, img, mask): function test (line 276) | def test(): FILE: manga_translator/inpainting/inpainting_attn.py function relu_nf (line 8) | def relu_nf(x): function gelu_nf (line 11) | def gelu_nf(x): function silu_nf (line 14) | def silu_nf(x): class LambdaLayer (line 17) | class LambdaLayer(nn.Module): method __init__ (line 18) | def __init__(self, f): method forward (line 22) | def forward(self, x): class ScaledWSConv2d (line 25) | class ScaledWSConv2d(nn.Conv2d): method __init__ (line 27) | def __init__(self, in_channels, out_channels, kernel_size, method get_weight (line 42) | def get_weight(self): method forward (line 51) | def forward(self, x): class ScaledWSTransposeConv2d (line 56) | class ScaledWSTransposeConv2d(nn.ConvTranspose2d): method __init__ (line 58) | def __init__(self, in_channels: int, method get_weight (line 77) | def get_weight(self): method forward (line 86) | def forward(self, x, output_size: Optional[List[int]] = None): class GatedWSConvPadded (line 92) | class GatedWSConvPadded(nn.Module): method __init__ (line 93) | def __init__(self, in_ch, out_ch, ks, stride = 1, dilation = 1): method forward (line 101) | def forward(self, x): class GatedWSTransposeConvPadded (line 107) | class GatedWSTransposeConvPadded(nn.Module): method __init__ (line 108) | def __init__(self, in_ch, out_ch, ks, stride = 1): method forward (line 115) | def forward(self, x): class ResBlock (line 120) | class ResBlock(nn.Module): method __init__ (line 121) | def __init__(self, ch, alpha = 0.2, beta = 1.0, dilation = 1): method forward (line 128) | def forward(self, x): class GlobalAttention (line 136) | class GlobalAttention(nn.Module): method __init__ (line 139) | def __init__(self, in_dim): method forward (line 150) | def forward(self, a, b, c): class CoarseGenerator (line 168) | class CoarseGenerator(nn.Module): method __init__ (line 169) | def __init__(self, in_ch = 4, out_ch = 3, ch = 32, alpha = 0.2): method forward (line 230) | def forward(self, img, mask): class InpaintingVanilla (line 244) | class InpaintingVanilla(nn.Module): method __init__ (line 245) | def __init__(self): method forward (line 249) | def forward(self, x, mask): FILE: manga_translator/inpainting/inpainting_lama.py class LamaInpainter (line 17) | class LamaInpainter(LamaMPEInpainter): method _load (line 26) | async def _load(self, device: str): class DepthWiseSeparableConv (line 36) | class DepthWiseSeparableConv(nn.Module): method __init__ (line 37) | def __init__(self, in_dim, out_dim, *args, **kwargs): method forward (line 46) | def forward(self, x): class MultidilatedConv (line 51) | class MultidilatedConv(nn.Module): method __init__ (line 52) | def __init__(self, in_dim, out_dim, kernel_size, dilation_num=3, comb_... method forward (line 118) | def forward(self, x): class BaseDiscriminator (line 145) | class BaseDiscriminator(nn.Module): method forward (line 147) | def forward(self, x: torch.Tensor) -> Tuple[torch.Tensor, List[torch.T... function get_conv_block_ctor (line 155) | def get_conv_block_ctor(kind='default'): function get_norm_layer (line 167) | def get_norm_layer(kind='bn'): function get_activation (line 177) | def get_activation(kind='tanh'): class LearnableSpatialTransformWrapper (line 186) | class LearnableSpatialTransformWrapper(nn.Module): method __init__ (line 187) | def __init__(self, impl, pad_coef=0.5, angle_init_range=80, train_angl... method forward (line 195) | def forward(self, x): method transform (line 205) | def transform(self, x): method inverse_transform (line 212) | def inverse_transform(self, y_padded_rotated, orig_x): class FFCSE_block (line 221) | class FFCSE_block(nn.Module): method __init__ (line 223) | def __init__(self, channels, ratio_g): method forward (line 239) | def forward(self, x): class SELayer (line 253) | class SELayer(nn.Module): method __init__ (line 254) | def __init__(self, channel, reduction=16): method forward (line 264) | def forward(self, x): class FourierUnit (line 271) | class FourierUnit(nn.Module): method __init__ (line 273) | def __init__(self, in_channels, out_channels, groups=1, spatial_scale_... method forward (line 298) | def forward(self, x): class SpectralTransform (line 338) | class SpectralTransform(nn.Module): method __init__ (line 340) | def __init__(self, in_channels, out_channels, stride=1, groups=1, enab... method forward (line 364) | def forward(self, x): class FFC (line 388) | class FFC(nn.Module): method __init__ (line 390) | def __init__(self, in_channels, out_channels, kernel_size, method forward (line 427) | def forward(self, x): class FFC_BN_ACT (line 450) | class FFC_BN_ACT(nn.Module): method __init__ (line 452) | def __init__(self, in_channels, out_channels, method forward (line 473) | def forward(self, x): class FFCResnetBlock (line 480) | class FFCResnetBlock(nn.Module): method __init__ (line 481) | def __init__(self, dim, padding_type, norm_layer, activation_layer=nn.... method forward (line 499) | def forward(self, x): class ConcatTupleLayer (line 517) | class ConcatTupleLayer(nn.Module): method forward (line 518) | def forward(self, x): class FFCResNetGenerator (line 527) | class FFCResNetGenerator(nn.Module): method __init__ (line 528) | def __init__(self, input_nc, output_nc, ngf=64, n_downsampling=3, n_bl... method forward (line 588) | def forward(self, input, mask = None): class FFCNLayerDiscriminator (line 594) | class FFCNLayerDiscriminator(BaseDiscriminator): method __init__ (line 595) | def __init__(self, input_nc, ndf=64, n_layers=3, norm_layer=nn.BatchNo... method get_all_activations (line 640) | def get_all_activations(self, x): method forward (line 647) | def forward(self, x): function get_generator (line 659) | def get_generator(n_blocks: int = 9): function get_discriminator (line 677) | def get_discriminator(): function test_model (line 692) | def test_model(): FILE: manga_translator/inpainting/inpainting_lama_mpe.py class LamaMPEInpainter (line 26) | class LamaMPEInpainter(OfflineInpainter): method __init__ (line 40) | def __init__(self, *args, **kwargs): method _load (line 46) | async def _load(self, device: str): method _unload (line 53) | async def _unload(self): method _infer (line 56) | async def _infer(self, image: np.ndarray, mask: np.ndarray, config: In... class LamaLargeInpainter (line 121) | class LamaLargeInpainter(LamaMPEInpainter): method _load (line 131) | async def _load(self, device: str): function set_requires_grad (line 140) | def set_requires_grad(module, value): function get_activation (line 144) | def get_activation(kind='tanh'): class FFCSE_block (line 154) | class FFCSE_block(nn.Module): method __init__ (line 156) | def __init__(self, channels, ratio_g): method forward (line 172) | def forward(self, x): class FourierUnit (line 187) | class FourierUnit(nn.Module): method __init__ (line 189) | def __init__(self, in_channels, out_channels, groups=1, spatial_scale_... method forward (line 214) | def forward(self, x): class SpectralTransform (line 260) | class SpectralTransform(nn.Module): method __init__ (line 262) | def __init__(self, in_channels, out_channels, stride=1, groups=1, enab... method forward (line 286) | def forward(self, x): class FFC (line 310) | class FFC(nn.Module): method __init__ (line 312) | def __init__(self, in_channels, out_channels, kernel_size, method forward (line 349) | def forward(self, x): class FFC_BN_ACT (line 372) | class FFC_BN_ACT(nn.Module): method __init__ (line 374) | def __init__(self, in_channels, out_channels, method forward (line 395) | def forward(self, x): class FFCResnetBlock (line 402) | class FFCResnetBlock(nn.Module): method __init__ (line 403) | def __init__(self, dim, padding_type, norm_layer, activation_layer=nn.... method forward (line 421) | def forward(self, x): class MaskedSinusoidalPositionalEmbedding (line 439) | class MaskedSinusoidalPositionalEmbedding(nn.Embedding): method __init__ (line 442) | def __init__(self, num_embeddings: int, embedding_dim: int): method _init_weight (line 447) | def _init_weight(out: nn.Parameter): method forward (line 464) | def forward(self, input_ids): class MultiLabelEmbedding (line 469) | class MultiLabelEmbedding(nn.Module): method __init__ (line 470) | def __init__(self, num_positions: int, embedding_dim: int): method reset_parameters (line 475) | def reset_parameters(self): method forward (line 478) | def forward(self, input_ids): class NLayerDiscriminator (line 484) | class NLayerDiscriminator(nn.Module): method __init__ (line 485) | def __init__(self, input_nc=3, ndf=64, n_layers=4, norm_layer=nn.Batch... method get_all_activations (line 523) | def get_all_activations(self, x): method forward (line 530) | def forward(self, x): class ConcatTupleLayer (line 535) | class ConcatTupleLayer(nn.Module): method forward (line 536) | def forward(self, x): class FFCResNetGenerator (line 545) | class FFCResNetGenerator(nn.Module): method __init__ (line 546) | def __init__(self, input_nc=4, output_nc=3, ngf=64, n_downsampling=3, ... method forward (line 603) | def forward(self, img, mask, rel_pos=None, direct=None) -> Tensor: class MPE (line 616) | class MPE(nn.Module): method __init__ (line 617) | def __init__(self): method forward (line 625) | def forward(self, rel_pos=None, direct=None): class LamaFourier (line 636) | class LamaFourier: method __init__ (line 637) | def __init__(self, build_discriminator=True, use_mpe=False, large_arch... method train_generator (line 668) | def train_generator(self): method train_discriminator (line 679) | def train_discriminator(self): method to (line 690) | def to(self, device): method eval (line 698) | def eval(self): method cuda (line 705) | def cuda(self): method __call__ (line 713) | def __call__(self, img: Tensor, mask: Tensor, rel_pos=None, direct=None): method load_masked_position_encoding (line 751) | def load_masked_position_encoding(self, mask): function load_lama_mpe (line 818) | def load_lama_mpe(model_path, device, use_mpe: bool = True, large_arch: ... FILE: manga_translator/inpainting/inpainting_sd.py function get_state_dict (line 19) | def get_state_dict(d): function load_state_dict (line 22) | def load_state_dict(ckpt_path, location='cpu'): function create_model (line 33) | def create_model(config_path): function load_ldm_sd (line 39) | def load_ldm_sd(model, path) : class StableDiffusionInpainter (line 46) | class StableDiffusionInpainter(OfflineInpainter): method __init__ (line 65) | def __init__(self, *args, **kwargs): method _load (line 69) | async def _load(self, device: str): method _unload (line 78) | async def _unload(self): method _infer (line 82) | async def _infer(self, image: np.ndarray, mask: np.ndarray, inpainting... FILE: manga_translator/inpainting/ldm/data/util.py class AddMiDaS (line 6) | class AddMiDaS(object): method __init__ (line 7) | def __init__(self, model_type): method pt2np (line 11) | def pt2np(self, x): method np2pt (line 15) | def np2pt(self, x): method __call__ (line 19) | def __call__(self, sample): FILE: manga_translator/inpainting/ldm/models/autoencoder.py class VQModel (line 12) | class VQModel(pl.LightningModule): method __init__ (line 13) | def __init__(self, method ema_scope (line 62) | def ema_scope(self, context=None): method init_from_ckpt (line 76) | def init_from_ckpt(self, path, ignore_keys=list()): method on_train_batch_end (line 90) | def on_train_batch_end(self, *args, **kwargs): method encode (line 94) | def encode(self, x): method encode_to_prequant (line 100) | def encode_to_prequant(self, x): method decode (line 105) | def decode(self, quant): method decode_code (line 110) | def decode_code(self, code_b): method forward (line 115) | def forward(self, input, return_pred_indices=False): method get_input (line 122) | def get_input(self, batch, k): method training_step (line 140) | def training_step(self, batch, batch_idx, optimizer_idx): method validation_step (line 162) | def validation_step(self, batch, batch_idx): method _validation_step (line 168) | def _validation_step(self, batch, batch_idx, suffix=""): method configure_optimizers (line 195) | def configure_optimizers(self): method get_last_layer (line 228) | def get_last_layer(self): method log_images (line 231) | def log_images(self, batch, only_inputs=False, plot_ema=False, **kwargs): method to_rgb (line 253) | def to_rgb(self, x): class VQModelInterface (line 261) | class VQModelInterface(VQModel): method __init__ (line 262) | def __init__(self, embed_dim, *args, **kwargs): method encode (line 266) | def encode(self, x): method decode (line 271) | def decode(self, h, force_not_quantize=False): class AutoencoderKL (line 281) | class AutoencoderKL(pl.LightningModule): method __init__ (line 282) | def __init__(self, method init_from_ckpt (line 320) | def init_from_ckpt(self, path, ignore_keys=list()): method ema_scope (line 332) | def ema_scope(self, context=None): method on_train_batch_end (line 346) | def on_train_batch_end(self, *args, **kwargs): method encode (line 350) | def encode(self, x): method decode (line 356) | def decode(self, z): method forward (line 361) | def forward(self, input, sample_posterior=True): method get_input (line 370) | def get_input(self, batch, k): method training_step (line 377) | def training_step(self, batch, batch_idx, optimizer_idx): method validation_step (line 398) | def validation_step(self, batch, batch_idx): method _validation_step (line 404) | def _validation_step(self, batch, batch_idx, postfix=""): method configure_optimizers (line 418) | def configure_optimizers(self): method get_last_layer (line 431) | def get_last_layer(self): method log_images (line 435) | def log_images(self, batch, only_inputs=False, log_ema=False, **kwargs): method to_rgb (line 460) | def to_rgb(self, x): class IdentityFirstStage (line 469) | class IdentityFirstStage(torch.nn.Module): method __init__ (line 470) | def __init__(self, *args, vq_interface=False, **kwargs): method encode (line 474) | def encode(self, x, *args, **kwargs): method decode (line 477) | def decode(self, x, *args, **kwargs): method quantize (line 480) | def quantize(self, x, *args, **kwargs): method forward (line 485) | def forward(self, x, *args, **kwargs): FILE: manga_translator/inpainting/ldm/models/diffusion/ddim.py class DDIMSampler (line 10) | class DDIMSampler(object): method __init__ (line 11) | def __init__(self, model, schedule="linear", **kwargs): method register_buffer (line 17) | def register_buffer(self, name, attr): method make_schedule (line 23) | def make_schedule(self, ddim_num_steps, ddim_discretize="uniform", ddi... method sample (line 55) | def sample(self, method ddim_sampling (line 123) | def ddim_sampling(self, cond, shape, method p_sample_ddim (line 181) | def p_sample_ddim(self, x, c, t, index, repeat_noise=False, use_origin... method encode (line 254) | def encode(self, x0, c, t_enc, use_original_steps=False, return_interm... method stochastic_encode (line 301) | def stochastic_encode(self, x0, t, use_original_steps=False, noise=None): method decode (line 317) | def decode(self, x_latent, cond, t_start, unconditional_guidance_scale... FILE: manga_translator/inpainting/ldm/models/diffusion/ddpm.py function disabled_train (line 36) | def disabled_train(self, mode=True): function uniform_on_device (line 42) | def uniform_on_device(r1, r2, shape, device): class DDPM (line 46) | class DDPM(pl.LightningModule): method __init__ (line 48) | def __init__(self, method register_schedule (line 138) | def register_schedule(self, given_betas=None, beta_schedule="linear", ... method ema_scope (line 195) | def ema_scope(self, context=None): method init_from_ckpt (line 210) | def init_from_ckpt(self, path, ignore_keys=list(), only_model=False): method q_mean_variance (line 272) | def q_mean_variance(self, x_start, t): method predict_start_from_noise (line 284) | def predict_start_from_noise(self, x_t, t, noise): method predict_start_from_z_and_v (line 290) | def predict_start_from_z_and_v(self, x_t, t, v): method predict_eps_from_z_and_v (line 298) | def predict_eps_from_z_and_v(self, x_t, t, v): method q_posterior (line 304) | def q_posterior(self, x_start, x_t, t): method p_mean_variance (line 313) | def p_mean_variance(self, x, t, clip_denoised: bool): method p_sample (line 326) | def p_sample(self, x, t, clip_denoised=True, repeat_noise=False): method p_sample_loop (line 335) | def p_sample_loop(self, shape, return_intermediates=False): method sample (line 350) | def sample(self, batch_size=16, return_intermediates=False): method q_sample (line 356) | def q_sample(self, x_start, t, noise=None): method get_v (line 361) | def get_v(self, x, noise, t): method get_loss (line 367) | def get_loss(self, pred, target, mean=True): method p_losses (line 382) | def p_losses(self, x_start, t, noise=None): method forward (line 413) | def forward(self, x, *args, **kwargs): method get_input (line 419) | def get_input(self, batch, k): method shared_step (line 427) | def shared_step(self, batch): method training_step (line 432) | def training_step(self, batch, batch_idx): method validation_step (line 457) | def validation_step(self, batch, batch_idx): method on_train_batch_end (line 465) | def on_train_batch_end(self, *args, **kwargs): method _get_rows_from_list (line 469) | def _get_rows_from_list(self, samples): method log_images (line 477) | def log_images(self, batch, N=8, n_row=2, sample=True, return_keys=Non... method configure_optimizers (line 514) | def configure_optimizers(self): class LatentDiffusion (line 523) | class LatentDiffusion(DDPM): method __init__ (line 526) | def __init__(self, method make_cond_schedule (line 584) | def make_cond_schedule(self, ): method on_train_batch_start (line 591) | def on_train_batch_start(self, batch, batch_idx, dataloader_idx): method register_schedule (line 606) | def register_schedule(self, method instantiate_first_stage (line 615) | def instantiate_first_stage(self, config): method instantiate_cond_stage (line 622) | def instantiate_cond_stage(self, config): method _get_denoise_row_from_list (line 643) | def _get_denoise_row_from_list(self, samples, desc='', force_no_decode... method get_first_stage_encoding (line 655) | def get_first_stage_encoding(self, encoder_posterior): method get_learned_conditioning (line 664) | def get_learned_conditioning(self, c): method meshgrid (line 677) | def meshgrid(self, h, w): method delta_border (line 684) | def delta_border(self, h, w): method get_weighting (line 698) | def get_weighting(self, h, w, Ly, Lx, device): method get_fold_unfold (line 714) | def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo... method get_input (line 767) | def get_input(self, batch, k, return_first_stage_outputs=False, force_... method decode_first_stage (line 820) | def decode_first_stage(self, z, predict_cids=False, force_not_quantize... method decode_first_stage_with_grad (line 830) | def decode_first_stage_with_grad(self, z, predict_cids=False, force_no... method encode_first_stage (line 893) | def encode_first_stage(self, x): method shared_step (line 896) | def shared_step(self, batch, **kwargs): method forward (line 901) | def forward(self, x, c, *args, **kwargs): method apply_model (line 912) | def apply_model(self, x_noisy, t, cond, return_ids=False): method _predict_eps_from_xstart (line 929) | def _predict_eps_from_xstart(self, x_t, t, pred_xstart): method _prior_bpd (line 933) | def _prior_bpd(self, x_start): method p_losses (line 947) | def p_losses(self, x_start, cond, t, noise=None): method p_mean_variance (line 984) | def p_mean_variance(self, x, c, t, clip_denoised: bool, return_codeboo... method p_sample (line 1016) | def p_sample(self, x, c, t, clip_denoised=False, repeat_noise=False, method progressive_denoising (line 1047) | def progressive_denoising(self, cond, shape, verbose=True, callback=No... method p_sample_loop (line 1103) | def p_sample_loop(self, cond, shape, return_intermediates=False, method sample (line 1154) | def sample(self, cond, batch_size=16, return_intermediates=False, x_T=... method sample_log (line 1172) | def sample_log(self, cond, batch_size, ddim, ddim_steps, **kwargs): method get_unconditional_conditioning (line 1186) | def get_unconditional_conditioning(self, batch_size, null_label=None): method log_images (line 1211) | def log_images(self, batch, N=8, n_row=4, sample=True, ddim_steps=50, ... method configure_optimizers (line 1340) | def configure_optimizers(self): method to_rgb (line 1365) | def to_rgb(self, x): class DiffusionWrapper (line 1374) | class DiffusionWrapper(pl.LightningModule): method __init__ (line 1375) | def __init__(self, diff_model_config, conditioning_key): method forward (line 1382) | def forward(self, x, t, c_concat: list = None, c_crossattn: list = Non... class LatentUpscaleDiffusion (line 1416) | class LatentUpscaleDiffusion(LatentDiffusion): method __init__ (line 1417) | def __init__(self, *args, low_scale_config, low_scale_key="LR", noise_... method instantiate_low_stage (line 1425) | def instantiate_low_stage(self, config): method get_input (line 1433) | def get_input(self, batch, k, cond_key=None, bs=None, log_mode=False): method log_images (line 1455) | def log_images(self, batch, N=8, n_row=4, sample=True, ddim_steps=200,... class LatentFinetuneDiffusion (line 1554) | class LatentFinetuneDiffusion(LatentDiffusion): method __init__ (line 1560) | def __init__(self, method init_from_ckpt (line 1583) | def init_from_ckpt(self, path, ignore_keys=list(), only_model=False): method log_images (line 1615) | def log_images(self, batch, N=8, n_row=4, sample=True, ddim_steps=200,... class LatentInpaintDiffusion (line 1696) | class LatentInpaintDiffusion(LatentFinetuneDiffusion): method __init__ (line 1703) | def __init__(self, method get_input (line 1713) | def get_input(self, batch, k, cond_key=None, bs=None, return_first_sta... method log_images (line 1739) | def log_images(self, *args, **kwargs): class LatentDepth2ImageDiffusion (line 1746) | class LatentDepth2ImageDiffusion(LatentFinetuneDiffusion): method __init__ (line 1751) | def __init__(self, depth_stage_config, concat_keys=("midas_in",), *arg... method get_input (line 1757) | def get_input(self, batch, k, cond_key=None, bs=None, return_first_sta... method log_images (line 1790) | def log_images(self, *args, **kwargs): class LatentUpscaleFinetuneDiffusion (line 1799) | class LatentUpscaleFinetuneDiffusion(LatentFinetuneDiffusion): method __init__ (line 1803) | def __init__(self, concat_keys=("lr",), reshuffle_patch_size=None, method instantiate_low_stage (line 1814) | def instantiate_low_stage(self, config): method get_input (line 1822) | def get_input(self, batch, k, cond_key=None, bs=None, return_first_sta... method log_images (line 1856) | def log_images(self, *args, **kwargs): FILE: manga_translator/inpainting/ldm/models/diffusion/dpm_solver/dpm_solver.py class NoiseScheduleVP (line 7) | class NoiseScheduleVP: method __init__ (line 8) | def __init__( method marginal_log_mean_coeff (line 106) | def marginal_log_mean_coeff(self, t): method marginal_alpha (line 120) | def marginal_alpha(self, t): method marginal_std (line 126) | def marginal_std(self, t): method marginal_lambda (line 132) | def marginal_lambda(self, t): method inverse_lambda (line 140) | def inverse_lambda(self, lamb): function model_wrapper (line 161) | def model_wrapper( class DPM_Solver (line 319) | class DPM_Solver: method __init__ (line 320) | def __init__(self, model_fn, noise_schedule, predict_x0=False, thresho... method noise_prediction_fn (line 346) | def noise_prediction_fn(self, x, t): method data_prediction_fn (line 352) | def data_prediction_fn(self, x, t): method model_fn (line 367) | def model_fn(self, x, t): method get_time_steps (line 376) | def get_time_steps(self, skip_type, t_T, t_0, N, device): method get_orders_and_timesteps_for_singlestep_solver (line 405) | def get_orders_and_timesteps_for_singlestep_solver(self, steps, order,... method denoise_to_zero_fn (line 463) | def denoise_to_zero_fn(self, x, s): method dpm_solver_first_update (line 469) | def dpm_solver_first_update(self, x, s, t, model_s=None, return_interm... method singlestep_dpm_solver_second_update (line 515) | def singlestep_dpm_solver_second_update(self, x, s, t, r1=0.5, model_s... method singlestep_dpm_solver_third_update (line 599) | def singlestep_dpm_solver_third_update(self, x, s, t, r1=1. / 3., r2=2... method multistep_dpm_solver_second_update (line 723) | def multistep_dpm_solver_second_update(self, x, model_prev_list, t_pre... method multistep_dpm_solver_third_update (line 780) | def multistep_dpm_solver_third_update(self, x, model_prev_list, t_prev... method singlestep_dpm_solver_update (line 827) | def singlestep_dpm_solver_update(self, x, s, t, order, return_intermed... method multistep_dpm_solver_update (line 855) | def multistep_dpm_solver_update(self, x, model_prev_list, t_prev_list,... method dpm_solver_adaptive (line 878) | def dpm_solver_adaptive(self, x, order, t_T, t_0, h_init=0.05, atol=0.... method sample (line 939) | def sample(self, x, steps=20, t_start=None, t_end=None, order=3, skip_... function interpolate_fn (line 1104) | def interpolate_fn(x, xp, yp): function expand_dims (line 1145) | def expand_dims(v, dims): FILE: manga_translator/inpainting/ldm/models/diffusion/dpm_solver/sampler.py class DPMSolverSampler (line 13) | class DPMSolverSampler(object): method __init__ (line 14) | def __init__(self, model, **kwargs): method register_buffer (line 20) | def register_buffer(self, name, attr): method sample (line 27) | def sample(self, FILE: manga_translator/inpainting/ldm/models/diffusion/plms.py class PLMSSampler (line 12) | class PLMSSampler(object): method __init__ (line 13) | def __init__(self, model, schedule="linear", **kwargs): method register_buffer (line 19) | def register_buffer(self, name, attr): method make_schedule (line 25) | def make_schedule(self, ddim_num_steps, ddim_discretize="uniform", ddi... method sample (line 59) | def sample(self, method plms_sampling (line 118) | def plms_sampling(self, cond, shape, method p_sample_plms (line 178) | def p_sample_plms(self, x, c, t, index, repeat_noise=False, use_origin... FILE: manga_translator/inpainting/ldm/models/diffusion/sampling_util.py function append_dims (line 5) | def append_dims(x, target_dims): function norm_thresholding (line 14) | def norm_thresholding(x0, value): function spatial_norm_thresholding (line 19) | def spatial_norm_thresholding(x0, value): FILE: manga_translator/inpainting/ldm/modules/attention.py function exists (line 23) | def exists(val): function uniq (line 27) | def uniq(arr): function default (line 31) | def default(val, d): function max_neg_value (line 37) | def max_neg_value(t): function init_ (line 41) | def init_(tensor): class GEGLU (line 49) | class GEGLU(nn.Module): method __init__ (line 50) | def __init__(self, dim_in, dim_out): method forward (line 54) | def forward(self, x): class FeedForward (line 59) | class FeedForward(nn.Module): method __init__ (line 60) | def __init__(self, dim, dim_out=None, mult=4, glu=False, dropout=0.): method forward (line 75) | def forward(self, x): function zero_module (line 79) | def zero_module(module): function Normalize (line 88) | def Normalize(in_channels): class SpatialSelfAttention (line 92) | class SpatialSelfAttention(nn.Module): method __init__ (line 93) | def __init__(self, in_channels): method forward (line 119) | def forward(self, x): class CrossAttention (line 145) | class CrossAttention(nn.Module): method __init__ (line 146) | def __init__(self, query_dim, context_dim=None, heads=8, dim_head=64, ... method forward (line 163) | def forward(self, x, context=None, mask=None): class MemoryEfficientCrossAttention (line 197) | class MemoryEfficientCrossAttention(nn.Module): method __init__ (line 199) | def __init__(self, query_dim, context_dim=None, heads=8, dim_head=64, ... method forward (line 216) | def forward(self, x, context=None, mask=None): class BasicTransformerBlock (line 246) | class BasicTransformerBlock(nn.Module): method __init__ (line 251) | def __init__(self, dim, n_heads, d_head, dropout=0., context_dim=None,... method forward (line 268) | def forward(self, x, context=None): method _forward (line 271) | def _forward(self, x, context=None): class SpatialTransformer (line 278) | class SpatialTransformer(nn.Module): method __init__ (line 287) | def __init__(self, in_channels, n_heads, d_head, method forward (line 321) | def forward(self, x, context=None): FILE: manga_translator/inpainting/ldm/modules/diffusionmodules/model.py function get_timestep_embedding (line 20) | def get_timestep_embedding(timesteps, embedding_dim): function nonlinearity (line 41) | def nonlinearity(x): function Normalize (line 46) | def Normalize(in_channels, num_groups=32): class Upsample (line 50) | class Upsample(nn.Module): method __init__ (line 51) | def __init__(self, in_channels, with_conv): method forward (line 61) | def forward(self, x): class Downsample (line 68) | class Downsample(nn.Module): method __init__ (line 69) | def __init__(self, in_channels, with_conv): method forward (line 80) | def forward(self, x): class ResnetBlock (line 90) | class ResnetBlock(nn.Module): method __init__ (line 91) | def __init__(self, *, in_channels, out_channels=None, conv_shortcut=Fa... method forward (line 129) | def forward(self, x, temb): class AttnBlock (line 152) | class AttnBlock(nn.Module): method __init__ (line 153) | def __init__(self, in_channels): method forward (line 179) | def forward(self, x): class MemoryEfficientAttnBlock (line 205) | class MemoryEfficientAttnBlock(nn.Module): method __init__ (line 212) | def __init__(self, in_channels): method forward (line 239) | def forward(self, x): class MemoryEfficientCrossAttentionWrapper (line 271) | class MemoryEfficientCrossAttentionWrapper(MemoryEfficientCrossAttention): method forward (line 272) | def forward(self, x, context=None, mask=None): function make_attn (line 280) | def make_attn(in_channels, attn_type="vanilla", attn_kwargs=None): class Model (line 300) | class Model(nn.Module): method __init__ (line 301) | def __init__(self, *, ch, out_ch, ch_mult=(1,2,4,8), num_res_blocks, method forward (line 400) | def forward(self, x, t=None, context=None): method get_last_layer (line 448) | def get_last_layer(self): class Encoder (line 452) | class Encoder(nn.Module): method __init__ (line 453) | def __init__(self, *, ch, out_ch, ch_mult=(1,2,4,8), num_res_blocks, method forward (line 518) | def forward(self, x): class Decoder (line 546) | class Decoder(nn.Module): method __init__ (line 547) | def __init__(self, *, ch, out_ch, ch_mult=(1,2,4,8), num_res_blocks, method forward (line 619) | def forward(self, z): class SimpleDecoder (line 655) | class SimpleDecoder(nn.Module): method __init__ (line 656) | def __init__(self, in_channels, out_channels, *args, **kwargs): method forward (line 678) | def forward(self, x): class UpsampleDecoder (line 691) | class UpsampleDecoder(nn.Module): method __init__ (line 692) | def __init__(self, in_channels, out_channels, ch, num_res_blocks, reso... method forward (line 725) | def forward(self, x): class LatentRescaler (line 739) | class LatentRescaler(nn.Module): method __init__ (line 740) | def __init__(self, factor, in_channels, mid_channels, out_channels, de... method forward (line 764) | def forward(self, x): class MergedRescaleEncoder (line 776) | class MergedRescaleEncoder(nn.Module): method __init__ (line 777) | def __init__(self, in_channels, ch, resolution, out_ch, num_res_blocks, method forward (line 789) | def forward(self, x): class MergedRescaleDecoder (line 795) | class MergedRescaleDecoder(nn.Module): method __init__ (line 796) | def __init__(self, z_channels, out_ch, resolution, num_res_blocks, att... method forward (line 806) | def forward(self, x): class Upsampler (line 812) | class Upsampler(nn.Module): method __init__ (line 813) | def __init__(self, in_size, out_size, in_channels, out_channels, ch_mu... method forward (line 825) | def forward(self, x): class Resize (line 831) | class Resize(nn.Module): method __init__ (line 832) | def __init__(self, in_channels=None, learned=False, mode="bilinear"): method forward (line 847) | def forward(self, x, scale_factor=1.0): FILE: manga_translator/inpainting/ldm/modules/diffusionmodules/openaimodel.py function convert_module_to_f16 (line 23) | def convert_module_to_f16(x): function convert_module_to_f32 (line 26) | def convert_module_to_f32(x): class AttentionPool2d (line 31) | class AttentionPool2d(nn.Module): method __init__ (line 36) | def __init__( method forward (line 50) | def forward(self, x): class TimestepBlock (line 61) | class TimestepBlock(nn.Module): method forward (line 67) | def forward(self, x, emb): class TimestepEmbedSequential (line 73) | class TimestepEmbedSequential(nn.Sequential, TimestepBlock): method forward (line 79) | def forward(self, x, emb, context=None): class Upsample (line 90) | class Upsample(nn.Module): method __init__ (line 99) | def __init__(self, channels, use_conv, dims=2, out_channels=None, padd... method forward (line 108) | def forward(self, x): class TransposedUpsample (line 120) | class TransposedUpsample(nn.Module): method __init__ (line 122) | def __init__(self, channels, out_channels=None, ks=5): method forward (line 129) | def forward(self,x): class Downsample (line 133) | class Downsample(nn.Module): method __init__ (line 142) | def __init__(self, channels, use_conv, dims=2, out_channels=None,paddi... method forward (line 157) | def forward(self, x): class ResBlock (line 162) | class ResBlock(TimestepBlock): method __init__ (line 178) | def __init__( method forward (line 242) | def forward(self, x, emb): method _forward (line 254) | def _forward(self, x, emb): class AttentionBlock (line 277) | class AttentionBlock(nn.Module): method __init__ (line 284) | def __init__( method forward (line 313) | def forward(self, x): method _forward (line 317) | def _forward(self, x): function count_flops_attn (line 326) | def count_flops_attn(model, _x, y): class QKVAttentionLegacy (line 346) | class QKVAttentionLegacy(nn.Module): method __init__ (line 351) | def __init__(self, n_heads): method forward (line 355) | def forward(self, qkv): method count_flops (line 374) | def count_flops(model, _x, y): class QKVAttention (line 378) | class QKVAttention(nn.Module): method __init__ (line 383) | def __init__(self, n_heads): method forward (line 387) | def forward(self, qkv): method count_flops (line 408) | def count_flops(model, _x, y): class UNetModel (line 412) | class UNetModel(nn.Module): method __init__ (line 442) | def __init__( method convert_to_fp16 (line 738) | def convert_to_fp16(self): method convert_to_fp32 (line 746) | def convert_to_fp32(self): method forward (line 754) | def forward(self, x, timesteps=None, context=None, y=None,**kwargs): FILE: manga_translator/inpainting/ldm/modules/diffusionmodules/upscaling.py class AbstractLowScaleModel (line 10) | class AbstractLowScaleModel(nn.Module): method __init__ (line 12) | def __init__(self, noise_schedule_config=None): method register_schedule (line 17) | def register_schedule(self, beta_schedule="linear", timesteps=1000, method q_sample (line 44) | def q_sample(self, x_start, t, noise=None): method forward (line 49) | def forward(self, x): method decode (line 52) | def decode(self, x): class SimpleImageConcat (line 56) | class SimpleImageConcat(AbstractLowScaleModel): method __init__ (line 58) | def __init__(self): method forward (line 62) | def forward(self, x): class ImageConcatWithNoiseAugmentation (line 67) | class ImageConcatWithNoiseAugmentation(AbstractLowScaleModel): method __init__ (line 68) | def __init__(self, noise_schedule_config, max_noise_level=1000, to_cud... method forward (line 72) | def forward(self, x, noise_level=None): FILE: manga_translator/inpainting/ldm/modules/diffusionmodules/util.py function make_beta_schedule (line 21) | def make_beta_schedule(schedule, n_timestep, linear_start=1e-4, linear_e... function make_ddim_timesteps (line 46) | def make_ddim_timesteps(ddim_discr_method, num_ddim_timesteps, num_ddpm_... function make_ddim_sampling_parameters (line 63) | def make_ddim_sampling_parameters(alphacums, ddim_timesteps, eta, verbos... function betas_for_alpha_bar (line 77) | def betas_for_alpha_bar(num_diffusion_timesteps, alpha_bar, max_beta=0.9... function extract_into_tensor (line 96) | def extract_into_tensor(a, t, x_shape): function checkpoint (line 102) | def checkpoint(func, inputs, params, flag): class CheckpointFunction (line 119) | class CheckpointFunction(torch.autograd.Function): method forward (line 121) | def forward(ctx, run_function, length, *args): method backward (line 133) | def backward(ctx, *output_grads): function timestep_embedding (line 154) | def timestep_embedding(timesteps, dim, max_period=10000, repeat_only=Fal... function zero_module (line 177) | def zero_module(module): function scale_module (line 186) | def scale_module(module, scale): function mean_flat (line 195) | def mean_flat(tensor): function normalization (line 202) | def normalization(channels): class SiLU (line 212) | class SiLU(nn.Module): method forward (line 213) | def forward(self, x): class GroupNorm32 (line 217) | class GroupNorm32(nn.GroupNorm): method forward (line 218) | def forward(self, x): function conv_nd (line 221) | def conv_nd(dims, *args, **kwargs): function linear (line 234) | def linear(*args, **kwargs): function avg_pool_nd (line 241) | def avg_pool_nd(dims, *args, **kwargs): class HybridConditioner (line 254) | class HybridConditioner(nn.Module): method __init__ (line 256) | def __init__(self, c_concat_config, c_crossattn_config): method forward (line 261) | def forward(self, c_concat, c_crossattn): function noise_like (line 267) | def noise_like(shape, device, repeat=False): FILE: manga_translator/inpainting/ldm/modules/distributions/distributions.py class AbstractDistribution (line 5) | class AbstractDistribution: method sample (line 6) | def sample(self): method mode (line 9) | def mode(self): class DiracDistribution (line 13) | class DiracDistribution(AbstractDistribution): method __init__ (line 14) | def __init__(self, value): method sample (line 17) | def sample(self): method mode (line 20) | def mode(self): class DiagonalGaussianDistribution (line 24) | class DiagonalGaussianDistribution(object): method __init__ (line 25) | def __init__(self, parameters, deterministic=False): method sample (line 35) | def sample(self): method kl (line 39) | def kl(self, other=None): method nll (line 53) | def nll(self, sample, dims=[1,2,3]): method mode (line 61) | def mode(self): function normal_kl (line 65) | def normal_kl(mean1, logvar1, mean2, logvar2): FILE: manga_translator/inpainting/ldm/modules/ema.py class LitEma (line 5) | class LitEma(nn.Module): method __init__ (line 6) | def __init__(self, model, decay=0.9999, use_num_updates=True): method reset_num_updates (line 25) | def reset_num_updates(self): method forward (line 29) | def forward(self, model): method copy_to (line 50) | def copy_to(self, model): method store (line 59) | def store(self, parameters): method restore (line 68) | def restore(self, parameters): FILE: manga_translator/inpainting/ldm/modules/encoders/modules.py class AbstractEncoder (line 11) | class AbstractEncoder(nn.Module): method __init__ (line 12) | def __init__(self): method encode (line 15) | def encode(self, *args, **kwargs): class IdentityEncoder (line 19) | class IdentityEncoder(AbstractEncoder): method encode (line 21) | def encode(self, x): class ClassEmbedder (line 25) | class ClassEmbedder(nn.Module): method __init__ (line 26) | def __init__(self, embed_dim, n_classes=1000, key='class', ucg_rate=0.1): method forward (line 33) | def forward(self, batch, key=None, disable_dropout=False): method get_unconditional_conditioning (line 45) | def get_unconditional_conditioning(self, bs, device="cuda"): function disabled_train (line 52) | def disabled_train(self, mode=True): class FrozenT5Embedder (line 58) | class FrozenT5Embedder(AbstractEncoder): method __init__ (line 60) | def __init__(self, version="google/t5-v1_1-large", device="cuda", max_... method freeze (line 69) | def freeze(self): method forward (line 75) | def forward(self, text): method encode (line 84) | def encode(self, text): class FrozenCLIPEmbedder (line 88) | class FrozenCLIPEmbedder(AbstractEncoder): method __init__ (line 95) | def __init__(self, version="openai/clip-vit-large-patch14", device="cu... method freeze (line 111) | def freeze(self): method forward (line 117) | def forward(self, text): method encode (line 130) | def encode(self, text): class FrozenOpenCLIPEmbedder (line 134) | class FrozenOpenCLIPEmbedder(AbstractEncoder): method __init__ (line 143) | def __init__(self, arch="ViT-H-14", version="laion2b_s32b_b79k", devic... method freeze (line 163) | def freeze(self): method forward (line 168) | def forward(self, text): method encode_with_transformer (line 173) | def encode_with_transformer(self, text): method text_transformer_forward (line 182) | def text_transformer_forward(self, x: torch.Tensor, attn_mask = None): method encode (line 192) | def encode(self, text): class FrozenCLIPT5Encoder (line 196) | class FrozenCLIPT5Encoder(AbstractEncoder): method __init__ (line 197) | def __init__(self, clip_version="openai/clip-vit-large-patch14", t5_ve... method encode (line 205) | def encode(self, text): method forward (line 208) | def forward(self, text): FILE: manga_translator/inpainting/ldm/modules/image_degradation/bsrgan.py function modcrop_np (line 29) | def modcrop_np(img, sf): function analytic_kernel (line 49) | def analytic_kernel(k): function anisotropic_Gaussian (line 65) | def anisotropic_Gaussian(ksize=15, theta=np.pi, l1=6, l2=6): function gm_blur_kernel (line 86) | def gm_blur_kernel(mean, cov, size=15): function shift_pixel (line 99) | def shift_pixel(x, sf, upper_left=True): function blur (line 128) | def blur(x, k): function gen_kernel (line 145) | def gen_kernel(k_size=np.array([15, 15]), scale_factor=np.array([4, 4]),... function fspecial_gaussian (line 187) | def fspecial_gaussian(hsize, sigma): function fspecial_laplacian (line 201) | def fspecial_laplacian(alpha): function fspecial (line 210) | def fspecial(filter_type, *args, **kwargs): function bicubic_degradation (line 228) | def bicubic_degradation(x, sf=3): function srmd_degradation (line 240) | def srmd_degradation(x, k, sf=3): function dpsr_degradation (line 262) | def dpsr_degradation(x, k, sf=3): function classical_degradation (line 284) | def classical_degradation(x, k, sf=3): function add_sharpening (line 299) | def add_sharpening(img, weight=0.5, radius=50, threshold=10): function add_blur (line 325) | def add_blur(img, sf=4): function add_resize (line 339) | def add_resize(img, sf=4): function add_Gaussian_noise (line 369) | def add_Gaussian_noise(img, noise_level1=2, noise_level2=25): function add_speckle_noise (line 386) | def add_speckle_noise(img, noise_level1=2, noise_level2=25): function add_Poisson_noise (line 404) | def add_Poisson_noise(img): function add_JPEG_noise (line 418) | def add_JPEG_noise(img): function random_crop (line 427) | def random_crop(lq, hq, sf=4, lq_patchsize=64): function degradation_bsrgan (line 438) | def degradation_bsrgan(img, sf=4, lq_patchsize=72, isp_model=None): function degradation_bsrgan_variant (line 530) | def degradation_bsrgan_variant(image, sf=4, isp_model=None): function degradation_bsrgan_plus (line 617) | def degradation_bsrgan_plus(img, sf=4, shuffle_prob=0.5, use_sharp=True,... FILE: manga_translator/inpainting/ldm/modules/image_degradation/bsrgan_light.py function modcrop_np (line 28) | def modcrop_np(img, sf): function analytic_kernel (line 48) | def analytic_kernel(k): function anisotropic_Gaussian (line 64) | def anisotropic_Gaussian(ksize=15, theta=np.pi, l1=6, l2=6): function gm_blur_kernel (line 85) | def gm_blur_kernel(mean, cov, size=15): function shift_pixel (line 98) | def shift_pixel(x, sf, upper_left=True): function blur (line 127) | def blur(x, k): function gen_kernel (line 144) | def gen_kernel(k_size=np.array([15, 15]), scale_factor=np.array([4, 4]),... function fspecial_gaussian (line 186) | def fspecial_gaussian(hsize, sigma): function fspecial_laplacian (line 200) | def fspecial_laplacian(alpha): function fspecial (line 209) | def fspecial(filter_type, *args, **kwargs): function bicubic_degradation (line 227) | def bicubic_degradation(x, sf=3): function srmd_degradation (line 239) | def srmd_degradation(x, k, sf=3): function dpsr_degradation (line 261) | def dpsr_degradation(x, k, sf=3): function classical_degradation (line 283) | def classical_degradation(x, k, sf=3): function add_sharpening (line 298) | def add_sharpening(img, weight=0.5, radius=50, threshold=10): function add_blur (line 324) | def add_blur(img, sf=4): function add_resize (line 342) | def add_resize(img, sf=4): function add_Gaussian_noise (line 372) | def add_Gaussian_noise(img, noise_level1=2, noise_level2=25): function add_speckle_noise (line 389) | def add_speckle_noise(img, noise_level1=2, noise_level2=25): function add_Poisson_noise (line 407) | def add_Poisson_noise(img): function add_JPEG_noise (line 421) | def add_JPEG_noise(img): function random_crop (line 430) | def random_crop(lq, hq, sf=4, lq_patchsize=64): function degradation_bsrgan (line 441) | def degradation_bsrgan(img, sf=4, lq_patchsize=72, isp_model=None): function degradation_bsrgan_variant (line 533) | def degradation_bsrgan_variant(image, sf=4, isp_model=None, up=False): FILE: manga_translator/inpainting/ldm/modules/image_degradation/utils_image.py function is_image_file (line 29) | def is_image_file(filename): function get_timestamp (line 33) | def get_timestamp(): function imshow (line 37) | def imshow(x, title=None, cbar=False, figsize=None): function surf (line 47) | def surf(Z, cmap='rainbow', figsize=None): function get_image_paths (line 67) | def get_image_paths(dataroot): function _get_paths_from_images (line 74) | def _get_paths_from_images(path): function patches_from_image (line 93) | def patches_from_image(img, p_size=512, p_overlap=64, p_max=800): function imssave (line 112) | def imssave(imgs, img_path): function split_imageset (line 125) | def split_imageset(original_dataroot, target_dataroot, n_channels=3, p_s... function mkdir (line 153) | def mkdir(path): function mkdirs (line 158) | def mkdirs(paths): function mkdir_and_rename (line 166) | def mkdir_and_rename(path): function imread_uint (line 185) | def imread_uint(path, n_channels=3): function imsave (line 203) | def imsave(img, img_path): function imwrite (line 209) | def imwrite(img, img_path): function read_img (line 220) | def read_img(path): function uint2single (line 249) | def uint2single(img): function single2uint (line 254) | def single2uint(img): function uint162single (line 259) | def uint162single(img): function single2uint16 (line 264) | def single2uint16(img): function uint2tensor4 (line 275) | def uint2tensor4(img): function uint2tensor3 (line 282) | def uint2tensor3(img): function tensor2uint (line 289) | def tensor2uint(img): function single2tensor3 (line 302) | def single2tensor3(img): function single2tensor4 (line 307) | def single2tensor4(img): function tensor2single (line 312) | def tensor2single(img): function tensor2single3 (line 320) | def tensor2single3(img): function single2tensor5 (line 329) | def single2tensor5(img): function single32tensor5 (line 333) | def single32tensor5(img): function single42tensor4 (line 337) | def single42tensor4(img): function tensor2img (line 342) | def tensor2img(tensor, out_type=np.uint8, min_max=(0, 1)): function augment_img (line 380) | def augment_img(img, mode=0): function augment_img_tensor4 (line 401) | def augment_img_tensor4(img, mode=0): function augment_img_tensor (line 422) | def augment_img_tensor(img, mode=0): function augment_img_np3 (line 441) | def augment_img_np3(img, mode=0): function augment_imgs (line 469) | def augment_imgs(img_list, hflip=True, rot=True): function modcrop (line 494) | def modcrop(img_in, scale): function shave (line 510) | def shave(img_in, border=0): function rgb2ycbcr (line 529) | def rgb2ycbcr(img, only_y=True): function ycbcr2rgb (line 553) | def ycbcr2rgb(img): function bgr2ycbcr (line 573) | def bgr2ycbcr(img, only_y=True): function channel_convert (line 597) | def channel_convert(in_c, tar_type, img_list): function calculate_psnr (line 621) | def calculate_psnr(img1, img2, border=0): function calculate_ssim (line 642) | def calculate_ssim(img1, img2, border=0): function ssim (line 669) | def ssim(img1, img2): function cubic (line 700) | def cubic(x): function calculate_weights_indices (line 708) | def calculate_weights_indices(in_length, out_length, scale, kernel, kern... function imresize (line 766) | def imresize(img, scale, antialiasing=True): function imresize_np (line 839) | def imresize_np(img, scale, antialiasing=True): FILE: manga_translator/inpainting/ldm/modules/midas/api.py function disabled_train (line 22) | def disabled_train(self, mode=True): function load_midas_transform (line 28) | def load_midas_transform(model_type): function load_model (line 73) | def load_model(model_type): class MiDaSInference (line 137) | class MiDaSInference(nn.Module): method __init__ (line 150) | def __init__(self, model_type): method forward (line 157) | def forward(self, x): FILE: manga_translator/inpainting/ldm/modules/midas/midas/base_model.py class BaseModel (line 4) | class BaseModel(torch.nn.Module): method load (line 5) | def load(self, path): FILE: manga_translator/inpainting/ldm/modules/midas/midas/blocks.py function _make_encoder (line 11) | def _make_encoder(backbone, features, use_pretrained, groups=1, expand=F... function _make_scratch (line 49) | def _make_scratch(in_shape, out_shape, groups=1, expand=False): function _make_pretrained_efficientnet_lite3 (line 78) | def _make_pretrained_efficientnet_lite3(use_pretrained, exportable=False): function _make_efficientnet_backbone (line 88) | def _make_efficientnet_backbone(effnet): function _make_resnet_backbone (line 101) | def _make_resnet_backbone(resnet): function _make_pretrained_resnext101_wsl (line 114) | def _make_pretrained_resnext101_wsl(use_pretrained): class Interpolate (line 120) | class Interpolate(nn.Module): method __init__ (line 124) | def __init__(self, scale_factor, mode, align_corners=False): method forward (line 138) | def forward(self, x): class ResidualConvUnit (line 155) | class ResidualConvUnit(nn.Module): method __init__ (line 159) | def __init__(self, features): method forward (line 177) | def forward(self, x): class FeatureFusionBlock (line 194) | class FeatureFusionBlock(nn.Module): method __init__ (line 198) | def __init__(self, features): method forward (line 209) | def forward(self, *xs): class ResidualConvUnit_custom (line 231) | class ResidualConvUnit_custom(nn.Module): method __init__ (line 235) | def __init__(self, features, activation, bn): method forward (line 263) | def forward(self, x): class FeatureFusionBlock_custom (line 291) | class FeatureFusionBlock_custom(nn.Module): method __init__ (line 295) | def __init__(self, features, activation, deconv=False, bn=False, expan... method forward (line 320) | def forward(self, *xs): FILE: manga_translator/inpainting/ldm/modules/midas/midas/dpt_depth.py function _make_fusion_block (line 15) | def _make_fusion_block(features, use_bn): class DPT (line 26) | class DPT(BaseModel): method __init__ (line 27) | def __init__( method forward (line 67) | def forward(self, x): class DPTDepthModel (line 88) | class DPTDepthModel(DPT): method __init__ (line 89) | def __init__(self, path=None, non_negative=True, **kwargs): method forward (line 107) | def forward(self, x): FILE: manga_translator/inpainting/ldm/modules/midas/midas/midas_net.py class MidasNet (line 12) | class MidasNet(BaseModel): method __init__ (line 16) | def __init__(self, path=None, features=256, non_negative=True): method forward (line 49) | def forward(self, x): FILE: manga_translator/inpainting/ldm/modules/midas/midas/midas_net_custom.py class MidasNet_small (line 12) | class MidasNet_small(BaseModel): method __init__ (line 16) | def __init__(self, path=None, features=64, backbone="efficientnet_lite... method forward (line 73) | def forward(self, x): function fuse_model (line 109) | def fuse_model(m): FILE: manga_translator/inpainting/ldm/modules/midas/midas/transforms.py function apply_min_size (line 6) | def apply_min_size(sample, size, image_interpolation_method=cv2.INTER_AR... class Resize (line 48) | class Resize(object): method __init__ (line 52) | def __init__( method constrain_to_multiple_of (line 94) | def constrain_to_multiple_of(self, x, min_val=0, max_val=None): method get_size (line 105) | def get_size(self, width, height): method __call__ (line 162) | def __call__(self, sample): class NormalizeImage (line 197) | class NormalizeImage(object): method __init__ (line 201) | def __init__(self, mean, std): method __call__ (line 205) | def __call__(self, sample): class PrepareForNet (line 211) | class PrepareForNet(object): method __init__ (line 215) | def __init__(self): method __call__ (line 218) | def __call__(self, sample): FILE: manga_translator/inpainting/ldm/modules/midas/midas/vit.py class Slice (line 9) | class Slice(nn.Module): method __init__ (line 10) | def __init__(self, start_index=1): method forward (line 14) | def forward(self, x): class AddReadout (line 18) | class AddReadout(nn.Module): method __init__ (line 19) | def __init__(self, start_index=1): method forward (line 23) | def forward(self, x): class ProjectReadout (line 31) | class ProjectReadout(nn.Module): method __init__ (line 32) | def __init__(self, in_features, start_index=1): method forward (line 38) | def forward(self, x): class Transpose (line 45) | class Transpose(nn.Module): method __init__ (line 46) | def __init__(self, dim0, dim1): method forward (line 51) | def forward(self, x): function forward_vit (line 56) | def forward_vit(pretrained, x): function _resize_pos_embed (line 100) | def _resize_pos_embed(self, posemb, gs_h, gs_w): function forward_flex (line 117) | def forward_flex(self, x): function get_activation (line 159) | def get_activation(name): function get_readout_oper (line 166) | def get_readout_oper(vit_features, features, use_readout, start_index=1): function _make_vit_b16_backbone (line 183) | def _make_vit_b16_backbone( function _make_pretrained_vitl16_384 (line 297) | def _make_pretrained_vitl16_384(pretrained, use_readout="ignore", hooks=... function _make_pretrained_vitb16_384 (line 310) | def _make_pretrained_vitb16_384(pretrained, use_readout="ignore", hooks=... function _make_pretrained_deitb16_384 (line 319) | def _make_pretrained_deitb16_384(pretrained, use_readout="ignore", hooks... function _make_pretrained_deitb16_distil_384 (line 328) | def _make_pretrained_deitb16_distil_384(pretrained, use_readout="ignore"... function _make_vit_b_rn50_backbone (line 343) | def _make_vit_b_rn50_backbone( function _make_pretrained_vitb_rn50_384 (line 478) | def _make_pretrained_vitb_rn50_384( FILE: manga_translator/inpainting/ldm/modules/midas/utils.py function read_pfm (line 9) | def read_pfm(path): function write_pfm (line 58) | def write_pfm(path, image, scale=1): function read_image (line 97) | def read_image(path): function resize_image (line 116) | def resize_image(img): function resize_depth (line 146) | def resize_depth(depth, width, height): function write_depth (line 165) | def write_depth(path, depth, bits=1): FILE: manga_translator/inpainting/ldm/util.py function log_txt_as_img (line 11) | def log_txt_as_img(wh, xc, size=10): function ismap (line 35) | def ismap(x): function isimage (line 41) | def isimage(x): function exists (line 47) | def exists(x): function default (line 51) | def default(val, d): function mean_flat (line 57) | def mean_flat(tensor): function count_params (line 65) | def count_params(model, verbose=False): function instantiate_from_config (line 72) | def instantiate_from_config(config): function get_obj_from_str (line 82) | def get_obj_from_str(string, reload=False): class AdamWwithEMAandWings (line 90) | class AdamWwithEMAandWings(optim.Optimizer): method __init__ (line 92) | def __init__(self, params, lr=1.e-3, betas=(0.9, 0.999), eps=1.e-8, #... method __setstate__ (line 113) | def __setstate__(self, state): method step (line 119) | def step(self, closure=None): FILE: manga_translator/inpainting/none.py class NoneInpainter (line 7) | class NoneInpainter(CommonInpainter): method _inpaint (line 9) | async def _inpaint(self, image: np.ndarray, mask: np.ndarray, config: ... FILE: manga_translator/inpainting/original.py class OriginalInpainter (line 7) | class OriginalInpainter(CommonInpainter): method _inpaint (line 9) | async def _inpaint(self, image: np.ndarray, mask: np.ndarray, config: ... FILE: manga_translator/inpainting/sd_hack.py function disable_verbosity (line 10) | def disable_verbosity(): function enable_sliced_attention (line 15) | def enable_sliced_attention(): function hack_everything (line 21) | def hack_everything(clip_skip=0): function _hacked_clip_forward (line 29) | def _hacked_clip_forward(self, text): function _hacked_sliced_attentin_forward (line 71) | def _hacked_sliced_attentin_forward(self, x, context=None, mask=None): FILE: manga_translator/manga_translator.py function set_main_logger (line 52) | def set_main_logger(l): class TranslationInterrupt (line 56) | class TranslationInterrupt(Exception): function load_dictionary (line 63) | def load_dictionary(file_path): function apply_dictionary (line 87) | def apply_dictionary(text, dictionary): class MangaTranslator (line 95) | class MangaTranslator: method __init__ (line 106) | def __init__(self, params: dict = None): method _setup_log_file (line 154) | def _setup_log_file(self): method parse_init_params (line 273) | def parse_init_params(self, params: dict): method _set_image_context (line 313) | def _set_image_context(self, config: Config, image=None): method _get_image_subfolder (line 338) | def _get_image_subfolder(self) -> str: method _save_current_image_context (line 344) | def _save_current_image_context(self, image_md5: str): method _restore_image_context (line 349) | def _restore_image_context(self, image_md5: str): method using_gpu (line 357) | def using_gpu(self): method translate (line 360) | async def translate(self, image: Image.Image, config: Config, image_na... method _translate (line 432) | async def _translate(self, config: Config, ctx: Context) -> Context: method _revert_upscale (line 626) | async def _revert_upscale(self, config: Config, ctx: Context): method _run_colorizer (line 667) | async def _run_colorizer(self, config: Config, ctx: Context): method _run_upscaling (line 680) | async def _run_upscaling(self, config: Config, ctx: Context): method _run_detection (line 685) | async def _run_detection(self, config: Config, ctx: Context): method _unload_model (line 695) | async def _unload_model(self, tool: str, model: str): method _detector_cleanup_job (line 714) | async def _detector_cleanup_job(self): method _run_ocr (line 726) | async def _run_ocr(self, config: Config, ctx: Context): method _run_textline_merge (line 770) | async def _run_textline_merge(self, config: Config, ctx: Context): method _build_prev_context (line 919) | def _build_prev_context(self, use_original_text=False, current_page_in... method _dispatch_with_context (line 996) | async def _dispatch_with_context(self, config: Config, texts: list[str... method _run_text_translation (line 1057) | async def _run_text_translation(self, config: Config, ctx: Context): method _run_mask_refinement (line 1354) | async def _run_mask_refinement(self, config: Config, ctx: Context): method _run_inpainting (line 1358) | async def _run_inpainting(self, config: Config, ctx: Context): method _run_text_rendering (line 1364) | async def _run_text_rendering(self, config: Config, ctx: Context): method _result_path (line 1381) | def _result_path(self, path: str) -> str: method add_progress_hook (line 1417) | def add_progress_hook(self, ph): method _report_progress (line 1420) | async def _report_progress(self, state: str, finished: bool = False): method _add_logger_hook (line 1424) | def _add_logger_hook(self): method translate_batch (line 1456) | async def translate_batch(self, images_with_configs: List[tuple], batc... method _translate_until_translation (line 1659) | async def _translate_until_translation(self, image: Image.Image, confi... method _batch_translate_contexts (line 1804) | async def _batch_translate_contexts(self, contexts_with_configs: List[... method _concurrent_translate_contexts (line 2012) | async def _concurrent_translate_contexts(self, contexts_with_configs: ... method _batch_translate_texts (line 2212) | async def _batch_translate_texts(self, texts: List[str], config: Confi... method _apply_post_translation_processing (line 2343) | async def _apply_post_translation_processing(self, ctx: Context, confi... method _complete_translation_pipeline (line 2481) | async def _complete_translation_pipeline(self, ctx: Context, config: C... method _check_repetition_hallucination (line 2576) | async def _check_repetition_hallucination(self, text: str, threshold: ... method _check_target_language_ratio (line 2632) | async def _check_target_language_ratio(self, text_regions: List, targe... method _validate_translation (line 2690) | async def _validate_translation(self, original_text: str, translation:... method _retry_translation_with_validation (line 2729) | async def _retry_translation_with_validation(self, region, config: Con... FILE: manga_translator/mask_refinement/__init__.py function dispatch (line 9) | async def dispatch(text_regions: List[TextBlock], raw_image: np.ndarray,... FILE: manga_translator/mask_refinement/text_mask_utils.py function save_rgb (line 18) | def save_rgb(fn, img): function area_overlap (line 24) | def area_overlap(x1, y1, w1, h1, x2, y2, w2, h2): # returns None if rec... function dist (line 29) | def dist(x1, y1, x2, y2): function rect_distance (line 32) | def rect_distance(x1, y1, x1b, y1b, x2, y2, x2b, y2b): function extend_rect (line 56) | def extend_rect(x, y, w, h, max_x, max_y, extend_size): function complete_mask_fill (line 63) | def complete_mask_fill(text_lines: List[Tuple[int, int, int, int]]): function refine_mask (line 71) | def refine_mask(rgbimg, rawmask): function complete_mask (line 96) | def complete_mask(img: np.ndarray, mask: np.ndarray, textlines: List[Qua... function unsharp (line 197) | def unsharp(image): FILE: manga_translator/mode/local.py function play_completion_sound (line 25) | def play_completion_sound(): function safe_get_memory_info (line 40) | def safe_get_memory_info(): function force_cleanup (line 49) | def force_cleanup(): class MangaTranslatorLocal (line 70) | class MangaTranslatorLocal(MangaTranslator): method __init__ (line 71) | def __init__(self, params: dict = None): method translate_path (line 85) | async def translate_path(self, path: str, dest: str = None, params: di... method translate_file (line 201) | async def translate_file(self, path: str, dest: str, params: dict, con... method _translate_file (line 237) | async def _translate_file(self, path: str, dest: str, config: Config, ... method _save_text_to_file (line 295) | def _save_text_to_file(self, image_path: str, ctx: Context): method _translate_folder_batch (line 330) | async def _translate_folder_batch(self, path: str, dest: str, params: ... FILE: manga_translator/mode/share.py class RestrictedUnpickler (line 27) | class RestrictedUnpickler(pickle.Unpickler): method find_class (line 28) | def find_class(self, module: str, name: str): function restricted_loads (line 36) | def restricted_loads(data: bytes): class MethodCall (line 39) | class MethodCall(BaseModel): class MangaShare (line 47) | class MangaShare: method __init__ (line 48) | def __init__(self, params: dict = None): method progress_stream (line 72) | async def progress_stream(self): method run_method (line 82) | async def run_method(self, method, **attributes): method check_nonce (line 111) | def check_nonce(self, request: Request): method check_lock (line 117) | def check_lock(self): method get_fn (line 121) | def get_fn(self, method_name: str): method listen (line 129) | async def listen(self, translation_params: dict = None): FILE: manga_translator/mode/ws.py class MangaTranslatorWS (line 14) | class MangaTranslatorWS(MangaTranslator): method __init__ (line 15) | def __init__(self, params: dict = None): method listen (line 24) | async def listen(self, translation_params: dict = None): method _run_text_translation (line 227) | async def _run_text_translation(self, config: Config, ctx: Context): method _run_text_rendering (line 246) | async def _run_text_rendering(self, config: Config, ctx: Context): FILE: manga_translator/ocr/__init__.py function get_ocr (line 19) | def get_ocr(key: Ocr, *args, **kwargs) -> CommonOCR: function prepare (line 27) | async def prepare(ocr_key: Ocr, device: str = 'cpu'): function dispatch (line 33) | async def dispatch(ocr_key: Ocr, image: np.ndarray, regions: List[Quadri... function unload (line 40) | async def unload(ocr_key: Ocr): FILE: manga_translator/ocr/common.py class CommonOCR (line 11) | class CommonOCR(InfererModule): method _generate_text_direction (line 12) | def _generate_text_direction(self, bboxes: List[Union[Quadrilateral, T... method recognize (line 41) | async def recognize(self, image: np.ndarray, textlines: List[Quadrilat... method _recognize (line 49) | async def _recognize(self, image: np.ndarray, textlines: List[Quadrila... class OfflineOCR (line 53) | class OfflineOCR(CommonOCR, ModelWrapper): method _recognize (line 56) | async def _recognize(self, *args, **kwargs): method _infer (line 60) | async def _infer(self, image: np.ndarray, textlines: List[Quadrilatera... FILE: manga_translator/ocr/model_32px.py class Model32pxOCR (line 19) | class Model32pxOCR(OfflineOCR): method __init__ (line 31) | def __init__(self, *args, **kwargs): method _load (line 39) | async def _load(self, device: str): method _unload (line 55) | async def _unload(self): method _infer (line 58) | async def _infer(self, image: np.ndarray, textlines: List[Quadrilatera... class ResNet (line 143) | class ResNet(nn.Module): method __init__ (line 145) | def __init__(self, input_channel, output_channel, block, layers): method _make_layer (line 184) | def _make_layer(self, block, planes, blocks, stride=1): method forward (line 201) | def forward(self, x): class BasicBlock (line 236) | class BasicBlock(nn.Module): method __init__ (line 239) | def __init__(self, inplanes, planes, stride=1, downsample=None): method _conv3x3 (line 248) | def _conv3x3(self, in_planes, out_planes, stride=1): method forward (line 253) | def forward(self, x): function conv3x3 (line 269) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 275) | def conv1x1(in_planes, out_planes, stride=1): class ResNet_FeatureExtractor (line 279) | class ResNet_FeatureExtractor(nn.Module): method __init__ (line 282) | def __init__(self, input_channel, output_channel=128): method forward (line 286) | def forward(self, input): class PositionalEncoding (line 289) | class PositionalEncoding(nn.Module): method __init__ (line 290) | def __init__(self, d_model, dropout=0.1, max_len=5000): method forward (line 302) | def forward(self, x, offset = 0): function generate_square_subsequent_mask (line 306) | def generate_square_subsequent_mask(sz): class AddCoords (line 311) | class AddCoords(nn.Module): method __init__ (line 313) | def __init__(self, with_r=False): method forward (line 317) | def forward(self, input_tensor): class Beam (line 347) | class Beam: method __init__ (line 348) | def __init__(self, char_seq = [], logprobs = []): method avg_logprob (line 357) | def avg_logprob(self): method sort_key (line 360) | def sort_key(self): method seq_end (line 363) | def seq_end(self, end_tok): method extend (line 366) | def extend(self, idx, logprob): class Hypothesis (line 374) | class Hypothesis: method __init__ (line 375) | def __init__(self, device, start_tok: int, end_tok: int, padding_tok: ... method seq_end (line 389) | def seq_end(self): method logprob (line 392) | def logprob(self): method sort_key (line 395) | def sort_key(self): method prob (line 398) | def prob(self): method __len__ (line 401) | def __len__(self): method extend (line 404) | def extend(self, idx, logprob): method output (line 412) | def output(self): function next_token_batch (line 415) | def next_token_batch( class OCR (line 467) | class OCR(nn.Module): method __init__ (line 468) | def __init__(self, dictionary, max_len): method forward (line 491) | def forward(self, method infer_beam_batch (line 518) | def infer_beam_batch(self, img: torch.FloatTensor, img_widths: List[in... method infer_beam (line 597) | def infer_beam(self, img: torch.FloatTensor, beams_k: int = 5, start_t... function test (line 663) | def test(): function test_inference (line 672) | def test_inference(): FILE: manga_translator/ocr/model_48px.py class Model48pxOCR (line 27) | class Model48pxOCR(OfflineOCR): method __init__ (line 39) | def __init__(self, *args, **kwargs): method _load (line 47) | async def _load(self, device: str): method _unload (line 64) | async def _unload(self): method _infer (line 67) | async def _infer(self, image: np.ndarray, textlines: List[Quadrilatera... class ConvNeXtBlock (line 182) | class ConvNeXtBlock(nn.Module): method __init__ (line 193) | def __init__(self, dim, layer_scale_init_value=1e-6, ks = 7, padding =... method forward (line 203) | def forward(self, x): class ConvNext_FeatureExtractor (line 216) | class ConvNext_FeatureExtractor(nn.Module) : method __init__ (line 217) | def __init__(self, img_height = 48, in_dim = 3, dim = 512, n_layers = ... method make_layers (line 256) | def make_layers(self, dim, n, ks = 7, padding = 3) : method forward (line 262) | def forward(self, x) : function transformer_encoder_forward (line 278) | def transformer_encoder_forward( class XposMultiheadAttention (line 294) | class XposMultiheadAttention(nn.Module): method __init__ (line 295) | def __init__( method reset_parameters (line 320) | def reset_parameters(self): method forward (line 327) | def forward( function generate_square_subsequent_mask (line 396) | def generate_square_subsequent_mask(sz): class Beam (line 401) | class Beam: method __init__ (line 402) | def __init__(self, char_seq = [], logprobs = []): method avg_logprob (line 411) | def avg_logprob(self): method sort_key (line 414) | def sort_key(self): method seq_end (line 417) | def seq_end(self, end_tok): method extend (line 420) | def extend(self, idx, logprob): class Hypothesis (line 428) | class Hypothesis: method __init__ (line 429) | def __init__(self, device, start_tok: int, end_tok: int, padding_tok: ... method seq_end (line 443) | def seq_end(self): method logprob (line 446) | def logprob(self): method sort_key (line 449) | def sort_key(self): method prob (line 452) | def prob(self): method __len__ (line 455) | def __len__(self): method extend (line 458) | def extend(self, idx, logprob): method output (line 466) | def output(self): function next_token_batch (line 469) | def next_token_batch( class OCR (line 505) | class OCR(nn.Module): method __init__ (line 506) | def __init__(self, dictionary, max_len): method encoder_forward (line 543) | def encoder_forward(self, memory, encoder_mask): method decoder_forward (line 548) | def decoder_forward( method forward (line 574) | def forward(self, method infer_beam_batch (line 600) | def infer_beam_batch(self, img: torch.FloatTensor, img_widths: List[in... method infer_beam_batch_tensor (line 678) | def infer_beam_batch_tensor(self, img: torch.FloatTensor, img_widths: ... function convert_pl_model (line 805) | def convert_pl_model(filename: str) : function test_LocalViT_FeatureExtractor (line 814) | def test_LocalViT_FeatureExtractor() : function test_infer (line 820) | def test_infer() : FILE: manga_translator/ocr/model_48px_ctc.py class Model48pxCTCOCR (line 18) | class Model48pxCTCOCR(OfflineOCR): method __init__ (line 30) | def __init__(self, *args, **kwargs): method _load (line 38) | async def _load(self, device: str): method _unload (line 59) | async def _unload(self): method _infer (line 62) | async def _infer(self, image: np.ndarray, textlines: List[Quadrilatera... class PositionalEncoding (line 163) | class PositionalEncoding(nn.Module): method __init__ (line 164) | def __init__(self, d_model, dropout=0.1, max_len=5000): method forward (line 176) | def forward(self, x, offset = 0): class CustomTransformerEncoderLayer (line 180) | class CustomTransformerEncoderLayer(nn.Module): method __init__ (line 212) | def __init__(self, d_model, nhead, dim_feedforward=2048, dropout=0.1, ... method __setstate__ (line 233) | def __setstate__(self, state): method forward (line 238) | def forward(self, src: torch.Tensor, src_mask: Optional[torch.Tensor] ... method _sa_block (line 263) | def _sa_block(self, x: torch.Tensor, method _ff_block (line 272) | def _ff_block(self, x: torch.Tensor) -> torch.Tensor: class ResNet (line 277) | class ResNet(nn.Module): method __init__ (line 279) | def __init__(self, input_channel, output_channel, block, layers): method _make_layer (line 318) | def _make_layer(self, block, planes, blocks, stride=1): method forward (line 335) | def forward(self, x): class BasicBlock (line 372) | class BasicBlock(nn.Module): method __init__ (line 375) | def __init__(self, inplanes, planes, stride=1, downsample=None): method _conv3x3 (line 384) | def _conv3x3(self, in_planes, out_planes, stride=1): method forward (line 389) | def forward(self, x): function conv3x3 (line 405) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 411) | def conv1x1(in_planes, out_planes, stride=1): class ResNet_FeatureExtractor (line 415) | class ResNet_FeatureExtractor(nn.Module): method __init__ (line 418) | def __init__(self, input_channel, output_channel=128): method forward (line 422) | def forward(self, input): class OCR (line 425) | class OCR(nn.Module): method __init__ (line 426) | def __init__(self, dictionary, max_len): method forward (line 438) | def forward(self, method decode (line 447) | def decode(self, img: torch.Tensor, img_widths: List[int], blank, verb... method decode_ctc_top1 (line 456) | def decode_ctc_top1(self, pred_char_logits, pred_color_values, blank, ... method eval_ocr (line 496) | def eval_ocr(self, input_lengths, target_lengths, pred_char_logits, pr... function test2 (line 522) | def test2(): function test_inference (line 533) | def test_inference(): FILE: manga_translator/ocr/model_manga_ocr.py function merge_bboxes (line 25) | async def merge_bboxes(bboxes: List[Quadrilateral], width: int, height: ... class ModelMangaOCR (line 90) | class ModelMangaOCR(OfflineOCR): method __init__ (line 102) | def __init__(self, *args, **kwargs): method _load (line 110) | async def _load(self, device: str): method _unload (line 128) | async def _unload(self): method _infer (line 132) | async def _infer(self, image: np.ndarray, textlines: List[Quadrilatera... FILE: manga_translator/ocr/model_ocr_large.py class ResNet (line 9) | class ResNet(nn.Module): method __init__ (line 11) | def __init__(self, input_channel, output_channel, block, layers): method _make_layer (line 50) | def _make_layer(self, block, planes, blocks, stride=1): method forward (line 67) | def forward(self, x): class BasicBlock (line 102) | class BasicBlock(nn.Module): method __init__ (line 105) | def __init__(self, inplanes, planes, stride=1, downsample=None): method _conv3x3 (line 114) | def _conv3x3(self, in_planes, out_planes, stride=1): method forward (line 119) | def forward(self, x): function conv3x3 (line 135) | def conv3x3(in_planes, out_planes, stride=1, groups=1, dilation=1): function conv1x1 (line 141) | def conv1x1(in_planes, out_planes, stride=1): class ResNet_FeatureExtractor (line 145) | class ResNet_FeatureExtractor(nn.Module): method __init__ (line 148) | def __init__(self, input_channel, output_channel=128): method forward (line 152) | def forward(self, input): class PositionalEncoding (line 155) | class PositionalEncoding(nn.Module): method __init__ (line 156) | def __init__(self, d_model, dropout=0.1, max_len=5000): method forward (line 168) | def forward(self, x, offset = 0): function generate_square_subsequent_mask (line 172) | def generate_square_subsequent_mask(sz): class AddCoords (line 177) | class AddCoords(nn.Module): method __init__ (line 179) | def __init__(self, with_r=False): method forward (line 183) | def forward(self, input_tensor): class Beam (line 213) | class Beam: method __init__ (line 214) | def __init__(self, char_seq = [], logprobs = []): method avg_logprob (line 223) | def avg_logprob(self): method sort_key (line 226) | def sort_key(self): method seq_end (line 229) | def seq_end(self, end_tok): method extend (line 232) | def extend(self, idx, logprob): class Hypothesis (line 240) | class Hypothesis: method __init__ (line 241) | def __init__(self, device, start_tok: int, end_tok: int, padding_tok: ... method seq_end (line 255) | def seq_end(self): method logprob (line 258) | def logprob(self): method sort_key (line 261) | def sort_key(self): method prob (line 264) | def prob(self): method __len__ (line 267) | def __len__(self): method extend (line 270) | def extend(self, idx, logprob): method output (line 278) | def output(self): function next_token_batch (line 281) | def next_token_batch( class OCR (line 333) | class OCR(nn.Module): method __init__ (line 334) | def __init__(self, dictionary, max_len): method forward (line 357) | def forward(self, method infer_beam_batch (line 384) | def infer_beam_batch(self, img: torch.FloatTensor, img_widths: List[in... method infer_beam (line 463) | def infer_beam(self, img: torch.FloatTensor, beams_k: int = 5, start_t... function test (line 529) | def test(): function test_inference (line 538) | def test_inference(): FILE: manga_translator/ocr/xpos_relative_position.py function fixed_pos_embedding (line 9) | def fixed_pos_embedding(x): function rotate_every_two (line 17) | def rotate_every_two(x): function duplicate_interleave (line 23) | def duplicate_interleave(m): function apply_rotary_pos_emb (line 33) | def apply_rotary_pos_emb(x, sin, cos, scale=1): function apply_rotary_pos_emb2d (line 38) | def apply_rotary_pos_emb2d(x, sin, cos, scale=1): class XPOS (line 44) | class XPOS(nn.Module): method __init__ (line 45) | def __init__( method forward (line 55) | def forward(self, x, offset=0, downscale=False): class XPOS2D (line 74) | class XPOS2D(nn.Module): method __init__ (line 75) | def __init__( method forward (line 81) | def forward(self, x: torch.Tensor, offset_x = 0, offset_y = 0, downsca... function test (line 96) | def test() : FILE: manga_translator/rendering/__init__.py function parse_font_paths (line 23) | def parse_font_paths(path: str, default: List[str] = None) -> List[str]: function fg_bg_compare (line 31) | def fg_bg_compare(fg, bg): function count_text_length (line 37) | def count_text_length(text: str) -> float: function resize_regions_to_font_size (line 48) | def resize_regions_to_font_size(img: np.ndarray, text_regions: List['Tex... function dispatch (line 235) | async def dispatch( function render (line 264) | def render( function dispatch_eng_render (line 412) | async def dispatch_eng_render(img_canvas: np.ndarray, original_img: np.n... function dispatch_eng_render_pillow (line 422) | async def dispatch_eng_render_pillow(img_canvas: np.ndarray, original_im... FILE: manga_translator/rendering/ballon_extractor.py function enlarge_window (line 8) | def enlarge_window(rect, im_w, im_h, ratio=2.5, aspect_ratio=1.0) -> List: function extract_ballon_region (line 31) | def extract_ballon_region(img: np.ndarray, ballon_rect: List, enlarge_ra... FILE: manga_translator/rendering/gimp_render.py function gimp_render (line 70) | def gimp_render(out_file, ctx: Context): function gimp_console_executable (line 153) | def gimp_console_executable(): function gimp_batch (line 170) | def gimp_batch(script): FILE: manga_translator/rendering/text_render.py function CJK_Compatibility_Forms_translate (line 118) | def CJK_Compatibility_Forms_translate(cdpt: str, direction: int): function compact_special_symbols (line 136) | def compact_special_symbols(text: str) -> str: function rotate_image (line 144) | def rotate_image(image, angle): function add_color (line 159) | def add_color(bw_char_map, color, stroke_char_map, stroke_color): function get_cached_font (line 217) | def get_cached_font(path: str) -> freetype.Face: function set_font (line 225) | def set_font(font_path: str): class namespace (line 233) | class namespace: class Glyph (line 236) | class Glyph: method __init__ (line 237) | def __init__(self, glyph): function get_char_glyph (line 256) | def get_char_glyph(cdpt: str, font_size: int, direction: int) -> Glyph: function get_char_border (line 269) | def get_char_border(cdpt: str, font_size: int, direction: int): function calc_vertical (line 296) | def calc_vertical(font_size: int, text: str, max_height: int): function put_char_vertical (line 339) | def put_char_vertical(font_size: int, cdpt: str, pen_l: Tuple[int, int],... function put_text_vertical (line 541) | def put_text_vertical(font_size: int, text: str, h: int, alignment: str,... function select_hyphenator (line 582) | def select_hyphenator(lang: str): function get_char_offset_x (line 597) | def get_char_offset_x(font_size: int, cdpt: str): function get_string_width (line 609) | def get_string_width(font_size: int, text: str): function calc_horizontal (line 612) | def calc_horizontal(font_size: int, text: str, max_width: int, max_heigh... function put_char_horizontal (line 881) | def put_char_horizontal(font_size: int, cdpt: str, pen_l: Tuple[int, int... function put_text_horizontal (line 1100) | def put_text_horizontal(font_size: int, text: str, width: int, height: i... function test (line 1162) | def test(): FILE: manga_translator/rendering/text_render_eng.py class Textline (line 15) | class Textline: method __init__ (line 16) | def __init__(self, text: str = '', pos_x: int = 0, pos_y: int = 0, len... method append_right (line 27) | def append_right(self, word: str, w_len: int, delimiter: str = ''): method append_left (line 33) | def append_left(self, word: str, w_len: int, delimiter: str = ''): method add_spacing (line 39) | def add_spacing(self, spacing: int): method strip_spacing (line 44) | def strip_spacing(self): function render_lines (line 49) | def render_lines( function seg_eng (line 96) | def seg_eng(text: str) -> List[str]: function layout_lines_aligncenter (line 158) | def layout_lines_aligncenter( function render_textblock_list_eng (line 336) | def render_textblock_list_eng( FILE: manga_translator/rendering/text_render_pillow_eng.py function merge_seg_eng (line 10) | def merge_seg_eng(text: str, font, bbox_width, size_ratio=1.2) -> List[s... function widen_mask_opencv_round (line 30) | def widen_mask_opencv_round(mask, width): function _check_bbox_collision (line 38) | def _check_bbox_collision(b1, b2): function _spiral_points_generator (line 42) | def _spiral_points_generator(anchor_x, anchor_y, limit): function _find_collision_free_position (line 55) | def _find_collision_free_position(bbox_idx, bboxes, anchors, image_bound... function solve_collisions_spiral_xyxy (line 80) | def solve_collisions_spiral_xyxy(image_shape, initial_bboxes_xyxy, max_i... function render_textblock_list_eng (line 107) | def render_textblock_list_eng( FILE: manga_translator/save.py class FormatNotSupportedException (line 9) | class FormatNotSupportedException(Exception): method __init__ (line 10) | def __init__(self, fmt: str): function register_format (line 14) | def register_format(format_cls): class ExportFormat (line 21) | class ExportFormat(): method __init_subclass__ (line 25) | def __init_subclass__(cls, **kwargs): method save (line 29) | def save(self, result: Image.Image, dest: str, ctx: Context): method _save (line 33) | def _save(self, result: Image.Image, dest: str, ctx: Context): function save_result (line 36) | def save_result(result: Image.Image, dest: str, ctx: Context): class ImageFormat (line 48) | class ImageFormat(ExportFormat): method _save (line 51) | def _save(self, result: Image.Image, dest: str, ctx: Context): class JPGFormat (line 54) | class JPGFormat(ExportFormat): method _save (line 57) | def _save(self, result: Image.Image, dest: str, ctx: Context): class GIMPFormat (line 62) | class GIMPFormat(ExportFormat): method _save (line 65) | def _save(self, result: Image.Image, dest: str, ctx: Context): FILE: manga_translator/textline_merge/__init__.py function split_text_region (line 10) | def split_text_region( function merge_bboxes_text_region (line 110) | def merge_bboxes_text_region(bboxes: List[Quadrilateral], width, height): function dispatch (line 184) | async def dispatch(textlines: List[Quadrilateral], width: int, height: i... FILE: manga_translator/translators/__init__.py function get_translator (line 71) | def get_translator(key: Translator, *args, **kwargs) -> CommonTranslator: function prepare (line 81) | async def prepare(chain: TranslatorChain): function dispatch (line 89) | async def dispatch(chain: TranslatorChain, queries: List[str], translato... function dispatch_batch (line 131) | async def dispatch_batch(chain: TranslatorChain, batch_queries: List[Lis... function unload (line 193) | async def unload(key: Translator): FILE: manga_translator/translators/baidu.py class BaiduTranslator (line 17) | class BaiduTranslator(CommonTranslator): method __init__ (line 42) | def __init__(self) -> None: method _translate (line 47) | async def _translate(self, from_lang, to_lang, queries): method _modify_invalid_translation_query (line 76) | def _modify_invalid_translation_query(self, query: str, trans: str) ->... method get_url (line 81) | def get_url(from_lang, to_lang, query_text): FILE: manga_translator/translators/caiyun.py class CaiyunTranslator (line 8) | class CaiyunTranslator(CommonTranslator): method __init__ (line 26) | def __init__(self): method _translate (line 31) | async def _translate(self, from_lang, to_lang, queries): method _truncate (line 45) | def _truncate(self, q): method _do_request (line 51) | async def _do_request(self, data): FILE: manga_translator/translators/chatgpt.py class OpenAITranslator (line 20) | class OpenAITranslator(ConfigGPT, CommonTranslator): method __init__ (line 35) | def __init__(self, check_openai_key=True): method set_prev_context (line 84) | def set_prev_context(self, text: str = ""): method parse_args (line 87) | def parse_args(self, args: CommonTranslator): method _ratelimit_sleep (line 91) | async def _ratelimit_sleep(self): method _assemble_prompts (line 111) | def _assemble_prompts(self, from_lang: str, to_lang: str, queries: Lis... method _translate (line 149) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _try_fallback_model (line 177) | async def _try_fallback_model(self, to_lang: str, prompt: str, batch_q... method _translate_batch (line 272) | async def _translate_batch( method _request_with_retry (line 600) | async def _request_with_retry(self, to_lang: str, prompt: str) -> str: method _request_translation (line 659) | async def _request_translation(self, to_lang: str, prompt: str) -> str: method _fix_prefix_spacing (line 788) | def _fix_prefix_spacing(self, text_to_fix): method print_boxed (line 810) | def print_boxed(self, text, border_color="blue", title="OpenAITranslat... method load_glossary (line 832) | def load_glossary(self, path): method detect_type (line 853) | def detect_type(self, dic_path): method load_mit_dict (line 926) | def load_mit_dict(self, dic_path): method load_galtransl_dic (line 1030) | def load_galtransl_dic(self, dic_path): method load_sakura_dict (line 1070) | def load_sakura_dict(self, dic_path): method extract_relevant_terms (line 1110) | def extract_relevant_terms(self, text): FILE: manga_translator/translators/chatgpt_2stage.py function encode_image (line 13) | def encode_image(image): class RefusalMessageError (line 26) | class RefusalMessageError(Exception): class ChatGPT2StageTranslator (line 31) | class ChatGPT2StageTranslator(OpenAITranslator): method _contains_refusal (line 192) | def _contains_refusal(cls, text: str) -> bool: method _attempt_fallback_stage1 (line 199) | async def _attempt_fallback_stage1(self, refine_prompt: str, base64_im... method _attempt_batch_fallback_stage1 (line 247) | async def _attempt_batch_fallback_stage1(self, batch_refine_prompt: st... method __init__ (line 308) | def __init__(self, max_tokens=16000, refine_temperature=0.0, translate... method _translate (line 334) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _translate_2stage (line 354) | async def _translate_2stage(self, from_lang: str, to_lang: str, querie... method _process_refine_output (line 524) | def _process_refine_output(self, refine_output: List[str]) -> List[str]: method _get_refine_prompt (line 547) | def _get_refine_prompt(self, text_regions, width: int, height: int, ne... method _get_refine_system_instruction (line 569) | def _get_refine_system_instruction(self, from_lang: str): method _parse_json_response (line 619) | def _parse_json_response(self, raw_content: str, fallback_queries: Lis... method _remap_translations_to_original_positions (line 747) | def _remap_translations_to_original_positions(self, reordered_translat... method _request_translation (line 787) | async def _request_translation(self, to_lang: str, prompt: str) -> str: method translate (line 998) | async def translate(self, from_lang: str, to_lang: str, queries: List[... method _translate_batch_2stage (line 1062) | async def _translate_batch_2stage(self, from_lang: str, to_lang: str, ... method _get_batch_refine_prompt (line 1265) | def _get_batch_refine_prompt(self, batch_query_regions: List[List], ba... method _get_batch_refine_system_instruction (line 1290) | def _get_batch_refine_system_instruction(self, from_lang: str): method _parse_batch_json_response (line 1372) | def _parse_batch_json_response(self, raw_content: str, fallback_querie... method _generate_batch_debug_images (line 1423) | async def _generate_batch_debug_images(self, batch_contexts: List[Cont... FILE: manga_translator/translators/common.py class InvalidServerResponse (line 72) | class InvalidServerResponse(Exception): class MissingAPIKeyException (line 75) | class MissingAPIKeyException(Exception): class LanguageUnsupportedException (line 78) | class LanguageUnsupportedException(Exception): method __init__ (line 79) | def __init__(self, language_code: str, translator: str = None, support... class MTPEAdapter (line 85) | class MTPEAdapter(): method dispatch (line 86) | async def dispatch(self, queries: List[str], translations: List[str]) ... class CommonTranslator (line 105) | class CommonTranslator(InfererModule): method __init__ (line 118) | def __init__(self): method supports_languages (line 123) | def supports_languages(self, from_lang: str, to_lang: str, fatal: bool... method parse_language_codes (line 137) | def parse_language_codes(self, from_lang: str, to_lang: str, fatal: bo... method translate (line 147) | async def translate(self, from_lang: str, to_lang: str, queries: List[... method _translate (line 227) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _ratelimit_sleep (line 230) | async def _ratelimit_sleep(self): method _is_translation_invalid (line 239) | def _is_translation_invalid(self, query: str, trans: str) -> bool: method _modify_invalid_translation_query (line 251) | def _modify_invalid_translation_query(self, query: str, trans: str) ->... method _clean_translation_output (line 258) | def _clean_translation_output(self, query: str, trans: str, to_lang: s... class OfflineTranslator (line 303) | class OfflineTranslator(CommonTranslator, ModelWrapper): method _translate (line 306) | async def _translate(self, *args, **kwargs): method _infer (line 310) | async def _infer(self, from_lang: str, to_lang: str, queries: List[str... method load (line 313) | async def load(self, from_lang: str, to_lang: str, device: str): method _load (line 317) | async def _load(self, from_lang: str, to_lang: str, device: str): method reload (line 320) | async def reload(self, from_lang: str, to_lang: str, device: str): method _load (line 324) | async def _load(self, from_lang: str, to_lang: str, device: str): method unload (line 327) | async def unload(self, device: str): FILE: manga_translator/translators/common_gpt.py class CommonGPTTranslator (line 13) | class CommonGPTTranslator(ConfigGPT, CommonTranslator): method __init__ (line 39) | def __init__(self, config_key: str): method parse_args (line 57) | def parse_args(self, args: CommonTranslator): method count_tokens (line 61) | def count_tokens(self, text: str) -> int: method withinTokenLimit (line 102) | def withinTokenLimit(self, text: str) -> bool: method supports_languages (line 128) | def supports_languages(self, from_lang: str, to_lang: str, fatal: bool... method fallback_fewShot (line 133) | def fallback_fewShot(self) -> str: method _assemble_prompts (line 164) | def _assemble_prompts(self, from_lang: str, to_lang: str, queries: Lis... method _assemble_request (line 227) | def _assemble_request(self, to_lang: str, prompt: str) -> Dict: method _parse_response (line 249) | def _parse_response(self, response: str, queries: List): method _ratelimit_sleep (line 265) | async def _ratelimit_sleep(self): class _CommonGPTTranslator_JSON (line 280) | class _CommonGPTTranslator_JSON: method __init__ (line 286) | def __init__(self, translator: CommonGPTTranslator): method ppJSON (line 291) | def ppJSON(self, jsonText: str) -> str: method _assemble_prompts (line 311) | def _assemble_prompts(self, from_lang: str, to_lang: str, queries: Lis... method _assemble_request (line 361) | def _assemble_request(self, to_lang: str, prompt: str, response_format... method _parse_response (line 407) | def _parse_response(self, response: json, queries: List[str]) -> List[... method text2json (line 459) | def text2json(text: str) -> TranslationList: method _list2json (line 485) | def _list2json(self, vals: List[str]) -> TranslationList: FILE: manga_translator/translators/config_gpt.py class TextValue (line 9) | class TextValue(BaseModel): class TranslationList (line 13) | class TranslationList(BaseModel): class ConfigGPT (line 17) | class ConfigGPT: method __init__ (line 171) | def __init__(self, config_key: str): method _config_get (line 178) | def _config_get(self, key: str, default=None): method include_template (line 197) | def include_template(self) -> str: method prompt_template (line 201) | def prompt_template(self) -> str: method chat_system_template (line 205) | def chat_system_template(self) -> str: method chat_sample (line 209) | def chat_sample(self) -> Dict[str, List[str]]: method _closest_sample_match (line 231) | def _closest_sample_match(self, all_samples: Dict, to_lang: str, max_d... method get_chat_sample (line 283) | def get_chat_sample(self, to_lang: str) -> List[str]: method json_mode (line 292) | def json_mode(self) -> bool: method json_sample (line 296) | def json_sample(self) -> Dict[str, List[TranslationList]]: method get_json_sample (line 327) | def get_json_sample(self, to_lang: str) -> List[TranslationList]: method get_sample (line 335) | def get_sample(self, to_lang: str) -> List: method rgx_capture (line 347) | def rgx_capture(self) -> str: method temperature (line 351) | def temperature(self) -> float: method top_p (line 355) | def top_p(self) -> float: method verbose_logging (line 359) | def verbose_logging(self) -> bool: method glossary_system_template (line 363) | def glossary_system_template(self) -> str: method extract_capture_groups (line 366) | def extract_capture_groups(self, text, regex=r"(.*)"): FILE: manga_translator/translators/custom_openai.py class CustomOpenAiTranslator (line 17) | class CustomOpenAiTranslator(ConfigGPT, CommonTranslator): method __init__ (line 34) | def __init__(self, model=None, api_base=None, api_key=None, check_open... method parse_args (line 49) | def parse_args(self, args: TranslatorConfig): method extract_capture_groups (line 53) | def extract_capture_groups(self, text, regex=r"(.*)"): method _assemble_prompts (line 71) | def _assemble_prompts(self, from_lang: str, to_lang: str, queries: Lis... method _format_prompt_log (line 101) | def _format_prompt_log(self, to_lang: str, prompt: str) -> str: method _translate (line 121) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _request_translation (line 217) | async def _request_translation(self, to_lang: str, prompt: str) -> str: FILE: manga_translator/translators/deepl.py class DeeplTranslator (line 6) | class DeeplTranslator(CommonTranslator): method __init__ (line 45) | def __init__(self): method _translate (line 51) | async def _translate(self, from_lang, to_lang, queries): FILE: manga_translator/translators/deepseek.py class DeepseekTranslator (line 18) | class DeepseekTranslator(CommonGPTTranslator): method __init__ (line 47) | def __init__(self, check_openai_key=True): method count_tokens (line 65) | def count_tokens(self, text: str): method _format_prompt_log (line 84) | def _format_prompt_log(self, to_lang: str, prompt: str) -> str: method _translate (line 105) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _request_translation (line 233) | async def _request_translation(self, to_lang: str, prompt: str) -> str: FILE: manga_translator/translators/gemini.py class GeminiTranslator (line 19) | class GeminiTranslator(CommonGPTTranslator): method __init__ (line 88) | def __init__(self): method useCache (line 212) | def useCache(self) -> bool: method parse_args (line 244) | def parse_args(self, args: CommonGPTTranslator): method _init_json_mode (line 253) | def _init_json_mode(self): method _init_standard_mode (line 262) | def _init_standard_mode(self): method count_tokens (line 267) | def count_tokens(self, text: str) -> int: method _createContext (line 272) | def _createContext(self, to_lang: str): method _needRecache (line 299) | def _needRecache(self) -> bool: method _translate (line 316) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method formatLog (line 421) | def formatLog(self, vals: dict) -> str: method _request_translation (line 426) | async def _request_translation(self, to_lang: str, prompt: str) -> str: class _GeminiTranslator_json (line 491) | class _GeminiTranslator_json (_CommonGPTTranslator_JSON): method __init__ (line 496) | def __init__(self, translator: GeminiTranslator): method _createContext (line 503) | def _createContext(self, to_lang: str): method _request_translation (line 531) | async def _request_translation(self, to_lang: str, prompt: str) -> str: FILE: manga_translator/translators/gemini_2stage.py function encode_image (line 15) | def encode_image(image): class TextBoundingBox (line 28) | class TextBoundingBox(BaseModel): class TextBoundingBoxes (line 35) | class TextBoundingBoxes(BaseModel): class TranslatedText (line 39) | class TranslatedText(BaseModel): class TranslatedTexts (line 45) | class TranslatedTexts(BaseModel): class Gemini2StageTranslator (line 49) | class Gemini2StageTranslator(CommonTranslator): method __init__ (line 74) | def __init__(self, max_tokens = 16000, refine_temperature = 0.0, trans... method supports_languages (line 83) | def supports_languages(self, from_lang: str, to_lang: str, fatal: bool... method translate (line 91) | async def translate(self, from_lang: str, to_lang: str, queries: List[... method _translate (line 158) | async def _translate(self, from_lang: str, to_lang: str, query_indices... method _translate_2stage (line 161) | async def _translate_2stage(self, from_lang: str, to_lang: str, query_... method process_refine_output (line 200) | def process_refine_output(self, refine_output: List[str]) -> List[str]: method get_prompt (line 220) | def get_prompt(self, text_regions, width: int, height: int, new_width:... method _get_refine_system_instruction (line 236) | def _get_refine_system_instruction(self, from_lang: str): method get_translate_system_instruction (line 249) | def get_translate_system_instruction(self, from_lang: str, to_lang: str): FILE: manga_translator/translators/google.py class GoogleTranslator (line 50) | class GoogleTranslator(CommonTranslator): method __init__ (line 109) | def __init__(self, service_urls=DEFAULT_CLIENT_SERVICE_URLS, user_agen... method _translate (line 141) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _translate_query (line 168) | async def _translate_query(self, from_lang: str, to_lang: str, query: ... method _request_and_parse_translation (line 202) | async def _request_and_parse_translation(self, query, to_lang, from_la... method _build_rpc_request (line 286) | def _build_rpc_request(self, text: str, dest: str, src: str): method _pick_service_url (line 296) | def _pick_service_url(self): method _request_translation (line 301) | async def _request_translation(self, text: str, dest: str, src: str): method _translate_legacy (line 323) | async def _translate_legacy(self, text, dest, src, override): method _parse_extra_data (line 345) | def _parse_extra_data(self, data): method translate_legacy (line 368) | async def translate_legacy(self, text, dest='en', src='auto', **kwargs): method detect (line 471) | async def detect(self, text: str): method detect_legacy (line 476) | async def detect_legacy(self, text, **kwargs): FILE: manga_translator/translators/google_gtoken.py class TokenAcquirer (line 12) | class TokenAcquirer: method __init__ (line 41) | def __init__(self, client: httpx.AsyncClient, tkk='0', host='translate... method _update (line 46) | async def _update(self): method _lazy (line 112) | def _lazy(self, value): method _xr (line 130) | def _xr(self, a, b): method acquire (line 142) | def acquire(self, text): method do (line 198) | async def do(self, text): FILE: manga_translator/translators/groq.py class GroqTranslator (line 8) | class GroqTranslator(CommonTranslator): method __init__ (line 49) | def __init__(self, check_groq_key=True): method parse_args (line 64) | def parse_args(self, args): method _config_get (line 68) | def _config_get(self, key: str, default=None): method chat_system_template (line 74) | def chat_system_template(self) -> str: method chat_sample (line 78) | def chat_sample(self): method temperature (line 82) | def temperature(self) -> float: method top_p (line 86) | def top_p(self) -> float: method _format_prompt_log (line 89) | def _format_prompt_log(self, to_lang: str, prompt: str) -> str: method _translate (line 101) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _request_translation (line 111) | async def _request_translation(self, to_lang: str, prompt: str) -> str: FILE: manga_translator/translators/m2m100.py class M2M100Translator (line 12) | class M2M100Translator(OfflineTranslator): method _load (line 54) | async def _load(self, from_lang: str, to_lang: str, device: str): method _unload (line 68) | async def _unload(self): method _infer (line 73) | async def _infer(self, from_lang: str, to_lang: str, queries: List[str... method tokenize (line 88) | def tokenize(self, queries, lang): method detokenize (line 95) | def detokenize(self, queries, lang): class M2M100BigTranslator (line 102) | class M2M100BigTranslator(M2M100Translator): FILE: manga_translator/translators/mbart50.py class MBart50Translator (line 31) | class MBart50Translator(OfflineTranslator): method _load (line 61) | async def _load(self, from_lang: str, to_lang: str, device: str): method _unload (line 75) | async def _unload(self): method _infer (line 79) | async def _infer(self, from_lang: str, to_lang: str, queries: list[str... method _translate_sentence (line 91) | def _translate_sentence(self, from_lang: str, to_lang: str, query: str... method _map_detected_lang_to_translator (line 113) | def _map_detected_lang_to_translator(self, lang): method _download (line 119) | async def _download(self): method _check_downloaded (line 124) | def _check_downloaded(self) -> bool: FILE: manga_translator/translators/nllb.py class NLLBTranslator (line 34) | class NLLBTranslator(OfflineTranslator): method _load (line 64) | async def _load(self, from_lang: str, to_lang: str, device: str): method _unload (line 73) | async def _unload(self): method _infer (line 77) | async def _infer(self, from_lang: str, to_lang: str, queries: List[str... method _translate_sentence (line 89) | def _translate_sentence(self, from_lang: str, to_lang: str, query: str... method _map_detected_lang_to_translator (line 115) | def _map_detected_lang_to_translator(self, lang): method _download (line 121) | async def _download(self): method _check_downloaded (line 127) | def _check_downloaded(self) -> bool: class NLLBBigTranslator (line 131) | class NLLBBigTranslator(NLLBTranslator): FILE: manga_translator/translators/none.py class NoneTranslator (line 5) | class NoneTranslator(CommonTranslator): method supports_languages (line 7) | def supports_languages(self, from_lang: str, to_lang: str, fatal: bool... method _translate (line 10) | async def _translate(self, from_lang: str, to_lang: str, queries: List... FILE: manga_translator/translators/original.py class OriginalTranslator (line 5) | class OriginalTranslator(CommonTranslator): method supports_languages (line 7) | def supports_languages(self, from_lang: str, to_lang: str, fatal: bool... method _translate (line 10) | async def _translate(self, from_lang: str, to_lang: str, queries: List... FILE: manga_translator/translators/papago.py class PapagoTranslator (line 13) | class PapagoTranslator(CommonTranslator): method _translate (line 32) | async def _translate(self, from_lang, to_lang, queries): method _version_key (line 45) | def _version_key(self): method _do_request (line 52) | async def _do_request(self, data, version_key): FILE: manga_translator/translators/qwen2.py class Qwen2Translator (line 14) | class Qwen2Translator(OfflineTranslator, ConfigGPT): method __init__ (line 47) | def __init__(self): method parse_args (line 51) | def parse_args(self, args: TranslatorConfig): method _load (line 54) | async def _load(self, from_lang: str, to_lang: str, device: str): method _unload (line 71) | async def _unload(self): method _infer (line 75) | async def _infer(self, from_lang: str, to_lang: str, queries: List[str... method tokenize (line 112) | def tokenize(self, queries, to_lang): class Qwen2BigTranslator (line 154) | class Qwen2BigTranslator(Qwen2Translator): FILE: manga_translator/translators/sakura.py class SakuraDict (line 18) | class SakuraDict(): method __init__ (line 19) | def __init__(self, path: str, logger: logging.Logger, version: str = "... method load_galtransl_dic (line 34) | def load_galtransl_dic(self, dic_path: str): method load_sakura_dict (line 86) | def load_sakura_dict(self, dic_path: str): method detect_type (line 130) | def detect_type(self, dic_path: str): method get_dict_str (line 172) | def get_dict_str(self): method get_dict_from_file (line 189) | def get_dict_from_file(self, dic_path: str): class SakuraTranslator (line 203) | class SakuraTranslator(CommonTranslator): method __init__ (line 223) | def __init__(self): method get_sakura_version (line 239) | def get_sakura_version(self): method get_dict_path (line 242) | def get_dict_path(self): method detect_and_caculate_repeats (line 245) | def detect_and_caculate_repeats(self, s: str, threshold: int = _REPEAT... method enlarge_small_kana (line 287) | def enlarge_small_kana(text, ignore=''): method _format_prompt_log (line 329) | def _format_prompt_log(self, prompt: str) -> str: method _split_text (line 352) | def _split_text(self, text: str) -> List[str]: method _preprocess_queries (line 360) | def _preprocess_queries(self, queries: List[str]) -> List[str]: method _check_translation_quality (line 371) | async def _check_translation_quality(self, queries: List[str], respons... method _detect_repeats (line 406) | def _detect_repeats(self, text: str, threshold: int = _REPEAT_DETECT_T... method _get_repeat_count (line 413) | def _get_repeat_count(self, text: str, threshold: int = _REPEAT_DETECT... method _check_align (line 420) | def _check_align(self, queries: List[str], response: str) -> bool: method _translate_single_lines (line 430) | async def _translate_single_lines(self, queries: List[str]) -> List[str]: method _delete_quotation_mark (line 444) | def _delete_quotation_mark(self, texts: List[str]) -> List[str]: method _translate (line 454) | async def _translate(self, from_lang: str, to_lang: str, queries: List... method _handle_translation_request (line 472) | async def _handle_translation_request(self, prompt: str) -> str: method _request_translation (line 504) | async def _request_translation(self, input_text_list) -> str: method _set_gpt_style (line 561) | def _set_gpt_style(self, style_name: str): FILE: manga_translator/translators/selective.py function prepare (line 11) | def prepare(translator_supplicant: Callable[[str], OfflineTranslator]): class SelectiveOfflineTranslator (line 15) | class SelectiveOfflineTranslator(OfflineTranslator): method __init__ (line 27) | def __init__(self): method select_translator (line 32) | def select_translator(self, from_lang: str, to_lang: str) -> OfflineTr... method translate (line 39) | async def translate(self, from_lang: str, to_lang: str, queries: List[... method load (line 54) | async def load(self, from_lang: str, to_lang: str, device: str): method reload (line 57) | async def reload(self, from_lang: str, to_lang: str, device: str): method _load (line 60) | async def _load(self, from_lang: str, to_lang: str, device: str): method _unload (line 63) | async def _unload(self): method _infer (line 66) | async def _infer(self, from_lang: str, to_lang: str, queries: List[str... FILE: manga_translator/translators/sugoi.py class JparacrawlTranslator (line 9) | class JparacrawlTranslator(OfflineTranslator): method _load (line 59) | async def _load(self, from_lang: str, to_lang: str, device: str): method _unload (line 82) | async def _unload(self): method infer (line 87) | async def infer(self, from_lang: str, to_lang: str, queries: List[str]... method _infer (line 98) | async def _infer(self, from_lang: str, to_lang: str, queries: List[str... method tokenize (line 112) | def tokenize(self, queries, lang): method detokenize (line 119) | def detokenize(self, queries, lang): class JparacrawlBigTranslator (line 124) | class JparacrawlBigTranslator(JparacrawlTranslator): class SugoiTranslator (line 142) | class SugoiTranslator(JparacrawlBigTranslator): method __init__ (line 163) | def __init__(self): method _load (line 167) | async def _load(self, from_lang: str, to_lang: str, device: str): method tokenize (line 172) | def tokenize(self, queries, lang): method detokenize (line 190) | def detokenize(self, queries, lang): FILE: manga_translator/translators/tokenizers/token_counters.py class deepseekTokenCounter (line 6) | class deepseekTokenCounter(): method __init__ (line 19) | def __init__(self): method count_tokens (line 26) | def count_tokens(self, text: str) -> int: class ChatGPTTokenCounter (line 34) | class ChatGPTTokenCounter(): method __init__ (line 46) | def __init__(self, CHATGPT_MODEL: str): method _get_encoder_for_model (line 49) | def _get_encoder_for_model(self, CHATGPT_MODEL: str) -> str: method count_tokens (line 67) | def count_tokens(self, text: str) -> int: FILE: manga_translator/translators/youdao.py function sha256_encode (line 12) | def sha256_encode(signStr): class YoudaoTranslator (line 17) | class YoudaoTranslator(CommonTranslator): method __init__ (line 41) | def __init__(self): method _translate (line 46) | async def _translate(self, from_lang, to_lang, queries): method _truncate (line 71) | def _truncate(self, q): method _do_request (line 77) | async def _do_request(self, data): FILE: manga_translator/upscaling/__init__.py function get_upscaler (line 17) | def get_upscaler(key: Upscaler, *args, **kwargs) -> CommonUpscaler: function prepare (line 25) | async def prepare(upscaler_key: Upscaler): function dispatch (line 30) | async def dispatch(upscaler_key: Upscaler, image_batch: List[Image.Image... function unload (line 38) | async def unload(upscaler_key: Upscaler): FILE: manga_translator/upscaling/common.py class CommonUpscaler (line 7) | class CommonUpscaler(InfererModule): method upscale (line 10) | async def upscale(self, image_batch: List[Image.Image], upscale_ratio:... method _upscale (line 36) | async def _upscale(self, image_batch: List[Image.Image], upscale_ratio... class OfflineUpscaler (line 39) | class OfflineUpscaler(CommonUpscaler, ModelWrapper): method _upscale (line 42) | async def _upscale(self, *args, **kwargs): method _infer (line 46) | async def _infer(self, image_batch: List[Image.Image], upscale_ratio: ... FILE: manga_translator/upscaling/esrgan.py class ESRGANUpscaler (line 57) | class ESRGANUpscaler(OfflineUpscaler): method _load (line 61) | async def _load(self, device: str): method _unload (line 64) | async def _unload(self): method _infer (line 67) | async def _infer(self, image_batch: List[Image.Image], upscale_ratio: ... method _run_esrgan_executable (line 95) | def _run_esrgan_executable(self, image_directory: str, output_director... FILE: manga_translator/upscaling/esrgan_pytorch.py class RRDBNet (line 28) | class RRDBNet(nn.Module): method __init__ (line 29) | def __init__(self, in_nc, out_nc, nf, nb, nr=3, gc=32, upscale=4, norm... method forward (line 67) | def forward(self, x, outm=None): class RRDB (line 78) | class RRDB(nn.Module): method __init__ (line 84) | def __init__(self, nf, nr=3, kernel_size=3, gc=32, stride=1, bias=1, p... method forward (line 105) | def forward(self, x): class ResidualDenseBlock_5C (line 115) | class ResidualDenseBlock_5C(nn.Module): method __init__ (line 126) | def __init__(self, nf=64, kernel_size=3, gc=32, stride=1, bias=1, pad_... method forward (line 154) | def forward(self, x): class GaussianNoise (line 174) | class GaussianNoise(nn.Module): method __init__ (line 175) | def __init__(self, sigma=0.1, is_relative_detach=False): method forward (line 181) | def forward(self, x): function conv1x1 (line 189) | def conv1x1(in_planes, out_planes, stride=1): class SRVGGNetCompact (line 197) | class SRVGGNetCompact(nn.Module): method __init__ (line 202) | def __init__(self, num_in_ch=3, num_out_ch=3, num_feat=64, num_conv=16... method forward (line 240) | def forward(self, x): class Upsample (line 256) | class Upsample(nn.Module): method __init__ (line 262) | def __init__(self, size=None, scale_factor=None, mode="nearest", align... method forward (line 272) | def forward(self, x): method extra_repr (line 275) | def extra_repr(self): function pixel_unshuffle (line 284) | def pixel_unshuffle(x, scale): function pixelshuffle_block (line 301) | def pixelshuffle_block(in_nc, out_nc, upscale_factor=2, kernel_size=3, s... function upconv_block (line 317) | def upconv_block(in_nc, out_nc, upscale_factor=2, kernel_size=3, stride=... function make_layer (line 338) | def make_layer(basic_block, num_basic_block, **kwarg): function act (line 352) | def act(act_type, inplace=True, neg_slope=0.2, n_prelu=1, beta=1.0): class Identity (line 370) | class Identity(nn.Module): method __init__ (line 371) | def __init__(self, *kwargs): method forward (line 374) | def forward(self, x, *kwargs): function norm (line 378) | def norm(norm_type, nc): function pad (line 392) | def pad(pad_type, padding): function get_valid_padding (line 408) | def get_valid_padding(kernel_size, dilation): class ShortcutBlock (line 414) | class ShortcutBlock(nn.Module): method __init__ (line 416) | def __init__(self, submodule): method forward (line 420) | def forward(self, x): method __repr__ (line 424) | def __repr__(self): function sequential (line 428) | def sequential(*args): function conv_block (line 444) | def conv_block(in_nc, out_nc, kernel_size, stride=1, dilation=1, groups=... function infer_params (line 479) | def infer_params(state_dict): class ESRGANUpscalerPytorch (line 512) | class ESRGANUpscalerPytorch(OfflineUpscaler): method _load (line 521) | async def _load(self, device: str): method _unload (line 534) | async def _unload(self): method _infer (line 537) | async def _infer(self, image_batch: List[Image.Image], upscale_ratio: ... function test (line 551) | def test() : FILE: manga_translator/upscaling/waifu2x.py class Waifu2xUpscaler (line 52) | class Waifu2xUpscaler(OfflineUpscaler): # ~2GB of vram method __init__ (line 56) | def __init__(self, *args, **kwargs): method _load (line 62) | async def _load(self, device: str): method _unload (line 65) | async def _unload(self): method _infer (line 68) | async def _infer(self, image_batch: List[Image.Image], upscale_ratio: ... method _run_waifu2x_executable (line 96) | def _run_waifu2x_executable(self, image_directory: str, output_directo... FILE: manga_translator/utils/bubble.py function check_color (line 4) | def check_color(image): function is_ignore (line 28) | def is_ignore(region_img, ignore_bubble = 0): FILE: manga_translator/utils/generic.py class Context (line 28) | class Context(dict): method __init__ (line 29) | def __init__(self, **kwargs): method __getattr__ (line 33) | def __getattr__(self, item): method __delattr__ (line 36) | def __delattr__(self, key) -> None: method __setattr__ (line 39) | def __setattr__(self, key, value): method __getstate__ (line 42) | def __getstate__(self): method __setstate__ (line 45) | def __setstate__(self, state): method __eq__ (line 48) | def __eq__(self, other): method __contains__ (line 53) | def __contains__(self, key): method __repr__ (line 56) | def __repr__(self): method _get_kwargs (line 71) | def _get_kwargs(self): method _get_args (line 74) | def _get_args(self): function atoi (line 79) | def atoi(text: str) -> int | str: function natural_sort (line 82) | def natural_sort(l: List[str]): function repeating_sequence (line 85) | def repeating_sequence(s: str): function count_valuable_text (line 93) | def count_valuable_text(text: str) -> int: function replace_prefix (line 96) | def replace_prefix(s: str, old: str, new: str): function chunks (line 101) | def chunks(lst, n): function get_digest (line 106) | def get_digest(file_path: str) -> str: function get_image_md5 (line 119) | def get_image_md5(image) -> str: function get_filename_from_url (line 142) | def get_filename_from_url(url: str, default: str = '') -> str: function download_url_with_progressbar (line 148) | def download_url_with_progressbar(url: str, path: str): function prompt_yes_no (line 193) | def prompt_yes_no(query: str, default: bool = None) -> bool: class AvgMeter (line 206) | class AvgMeter(): method __init__ (line 207) | def __init__(self): method reset (line 210) | def reset(self): method __call__ (line 214) | def __call__(self, val = None): function load_image (line 223) | def load_image(img: Image.Image) -> Tuple[np.ndarray, Optional[Image.Ima... function dump_image (line 241) | def dump_image(img_pil: Image.Image, img: np.ndarray, alpha_ch: Image.Im... function resize_keep_aspect (line 251) | def resize_keep_aspect(img, size): function image_resize (line 257) | def image_resize(image, width = None, height = None, inter = cv2.INTER_A... function resize_polygon (line 288) | def resize_polygon(pts, xfact, yfact, origin='center'): class BBox (line 294) | class BBox(object): method __init__ (line 295) | def __init__(self, x: int, y: int, w: int, h: int, text: str, prob: fl... method width (line 309) | def width(self): method height (line 312) | def height(self): method to_points (line 315) | def to_points(self): method xywh (line 320) | def xywh(self): function sort_pnts (line 324) | def sort_pnts(pts: np.ndarray): class Quadrilateral (line 356) | class Quadrilateral(object): method __init__ (line 360) | def __init__(self, pts: np.ndarray, text: str, prob: float, fg_r: int ... method structure (line 378) | def structure(self) -> List[np.ndarray]: method valid (line 386) | def valid(self) -> bool: method fg_colors (line 397) | def fg_colors(self): method bg_colors (line 401) | def bg_colors(self): method aspect_ratio (line 405) | def aspect_ratio(self) -> float: method font_size (line 413) | def font_size(self) -> float: method width (line 419) | def width(self) -> int: method height (line 422) | def height(self) -> int: method xyxy (line 426) | def xyxy(self): method clip (line 429) | def clip(self, width, height): method aabb (line 439) | def aabb(self) -> BBox: method get_transformed_region (line 445) | def get_transformed_region(self, img, direction, textheight) -> np.nda... method is_axis_aligned (line 484) | def is_axis_aligned(self) -> bool: method is_approximate_axis_aligned (line 497) | def is_approximate_axis_aligned(self) -> bool: method cosangle (line 510) | def cosangle(self) -> float: method angle (line 518) | def angle(self) -> float: method centroid (line 522) | def centroid(self) -> np.ndarray: method distance_to_point (line 525) | def distance_to_point(self, p: np.ndarray) -> float: method polygon (line 533) | def polygon(self) -> Polygon: method area (line 537) | def area(self) -> float: method poly_distance (line 540) | def poly_distance(self, other) -> float: method distance (line 543) | def distance(self, other, rho = 0.5) -> float: method distance_impl (line 546) | def distance_impl(self, other, rho = 0.5) -> float: method copy (line 598) | def copy(self, new_pts: np.ndarray): function distance_point_point (line 616) | def distance_point_point(a: np.ndarray, b: np.ndarray) -> float: function distance_point_lineseg (line 620) | def distance_point_lineseg(p: np.ndarray, p1: np.ndarray, p2: np.ndarray): function quadrilateral_can_merge_region (line 653) | def quadrilateral_can_merge_region(a: Quadrilateral, b: Quadrilateral, r... function quadrilateral_can_merge_region_coarse (line 700) | def quadrilateral_can_merge_region_coarse(a: Quadrilateral, b: Quadrilat... function findNextPowerOf2 (line 716) | def findNextPowerOf2(n): class Point (line 723) | class Point: method __init__ (line 724) | def __init__(self, x = 0, y = 0): method length2 (line 728) | def length2(self) -> float: method length (line 731) | def length(self) -> float: method __str__ (line 734) | def __str__(self): method __add__ (line 737) | def __add__(self, other): method __sub__ (line 742) | def __sub__(self, other): method __mul__ (line 747) | def __mul__(self, other): method __truediv__ (line 753) | def __truediv__(self, other): method neg (line 756) | def neg(self): method normalize (line 759) | def normalize(self): function center_of_points (line 762) | def center_of_points(pts: List[Point]) -> Point: function support_impl (line 771) | def support_impl(pts: List[Point], d: Point) -> Point: function support (line 781) | def support(a: List[Point], b: List[Point], d: Point) -> Point: function cross (line 784) | def cross(a: Point, b: Point, c: Point) -> Point: function closest_point_to_origin (line 787) | def closest_point_to_origin(a: Point, b: Point) -> Point: function dcmp (line 799) | def dcmp(a) -> bool: function gjk_distance (line 804) | def gjk_distance(s1: List[Point], s2: List[Point]) -> float: function rgb2hex (line 830) | def rgb2hex(r,g,b): function hex2rgb (line 833) | def hex2rgb(h): function get_color_name (line 837) | def get_color_name(rgb: List[int]) -> str: function square_pad_resize (line 849) | def square_pad_resize(img: np.ndarray, tgt_size: int): function det_rearrange_forward (line 876) | def det_rearrange_forward( function main (line 1000) | def main(): FILE: manga_translator/utils/generic2.py function color_difference (line 10) | def color_difference(rgb1: List, rgb2: List) -> float: function is_punctuation (line 21) | def is_punctuation(ch): function is_whitespace (line 37) | def is_whitespace(ch): function is_control (line 49) | def is_control(ch): function is_valuable_char (line 61) | def is_valuable_char(ch): function is_valuable_text (line 66) | def is_valuable_text(text): function dist (line 73) | def dist(x1, y1, x2, y2): function rect_distance (line 77) | def rect_distance(x1, y1, x1b, y1b, x2, y2, x2b, y2b): function is_right_to_left_char (line 102) | def is_right_to_left_char(ch): FILE: manga_translator/utils/inference.py class InfererModule (line 24) | class InfererModule(ABC): method __init__ (line 25) | def __init__(self): method parse_args (line 29) | def parse_args(self, args: TranslatorConfig): class ModelVerificationException (line 54) | class ModelVerificationException(Exception): class InvalidModelMappingException (line 57) | class InvalidModelMappingException(ValueError): method __init__ (line 58) | def __init__(self, cls: str, map_key: str, error_msg: str): class ModelWrapper (line 62) | class ModelWrapper(ABC): method __init__ (line 99) | def __init__(self): method is_loaded (line 106) | def is_loaded(self) -> bool: method is_downloaded (line 109) | def is_downloaded(self) -> bool: method model_dir (line 113) | def model_dir(self): method _get_file_path (line 116) | def _get_file_path(self, *args) -> str: method _get_used_gpu_memory (line 119) | def _get_used_gpu_memory(self) -> bool: method _check_for_malformed_model_mapping (line 127) | def _check_for_malformed_model_mapping(self): method _download_file (line 138) | async def _download_file(self, url: str, path: str): method _verify_file (line 142) | async def _verify_file(self, sha256_pre_calculated: str, path: str): method _on_verify_failure (line 152) | def _on_verify_failure(self, sha256_calculated: str, sha256_pre_calcul... method _temp_working_directory (line 157) | def _temp_working_directory(self): method download (line 162) | async def download(self, force=False): method _download (line 177) | async def _download(self): method _on_download_finished (line 265) | def _on_download_finished(self, map_key): method _check_downloaded (line 271) | def _check_downloaded(self) -> bool: method _check_downloaded_map (line 281) | def _check_downloaded_map(self, map_key: str) -> bool: method _grant_execute_permissions (line 310) | def _grant_execute_permissions(self, map_key: str): method reload (line 324) | async def reload(self, device: str, *args, **kwargs): method load (line 328) | async def load(self, device: str, *args, **kwargs): method unload (line 338) | async def unload(self): method infer (line 343) | async def infer(self, *args, **kwargs): method _load (line 353) | async def _load(self, device: str, *args, **kwargs): method _unload (line 357) | async def _unload(self): method _infer (line 361) | async def _infer(self, *args, **kwargs): FILE: manga_translator/utils/log.py class Formatter (line 8) | class Formatter(logging.Formatter): method formatMessage (line 9) | def formatMessage(self, record: logging.LogRecord) -> str: class Filter (line 20) | class Filter(logging.Filter): method filter (line 21) | def filter(self, record: logging.LogRecord) -> bool: function init_logging (line 31) | def init_logging(): function set_log_level (line 37) | def set_log_level(level): function get_logger (line 40) | def get_logger(name: str): function add_file_logger (line 45) | def add_file_logger(path: str): function remove_file_logger (line 51) | def remove_file_logger(path: str): FILE: manga_translator/utils/panel/__init__.py function get_panels_from_array (line 4) | def get_panels_from_array(img_rgb, rtl=True): FILE: manga_translator/utils/panel/kumikolib.py class Kumiko (line 14) | class Kumiko: method __init__ (line 18) | def __init__(self, options = None): method parse_url_list (line 32) | def parse_url_list(self, urls): method parse_pdf_file (line 57) | def parse_pdf_file(self, pdf_filename): method parse_dir (line 71) | def parse_dir(self, directory, urls = None): method parse_images (line 77) | def parse_images(self, filenames, urls = None): method parse_image (line 93) | def parse_image(self, filename, url = None): method get_infos (line 104) | def get_infos(self): method save_panels (line 107) | def save_panels(self, output_base_path = 'auto', output_format = "jpg"): FILE: manga_translator/utils/sort.py function sort_regions (line 10) | def sort_regions( function _simple_sort (line 122) | def _simple_sort(regions: List[TextBlock], right_to_left: bool) -> List[... function _sort_panels_fill (line 153) | def _sort_panels_fill(panels: List[Tuple[int, int, int, int]], right_to_... function visualize_textblocks (line 199) | def visualize_textblocks(canvas: np.ndarray, blk_list: List[TextBlock], ... FILE: manga_translator/utils/textblock.py class TextBlock (line 39) | class TextBlock(object): method __init__ (line 44) | def __init__(self, lines: List[Tuple[int, int, int, int]], method xyxy (line 121) | def xyxy(self): method xywh (line 130) | def xywh(self): method center (line 135) | def center(self) -> np.ndarray: method unrotated_polygons (line 140) | def unrotated_polygons(self) -> np.ndarray: method unrotated_min_rect (line 147) | def unrotated_min_rect(self) -> np.ndarray: method min_rect (line 157) | def min_rect(self) -> np.ndarray: method polygon_aspect_ratio (line 169) | def polygon_aspect_ratio(self) -> float: method unrotated_size (line 178) | def unrotated_size(self) -> Tuple[int, int]: method aspect_ratio (line 186) | def aspect_ratio(self) -> float: method polygon_object (line 191) | def polygon_object(self) -> Polygon: method area (line 196) | def area(self) -> float: method real_area (line 200) | def real_area(self) -> float: method normalized_width_list (line 204) | def normalized_width_list(self) -> List[float]: method __len__ (line 213) | def __len__(self): method __getitem__ (line 216) | def __getitem__(self, idx): method to_dict (line 219) | def to_dict(self): method get_transformed_region (line 223) | def get_transformed_region(self, img: np.ndarray, line_idx: int, texth... method source_lang (line 286) | def source_lang(self): method get_translation_for_rendering (line 291) | def get_translation_for_rendering(self): method is_bulleted_list (line 321) | def is_bulleted_list(self): method set_font_colors (line 343) | def set_font_colors(self, fg_colors, bg_colors): method update_font_colors (line 347) | def update_font_colors(self, fg_colors: np.ndarray, bg_colors: np.ndar... method get_font_colors (line 353) | def get_font_colors(self, bgr=False): method direction (line 370) | def direction(self): method vertical (line 412) | def vertical(self): method horizontal (line 416) | def horizontal(self): method alignment (line 420) | def alignment(self): method stroke_width (line 459) | def stroke_width(self): function rotate_polygons (line 466) | def rotate_polygons(center, polygons, rotation, new_center=None, to_int=... FILE: manga_translator/utils/threading.py class PriorityLock (line 3) | class PriorityLock: class _Context (line 8) | class _Context: method __init__ (line 9) | def __init__(self, lock: 'PriorityLock', priority: int): method __aenter__ (line 13) | async def __aenter__(self): method __aexit__ (line 16) | async def __aexit__(self, exc_type, exc_val, exc_tb): method __init__ (line 19) | def __init__(self): method acquire (line 24) | async def acquire(self, priority: int): method release (line 35) | async def release(self): method __call__ (line 45) | def __call__(self, priority: int): class Throttler (line 48) | class Throttler: method __init__ (line 69) | def __init__(self, rate): method wrap (line 75) | def wrap(self, func): method __call__ (line 80) | async def __call__(self, func, *args, **kwargs): method flush (line 101) | async def flush(self): FILE: pip-modules/mit-renderer/setup.py function fix_imports (line 21) | def fix_imports(content): function build_files (line 29) | def build_files(): class build_py (line 47) | class build_py(_build_py): method run (line 48) | def run(self): FILE: server/args.py function url_decode (line 5) | def url_decode(s): function path (line 12) | def path(string): function file_path (line 20) | def file_path(string): function dir_path (line 28) | def dir_path(string): function parse_arguments (line 36) | def parse_arguments(): FILE: server/instance.py class ExecutorInstance (line 10) | class ExecutorInstance(BaseModel): method free_executor (line 15) | def free_executor(self): method sent (line 18) | async def sent(self, image: Image, config: Config): method sent_stream (line 21) | async def sent_stream(self, image: Image, config: Config, sender: Noti... method sent_batch (line 24) | async def sent_batch(self, images: List[Image.Image], config: Config, ... method sent_batch_stream (line 29) | async def sent_batch_stream(self, images: List[Image.Image], config: C... class Executors (line 34) | class Executors: method __init__ (line 35) | def __init__(self): method register (line 40) | def register(self, instance: ExecutorInstance): method free_executors (line 43) | def free_executors(self) -> int: method _find_instance (line 46) | async def _find_instance(self): method find_executor (line 54) | async def find_executor(self) -> ExecutorInstance: method free_executor (line 60) | async def free_executor(self, instance: ExecutorInstance): FILE: server/main.py function register_instance (line 46) | async def register_instance(instance: ExecutorInstance, req: Request, re... function transform_to_image (line 52) | def transform_to_image(ctx): function transform_to_json (line 65) | def transform_to_json(ctx): function transform_to_bytes (line 68) | def transform_to_bytes(ctx): function json (line 72) | async def json(req: Request, data: TranslateRequest): function bytes (line 77) | async def bytes(req: Request, data: TranslateRequest): function image (line 82) | async def image(req: Request, data: TranslateRequest) -> StreamingResponse: function stream_json (line 91) | async def stream_json(req: Request, data: TranslateRequest) -> Streaming... function stream_bytes (line 95) | async def stream_bytes(req: Request, data: TranslateRequest)-> Streaming... function stream_image (line 99) | async def stream_image(req: Request, data: TranslateRequest) -> Streamin... function json_form (line 103) | async def json_form(req: Request, image: UploadFile = File(...), config:... function bytes_form (line 110) | async def bytes_form(req: Request, image: UploadFile = File(...), config... function image_form (line 117) | async def image_form(req: Request, image: UploadFile = File(...), config... function stream_json_form (line 128) | async def stream_json_form(req: Request, image: UploadFile = File(...), ... function stream_bytes_form (line 138) | async def stream_bytes_form(req: Request, image: UploadFile = File(...),... function stream_image_form (line 144) | async def stream_image_form(req: Request, image: UploadFile = File(...),... function stream_image_form_web (line 153) | async def stream_image_form_web(req: Request, image: UploadFile = File(.... function queue_size (line 162) | async def queue_size() -> int: function get_result_by_folder (line 167) | async def get_result_by_folder(folder_name: str): function batch_json (line 192) | async def batch_json(req: Request, data: BatchTranslateRequest): function batch_images (line 198) | async def batch_images(req: Request, data: BatchTranslateRequest): function index (line 228) | async def index() -> HTMLResponse: function manual (line 235) | async def manual(): function generate_nonce (line 241) | def generate_nonce(): function start_translator_client_proc (line 244) | def start_translator_client_proc(host: str, port: int, nonce: str, param... function prepare (line 281) | def prepare(args): function simple_execute_batch (line 295) | async def simple_execute_batch(req: Request, data: BatchTranslateRequest): function execute_batch_stream (line 311) | async def execute_batch_stream(req: Request, data: BatchTranslateRequest): function list_results (line 326) | async def list_results(): function clear_results (line 345) | async def clear_results(): function delete_result (line 366) | async def delete_result(folder_name: str): FILE: server/myqueue.py class QueueElement (line 13) | class QueueElement: method __init__ (line 18) | def __init__(self, req: Request, image: Image.Image, config: Config, l... method get_image (line 27) | def get_image(self)-> Image: method __del__ (line 33) | def __del__(self): method is_client_disconnected (line 37) | async def is_client_disconnected(self) -> bool: class BatchQueueElement (line 43) | class BatchQueueElement: method __init__ (line 50) | def __init__(self, req: Request, images: List[Image.Image], config: Co... method is_client_disconnected (line 56) | async def is_client_disconnected(self) -> bool: class TaskQueue (line 62) | class TaskQueue: method __init__ (line 63) | def __init__(self): method add_task (line 67) | def add_task(self, task: QueueElement | BatchQueueElement): method get_pos (line 70) | def get_pos(self, task: QueueElement | BatchQueueElement) -> Optional[... method update_event (line 75) | async def update_event(self): method remove (line 80) | async def remove(self, task: QueueElement | BatchQueueElement): method wait_for_event (line 84) | async def wait_for_event(self): function wait_in_queue (line 89) | async def wait_in_queue(task: QueueElement | BatchQueueElement, notify: ... FILE: server/request_extraction.py class TranslateRequest (line 18) | class TranslateRequest(BaseModel): class BatchTranslateRequest (line 25) | class BatchTranslateRequest(BaseModel): function to_pil_image (line 34) | async def to_pil_image(image: Union[str, bytes]) -> Image.Image: function get_ctx (line 53) | async def get_ctx(req: Request, config: Config, image: str|bytes): function while_streaming (line 61) | async def while_streaming(req: Request, transform, config: Config, image... function get_batch_ctx (line 75) | async def get_batch_ctx(req: Request, config: Config, images: list[str|b... FILE: server/sent_data_internal.py function fetch_data_stream (line 12) | async def fetch_data_stream(url, image: Image, config: Config, sender: N... function fetch_data (line 23) | async def fetch_data(url, image: Image, config: Config, headers: Mapping... function process_stream (line 34) | async def process_stream(response, sender: NotifyType): function handle_buffer (line 44) | def handle_buffer(buffer, sender: NotifyType): function extract_header (line 57) | def extract_header(buffer): FILE: server/streaming.py function stream (line 4) | async def stream(messages): function notify (line 11) | def notify(code: int, data: bytes, transform_to_bytes, messages: asyncio... FILE: server/to_json.py class TextColor (line 32) | class TextColor(BaseModel): class Translation (line 36) | class Translation(BaseModel): class Config (line 52) | class Config: method encode_background (line 59) | def encode_background(array: np.ndarray) -> str: method to_bytes (line 65) | def to_bytes(self): class TranslationResponse (line 79) | class TranslationResponse(BaseModel): method to_bytes (line 83) | def to_bytes(self): function to_translation (line 87) | def to_translation(ctx: Context) -> TranslationResponse: FILE: test/conftest.py function pytest_addoption (line 4) | def pytest_addoption(parser): function translator (line 11) | def translator(request): function tgt_lang (line 15) | def tgt_lang(request): function text (line 19) | def text(request): function count (line 23) | def count(request): FILE: test/test_render.py function save_result (line 17) | def save_result(path, img, regions): function test_default_renderer (line 23) | async def test_default_renderer(): FILE: test/test_textline_merge.py function save_regions_to_image (line 16) | def save_regions_to_image(path: str, regions: TextBlock, width: int, hei... function find_region_containing_line (line 20) | def find_region_containing_line(line, regions): function generate_combinations (line 30) | async def generate_combinations(lines: List[List[List[int]]], width: int... function run_test (line 47) | async def run_test(lines: List, expected_combinations: List, width: int,... function test_merge_image1 (line 76) | async def test_merge_image1(): # demo/image/original3.jpg function test_merge_image1_upscaled (line 106) | async def test_merge_image1_upscaled(): # demo/image/original3.jpg upsca... function test_merge_image2 (line 136) | async def test_merge_image2(): function test_merge_image3 (line 162) | async def test_merge_image3(): function test_merge_image4 (line 183) | async def test_merge_image4(): # Issue #215 function test_merge_image5 (line 202) | async def test_merge_image5(): # Issue #221 function test_merge_image6 (line 224) | async def test_merge_image6(): function test_merge_image7 (line 264) | async def test_merge_image7(): function test_merge_image8 (line 297) | async def test_merge_image8(): function test_merge_image9 (line 330) | async def test_merge_image9(): function test_merge_image10 (line 347) | async def test_merge_image10(): FILE: test/test_translation.py function test_mixed_languages (line 13) | async def test_mixed_languages(): function test_single_language (line 22) | async def test_single_language(): function test_chain (line 31) | async def test_chain(): function test_online_translators (line 40) | async def test_online_translators(): function test_offline_translators (line 52) | async def test_offline_translators(): FILE: test/test_translation_manual.py function test_specified_translator (line 9) | async def test_specified_translator(translator, tgt_lang, text, count): FILE: training/ocr/custom_ctc.cc type at (line 34) | namespace at { namespace native { type native (line 34) | namespace native { function fill_non_native_type (line 38) | void fill_non_native_type(TensorIterator& iter, const Scalar& value_... function fill_kernel (line 60) | void fill_kernel(TensorIterator& iter, const Scalar& value_scalar) { function get_target_prime (line 89) | static inline int64_t get_target_prime(target_t* target, int64_t offset,... function scalar_t (line 99) | scalar_t custom_distance_forward_log(scalar_t x, scalar_t mu, scalar_t s... function scalar_t (line 105) | scalar_t custom_distance_backward(scalar_t x, scalar_t mu, scalar_t sigm... function scalar_t (line 112) | scalar_t custom_distance_forward_log_l1(scalar_t x, scalar_t mu, scalar_... function scalar_t (line 118) | scalar_t sgn(scalar_t v) noexcept { function scalar_t (line 126) | scalar_t custom_distance_backward_l1(scalar_t x, scalar_t mu, scalar_t s... function scalar_t (line 133) | scalar_t custom_distance_backward_log(scalar_t x, scalar_t mu) { function scalar_t (line 139) | scalar_t custom_distance_forward(scalar_t x, scalar_t mu) { function custom_ctc_loss_cpu_template (line 149) | std::tuple custom_ctc_loss_cpu_template( function custom_ctc_loss_backward_cpu_template (line 321) | std::tuple custom_ctc_loss_backward_cpu_template( function custom_ctc_loss_cpu (line 563) | std::tuple custom_ctc_loss_cpu( function custom_ctc_loss_backward_cpu (line 589) | std::tuple custom_ctc_loss_backward_cpu( function PYBIND11_MODULE (line 617) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: training/ocr/custom_ctc.py class CustomCTCLossFunction (line 7) | class CustomCTCLossFunction(torch.autograd.Function): method forward (line 9) | def forward( method backward (line 40) | def backward(ctx, grad_out): FILE: training/ocr/custom_ctc_cuda_driver.cc function custom_ctc_loss_gpu_driver (line 37) | std::tuple custom_ctc_loss_gpu_driver( function custom_ctc_loss_backward_gpu_driver (line 57) | std::tuple custom_ctc_loss_backward_gpu_driver( function PYBIND11_MODULE (line 79) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: training/ocr/custom_ctc_gpu.py class CustomCTCLossFunction (line 7) | class CustomCTCLossFunction(torch.autograd.Function): method forward (line 9) | def forward( method backward (line 50) | def backward(ctx, grad_out): FILE: training/ocr/test_ctc.py function test_ctc_loss_custom (line 14) | def test_ctc_loss_custom(device): function test_ctc_loss_custom_gpu (line 73) | def test_ctc_loss_custom_gpu(device, fp = torch.float32):