Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: I want the text masking to be smoother, my default is very coarse. #825

Open
maxsteel1d opened this issue Jan 11, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@maxsteel1d
Copy link

Issue

this is my config.json:
{
"filter_text": null,
"render": {
"renderer": "default",
"alignment": "auto",
"disable_font_border": false,
"font_size_offset": 0,
"font_size_minimum": -1,
"direction": "auto",
"uppercase": false,
"lowercase": false,
"gimp_font": "Sans-serif",
"no_hyphenation": false,
"font_color": null,
"line_spacing": null,
"font_size": null
},
"upscale": {
"upscaler": "esrgan",
"revert_upscaling": false,
"upscale_ratio": null
},
"translator": {
"translator": "deepl",
"target_lang": "ENG",
"no_text_lang_skip": false,
"skip_lang": null,
"gpt_config": null,
"translator_chain": null,
"selective_translation": null
},
"detector": {
"detector": "default",
"detection_size": 1536,
"text_threshold": 0.5,
"det_rotate": false,
"det_auto_rotate": false,
"det_invert": false,
"det_gamma_correct": false,
"box_threshold": 0.7,
"unclip_ratio": 2.3
},
"colorizer": {
"colorization_size": 576,
"denoise_sigma": 30,
"colorizer": "none"
},
"inpainter": {
"inpainter": "none",
"inpainting_size": 2048,
"inpainting_precision": "fp32"
},
"ocr": {
"use_mocr_merge": true,
"ocr": "mocr",
"min_text_length": 0,
"ignore_bubble": 0
},
"kernel_size": 3,
"mask_dilation_offset": 0
}

This is a result of this page: https://touhou.ai/imgtrans/

soft
this one is generated by mine:
hard

-I don't know much about programming and I don't know how to give the results you show in your project.
-could someone help me in this section please
I can't put the whole console because I fill up too much text but the vast majority of it was just this:
"id2label": {
"0": "tench, Tinca tinca",
"1": "goldfish, Carassius auratus",
"2": "great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias",
"3": "tiger shark, Galeocerdo cuvieri",
"4": "hammerhead, hammerhead shark",
"5": "electric ray, crampfish, numbfish, torpedo",
etc

},
"image_size": 224,
"initializer_range": 0.02,
"intermediate_size": 3072,
"label2id": {
"Afghan hound, Afghan": 160,
"African chameleon, Chamaeleo chamaeleon": 47,
"African crocodile, Nile crocodile, Crocodylus niloticus": 49,
etc

Command Line Arguments

python -m manga_translator local -i "E:\comic\traductor de imagenes de manga-zyddnys\probar" --config-file "E:\comic\traductor de imagenes de manga-zyddnys\manga-image-translator\config.json" --dest "E:\comic\traductor de imagenes de manga-zyddnys\probar-translated" --use-gpu

Console logs

(venv) E:\comic\traductor de imagenes de manga-zyddnys\manga-image-translator>python -m manga_translator local -i "E:\comic\traductor de imagenes de manga-zyddnys\probar" --config-file "E:\comic\traductor de imagenes de manga-zyddnys\manga-image-translator\config.json" --dest "E:\comic\traductor de imagenes de manga-zyddnys\probar-translated" --use-gpu
[local] Running in local mode
[local] Loading models
2025-01-10 23:44:35.133 | INFO     | manga_ocr.ocr:__init__:16 - Loading OCR model from kha-white/manga-ocr-base
Config of the encoder: <class 'transformers.models.vit.modeling_vit.ViTModel'> is overwritten by shared encoder config: ViTConfig {
  "_name_or_path": "facebook/deit-base-patch16-224",
  "architectures": [
    "ViTForImageClassification"
--------is trimmed only important is this
  ],
  "attention_probs_dropout_prob": 0.0,
  "encoder_stride": 16,
  "hidden_act": "gelu",
  "hidden_dropout_prob": 0.0,
  "hidden_size": 768,
 },
  "layer_norm_eps": 1e-12,
  "model_type": "vit",
  "num_attention_heads": 12,
  "num_channels": 3,
  "num_hidden_layers": 12,
  "patch_size": 16,
  "qkv_bias": true,
  "transformers_version": "4.47.1"
}

