Giter VIP home page Giter VIP logo

manga-colorizer's Introduction

Hello there 👋


  • 👯 I’m looking to collaborate on any deep learning research
  • ⚡ Fun fact: Best way to learn about something is to make an interesting project


manga-colorizer's People

Contributors

binitdox avatar vatavian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

manga-colorizer's Issues

Kaggle issues

I'm currently getting issues trying to run the Kaggle api i think it may be to do with the first line and kaggle says::
fatal: unable to access 'https://github.com/BinitDOX/Manga-Colorizer.git/': Could not resolve host: github.com add Code add Markdown

and the other is:::

FileNotFoundError Traceback (most recent call last)
Cell In[44], line 2
1 import os
----> 2 os.chdir("/kaggle/working/Manga-Colorizer/Backend")

FileNotFoundError: [Errno 2] No such file or directory: '/kaggle/working/Manga-Colorizer/Backend'
I am not too knowledgeable into this type of stuff so I do not know how to fix it so any help or ideas would be great

Color tolerance doesn't work properly

There are images that are perceived by MC as colored, but in appearance they are black and white.
E.g.
https://mangadex.org/chapter/4927a00e-8748-4435-bc8c-0d71694759e0/5

When I use the minimum value of the "Color Tolerance" parameter of 250, at which such images begin to be processed by MC, there are color images that also begin to be processed.

https://mangadex.org/chapter/4927a00e-8748-4435-bc8c-0d71694759e0/21

At the same time, if I use inference.py from https://github.com/xiaogdgenuine/Manga-Colorization-FJ to colorize the same images, but downloaded locally, such thing doesn't occur.

Issue with the color quality of the generated images

Right away I want to thank you for this wonderful software that allows to colorize manga on the fly.
I've known about the source app for a while now - https://github.com/qweasdd/manga-colorization-v2/, and I'm familiar with its
limitation where processing images wider than 576px results in incorrect coloring.

Is it possible to colorize the image at a size most suitable for the program, i.e. x=576px, and only after this, scale it to a larger size?

Let me explain with an example.

https://mangadex.org/chapter/d72a3eb8-2b20-4c39-a46f-d282eb05e64f/3

Original image (1125 x 1600 Pixels)

How does the image look after processing if the program processed it at dimensions of x = 576px, as originally intended (576 x 820 Pixels)?

This is what the image looks like when processed at sizes exceeding 576px in width (960 x 1367 pixels).

KAGGLE not working

when I run the kaggle notebook it says
Screenshot 2024-02-17 000538

RuntimeError Traceback (most recent call last)
Cell In[16], line 10
7 import ssl
8 import threading
---> 10 from colorizator import MangaColorizator
11 from inference import colorize_images as batch_colorize_images

File /kaggle/working/Manga-Colorizer/Backend/colorizator.py:1
----> 1 import torch
2 from torchvision.transforms import ToTensor
3 import numpy as np

File /opt/conda/lib/python3.10/site-packages/torch/init.py:229
227 if USE_GLOBAL_DEPS:
228 _load_global_deps()
--> 229 from torch._C import * # noqa: F403
231 # Appease the type checker; ordinarily this binding is inserted by the
232 # torch._C module initialization code in C
233 if TYPE_CHECKING:

RuntimeError: THPDtypeType.tp_dict == nullptr INTERNAL ASSERT FAILED at "/usr/local/src/pytorch/torch/csrc/Dtype.cpp":135, please report a bug to PyTorch.

any idea how to fix it please?

New feature idea: ability to show original image

Sometimes it would be nice to easily show the original image. Maybe the coloring made some text hard to read or you are just curious to see how it looked before coloring.
This could be done in a number of ways. The first few I can think of are:

  1. Replace the colored version with the original on the page so you only see the original.
  2. Try to show both original and colored version side-by-side or vertically.
  3. Be able to swap back and forth quickly.
  4. Load the whole page in another window or tab without coloring.

I want to be sure the regular reading experience is not cluttered with any new visible buttons in the page. Even if they only show up on hover, they will often be flickering into view. I was thinking of a right-click menu item to make this happen, but maybe nobody would ever find it and in some browsers that menu is already crowded. Maybe something in the settings popup could enable showing originals.

It will take a little thought about how to implement since we currently discard the original image data and src when it gets colored.
There is also a lot of variety in how pages handle images. Some natively keep only a few img elements and create and destroy them as you read, others have one for every image in the chapter but clear the image data of ones that have scrolled by to save memory. Saving all original image data will increase by double (or more) the memory a page takes up while reading, so we may not want to enable it by default.

A related feature would be allowing the user to force coloring of an image that was not originally colored because there is already some color in it. This may end up needing its own separate issue for discussion and implementation, but it may help to think about both as we figure out what to do.

Had some trouble installing the self-hosting version, but now it works and it is awesome!

New instructions for installing the backend on your own computer (self-hosting):

Clone the repository or download as .zip and extract.
Download the generator weights from https://drive.google.com/file/d/1qmxUEKADkEM4iYLp1fpPLLKnfZ6tcF-t/view?usp=sharing and move it into the Backend/networks folder.

In the Backend folder, open a command prompt, and run:

pip install -r requirements.txt

See the instructions in the comments in Backend/requirements.txt to install PyTorch, then continue below.

Run the following two commands in the Backend folder to generate your own self-signed key (needed for using https). You can safely just press Enter to accept the default value for all questions:

openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr
openssl x509 -req -days 730 -in server.csr -signkey server.key -out server.crt

Now you have a choice to make between the original batch backend and the new streaming backend.

  1. The original backend works with Manganelo and colors a chapter as a batch. It is used by Frontend-Chrome and Frontend-Firefox. If you are going to use this and you do not have a GPU, edit app.py and set self.gpu = False (~Line 75).
    Launch the original backend with the command: python app.py

  2. The new backend works with more sites and streams one image at a time between the front and back ends. It is used by Frontend-Chrome-AnySite, Frontend-Firefox-AnySite, and Frontend-Safari. Launch the streaming backend with the command: python app-stream.py

Whichever backend you started should run on localhost (https://127.0.0.1:5000/) and Private IP (https://x.x.x.x:5000/)

You will need to enter the Private IP into whichever frontend you use. You should be able to use a frontend on the same computer or on any device on the same local network.

After setting this up for the first time, you will only need to do the last step of opening a command prompt in the Backend folder and using the python command to start the backend each time you want to use it. Make sure your frontend gets the right Private IP each time! Many home routers will give your computer a slightly different private IP address each time it restarts.

"Error: CUDA error: an illegal memory access was encountered" causes the server to stop working properly until a manual restart

Sometimes the error mentioned in the title occurs, after which the server stops processing images and keeps giving this error.
If the server is manually restarted, it starts working correctly, continuing to process images.
Is it possible to make it restart automatically when such an error occurs?

127.0.0.1 - - [29/Jul/2024 13:14:13] "POST /colorize-image-data HTTP/1.1" 200 -
127.0.0.1 - - [29/Jul/2024 13:14:55] "OPTIONS /colorize-image-data HTTP/1.1" 200 -
[+] [D2FZ7T3G] Requested image: 684f4f37-e95d-44e2-88c1-730889db4114, Width: 1125, Height: 1600
[+] [D2FZ7T3G] Colorize: True, Upscale: True(x4), Denoise: True
[*] [D2FZ7T3G] Denoising image...
[!] [D2FZ7T3G] Error: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

127.0.0.1 - - [29/Jul/2024 13:14:56] "POST /colorize-image-data HTTP/1.1" 200 -
[+] [4NF2I4X9] Requested image: c2dce404-1793-4c99-8dd4-e1cb2adb02cd, Width: 1125, Height: 1600
[+] [4NF2I4X9] Colorize: True, Upscale: True(x4), Denoise: True
[*] [4NF2I4X9] Denoising image...
[!] [4NF2I4X9] Error: CUDA error: an illegal memory access was encountered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with `TORCH_USE_CUDA_DSA` to enable device-side assertions.

127.0.0.1 - - [29/Jul/2024 13:14:56] "POST /colorize-image-data HTTP/1.1" 200 -

(venv) h:\Manga-Colorizer-revamp>app-stream.py
H:\Manga-Colorizer-revamp\colorizator.py:22: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  state_dict = torch.load(config.colorizer_path, map_location=self.device)
H:\Manga-Colorizer-revamp\denoising\denoiser.py:42: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  state_dict = torch.load(weights_path, map_location=torch.device('cpu'))
H:\Manga-Colorizer-revamp\upscalator.py:19: FutureWarning: You are using `torch.load` with `weights_only=False` (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for `weights_only` will be flipped to `True`. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via `torch.serialization.add_safe_globals`. We recommend you start setting `weights_only=True` for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature.
  model = torch.load(config.upscaler_path, map_location=self.device)
C:\Python312\Lib\site-packages\torch\serialization.py:1189: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  warnings.warn(msg, SourceChangeWarning)
C:\Python312\Lib\site-packages\torch\serialization.py:1189: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  warnings.warn(msg, SourceChangeWarning)
C:\Python312\Lib\site-packages\torch\serialization.py:1189: SourceChangeWarning: source code of class 'torch.nn.modules.activation.LeakyReLU' has changed. you can retrieve the original source code by accessing the object's source attribute or set `torch.nn.Module.dump_patches = True` and use the patch tool to revert the changes.
  warnings.warn(msg, SourceChangeWarning)
 * Serving Flask app 'app-stream'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on https://127.0.0.1:5000
 * Running on https://192.168.0.3:5000
Press CTRL+C to quit
127.0.0.1 - - [29/Jul/2024 13:15:53] "OPTIONS /colorize-image-data HTTP/1.1" 200 -
[+] [7YLY6313] Requested image: 4c1ed87e-1587-43cf-8e83-45794973117c, Width: 1013, Height: 1440
[+] [7YLY6313] Colorize: True, Upscale: True(x4), Denoise: True
[*] [7YLY6313] Denoising image...
H:\Manga-Colorizer-revamp\denoising\functions.py:40: UserWarning: The torch.cuda.*DtypeTensor constructors are no longer recommended. It's best to use methods such as torch.tensor(data, dtype=*, device='cuda') to create tensors. (Triggered internally at C:\actions-runner\_work\pytorch\pytorch\builder\windows\pytorch\torch\csrc\tensor\python_tensor.cpp:80.)
  downsampledfeatures = torch.cuda.FloatTensor(N, Cout, Hout, Wout).fill_(0)
[+] [7YLY6313] Denoised image [1440, 1013, 4]->[1200, 844, 3] in 0.52 seconds.
[*] [7YLY6313] Colorizing image...
[+] [7YLY6313] Colorized image [1200, 844, 3]->[819, 576, 3] in 0.37 seconds.
[*] [7YLY6313] Upscaling image...
[+] [7YLY6313] Upscaled image (x4) [819, 576, 3]->[3276, 2304, 3] in 0.54 seconds.
127.0.0.1 - - [29/Jul/2024 13:15:57] "POST /colorize-image-data HTTP/1.1" 200 -
[+] [CY1F6KS6] Requested image: 5556783d-16ab-4d7f-b9eb-dcc15427a8ee, Width: 1125, Height: 1600
[+] [CY1F6KS6] Colorize: True, Upscale: True(x4), Denoise: True
[*] [CY1F6KS6] Denoising image...
[+] [CY1F6KS6] Denoised image [1600, 1125, 4]->[1200, 843, 3] in 0.23 seconds.
[*] [CY1F6KS6] Colorizing image...
[+] [CY1F6KS6] Colorized image [1200, 843, 3]->[820, 576, 3] in 0.29 seconds.
[*] [CY1F6KS6] Upscaling image...
[+] [CY1F6KS6] Upscaled image (x4) [820, 576, 3]->[3280, 2304, 3] in 0.55 seconds.
127.0.0.1 - - [29/Jul/2024 13:16:01] "POST /colorize-image-data HTTP/1.1" 200 -
127.0.0.1 - - [29/Jul/2024 13:16:20] "OPTIONS /colorize-image-data HTTP/1.1" 200 -
[+] [3RV2N4KH] Requested image: f5bde9bf-315d-45ff-8ecd-f069b24be781, Width: 1125, Height: 1600
[+] [3RV2N4KH] Colorize: True, Upscale: True(x4), Denoise: True
[*] [3RV2N4KH] Denoising image...
[+] [3RV2N4KH] Denoised image [1600, 1125, 4]->[1200, 843, 3] in 0.39 seconds.
[*] [3RV2N4KH] Colorizing image...
[+] [3RV2N4KH] Colorized image [1200, 843, 3]->[820, 576, 3] in 0.19 seconds.
[*] [3RV2N4KH] Upscaling image...
[+] [3RV2N4KH] Upscaled image (x4) [820, 576, 3]->[3280, 2304, 3] in 0.59 seconds.
127.0.0.1 - - [29/Jul/2024 13:16:23] "POST /colorize-image-data HTTP/1.1" 200 -

Help?

Anyone to contact you, I need help setting this up as I'm having major issues.

Discord: travis#6256

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.