BinitDOX / Manga-Colorizer

Bring mangas to life!
MIT License
14 stars 3 forks source link

Can be applied to local downloaded comics #3

Closed DDXDB closed 5 months ago

DDXDB commented 6 months ago

I have a lot of downloaded comic collections saved as zip, is this project available for local comics?

and,need CUDA GPU?

BinitDOX commented 6 months ago

For that you can simply refer to: https://github.com/qweasdd/manga-colorization-v2. It is the parent project. You don't need GPU, when you will run the command python inference.py -p "path to file or folder", it defaults to CPU. If you do want to use GPU: python inference.py -p "path to file or folder" --gpu=True

DDXDB commented 6 months ago

I mean, do we need CUDA? I'm using the ARC A770, which is not a CUDA GPU but supports AI.a CUDA GPU but supports AI.

I think I did the parent project, but it doesn't seem to start: Traceback (most recent call last): File "D:\Program Files\manga-colorization-v2-master\inference.py", line 5, in <module> import numpy as np ModuleNotFoundError: No module named 'numpy'

BinitDOX commented 6 months ago

If you want to use GPU, then you need CUDA for this. Otherwise just run on CPU. For the error, download this file. And run pip install -r requirements.txt

You could also clone the kaggle notebook, run each cell one by one, till/before the APIS section. Then upload your folder to the kaggle notebook, create any new cell and add this code:

def run_batch_colorizer(path, use_cached):
    class Configuration:
        def __init__(self):
            self.path = path
            self.generator = 'networks/generator.zip'
            self.extractor = 'networks/extractor.pth'
            self.gpu = True
            self.denoiser = True
            self.denoiser_sigma =25
            self.size = 576
            self.use_cached = use_cached
    args = Configuration()

    if args.gpu:
        device = 'cuda'
    else:
        device = 'cpu'

    colorizer = MangaColorizator(device, args.generator, args.extractor)

    colorization_path = os.path.join('colored')
    os.makedirs(colorization_path, exist_ok=True)

    batch_colorize_images(colorization_path, colorizer, args)

Run the cell. Then make a new cell with (enter your folder path): run_batch_colorizer(the_uploaded_folder_path, True)

After running this, you should get all the colored images and can download the 'colored' folder.