Config of the decoder: <class 'transformers.models.bert.modeling_bert.BertLMHeadModel'> is overwritten by shared decoder config: BertConfig {
  "_name_or_path": "cl-tohoku/bert-base-japanese-char-v2",
  "add_cross_attention": true,
  "architectures": [
    "BertForMaskedLM"
  ],
  "attention_probs_dropout_prob": 0.1,
  "classifier_dropout": null,
  "hidden_act": "gelu",
  "hidden_dropout_prob": 0.1,
  "hidden_size": 768,
  "initializer_range": 0.02,
  "intermediate_size": 3072,
  "is_decoder": true,
  "layer_norm_eps": 1e-12,
  "max_length": 300,
  "max_position_embeddings": 512,
  "model_type": "bert",
  "num_attention_heads": 12,
  "num_hidden_layers": 2,
  "pad_token_id": 0,
  "position_embedding_type": "absolute",
  "tokenizer_class": "BertJapaneseTokenizer",
  "transformers_version": "4.47.1",
  "type_vocab_size": 2,
  "use_cache": true,
  "vocab_size": 6144
}

2025-01-10 23:44:38.446 | INFO     | manga_ocr.ocr:__init__:22 - Using CUDA
2025-01-10 23:44:39.185 | INFO     | manga_ocr.ocr:__init__:35 - OCR ready
[local] Running text detection
[DefaultDetector] Detection resolution: 1280x1536
[local] Running ocr
[ModelMangaOCR] prob: 0.9726269245147705 キャラクター服装はかなりませんが、イタダスストも fg: (248, 247, 246) bg: (248, 247, 246)
[ModelMangaOCR] prob: 0.6924540848711753 周作は大統領ノートレーションのご提供をご提案ください。 fg: (241, 238, 239) bg: (241, 238, 238)
[ModelMangaOCR] prob: 0.9999750942213916 【勇者】はそれを逆手に取った fg: (1, 2, 1) bg: (1, 2, 1)
[ModelMangaOCR] prob: 0.8438133788193031 6体が同時に最適解を実行する fg: (2, 5, 2) bg: (2, 5, 2)
[ModelMangaOCR] prob: 0.8966749907711183 構霊の分身は6体全てが情報を共有し6倍の速さで侵入者を排除する最適解を模索する fg: (3, 4, 1) bg: (3, 4, 1)
[ModelMangaOCR] prob: 0.9937138773523349 この戦いは『情報戦』でもあった fg: (24, 27, 24) bg: (129, 130, 126)
[ModelMangaOCR] prob: 0.7375479936599731 【速転攻勢なるかー!? fg: (248, 245, 246) bg: (248, 245, 246)
[ModelMangaOCR] prob: 0.9909202456474304 questi27〈臨回〉 fg: (246, 248, 247) bg: (246, 248, 247)
[ModelMangaOCR] prob: 0.5913243889808655 消豺ラ判ァ fg: (49, 38, 34) bg: (231, 226, 220)
[local] No pre-translation replacements made.
[local] Removed unpaired symbols from "速転攻勢なるかー!?"
[local] Running text translation
[DeeplTranslator] Translating into English
[DeeplTranslator] 0: questi27〈臨回〉 => QUESTI 27
[DeeplTranslator] 1: 消豺ラ判ァ => Rafael.
[DeeplTranslator] 2: この戦いは『情報戦』でもあった => This battle was also an "information war".
[DeeplTranslator] 3: 速転攻勢なるかー!? => Will there be a quick turnaround offensive?
[DeeplTranslator] 4: 構霊の分身は6体全てが情報を共有し6倍の速さで侵入者を排除する最適解を模索する => All six alter egos will share information and search for the best solution to eliminate the intruder at six times the speed.
[DeeplTranslator] 5: 6体が同時に最適解を実行する => All six simultaneously execute the optimal solution.
[DeeplTranslator] 6: 【勇者】はそれを逆手に取った => The heroes took advantage of this.
[DeeplTranslator] 7: 周作は大統領ノートレーションのご提供をご提案ください。 => Please suggest that the circumscription provide a presidential notation.
[DeeplTranslator] 8: キャラクター服装はかなりませんが、イタダスストも => No character attire pretty much, but also itadasust.
[local] No post-translation replacements made.
[local] Running mask refinement
[mask]: 100%|████████████████████████████████████████████████████████████████████████████| 9/9 [00:00<00:00, 26.84it/s]
[local] Running rendering
[render]: 100%|██████████████████████████████████████████████████████████████████████████| 9/9 [00:01<00:00,  5.14it/s]
@maxsteel1d maxsteel1d added the bug Something isn't working label Jan 11, 2025
@www3199
Copy link

www3199 commented Jan 11, 2025

"inpainter": {
"inpainter": "none", // Use "lama_large"
"inpainting_size": 2048, // Size of image used for inpainting (too large will result in OOM)
"inpainting_precision": "fp32" // Inpainting precision for lama, use "bf16" while you can.
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants