shangar21 / anime_upscaler

My usage of Real-ESRGAN to upscale anime, some test and results in the test_img folder
84 stars 7 forks source link

How to launch #11

Closed whatforiam closed 1 month ago

whatforiam commented 4 months ago

Hello, I'm completely new to this topic. In general, I want to massively upscale anime videos, and that's why I came across realsrgan, but I didn't figure out how to run it. It gives out a lot of errors, and does not want to work. I installed everything according to the instructions, tried the portable version, looked at the guides on YouTube in two languages, all of which were, nothing helped. Then it occurred to me to try the gui, because everything will be ready for me there, the main thing is to specify the folder. Many guis have been seen, but none have an exe file to run. The main thing is that everything works for everyone, everyone can run and use it, but I don't. I've spent the whole day on this, and I haven't found a solution. I tried your gui. I downloaded everything. But it gives an error. I'm completely desperate, maybe I just can't use realsrgan? Error code:

C:\Users\whatforiam\Desktop\realesrgan>python anime_upscaler.py -m ../weights/RealESRGAN_x4plus_anime_6B.pth -i ../inputs/25.mp4 -o test.mp4
Traceback (most recent call last):
  File "C:\Users\whatforiam\Desktop\realesrgan\anime_upscaler.py", line 1, in <module>
    import frame_esrgan
  File "C:\Users\whatforiam\Desktop\realesrgan\frame_esrgan.py", line 9, in <module>
    import image_slicer
ModuleNotFoundError: No module named 'image_slicer'

Can you help me? If not with this script, then with the usual realsrgan

Error code with original realsrgan:

C:\Users\whatforiam\Desktop\realesrgan\realesrgan\utils.py:63: 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.
  loadnet = torch.load(model_path, map_location=torch.device('cpu'))
Testing 0 25
Traceback (most recent call last):
  File "C:\Users\whatforiam\Desktop\realesrgan\inference_realesrgan.py", line 166, in <module>
    main()
  File "C:\Users\whatforiam\Desktop\realesrgan\inference_realesrgan.py", line 138, in main
    if len(img.shape) == 3 and img.shape[2] == 4:
           ^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'shape'
shangar21 commented 3 months ago

Hey sorry, for the first error the problem is I rely on some out dated ass library LOL, I will write my own image slicer and add it but for now follow this:

Clone the original one:

git clone git@github.com:samdobson/image_slicer.git or git clone https://github.com/samdobson/image_slicer.git

Then:

cd image_slicer

And then finally run:

pip install -e . or python -m pip install -e .

This should install the module and you should be able to use it from there

shangar21 commented 3 months ago

Ok so now I added a fork of it as a submodule. If at any point it becomes stale I can make changes to my own fork and it will continue to work here. To install it and get it to work, simply run

pip install -e submodules/image_slicer

whatforiam commented 1 month ago

Thanks, but as I understood it, it breaks into frames and then upscales, by that time I had already written my own .bat script for such purposes) I'm sorry to bother you, it's just that at that time I thought he was processing a whole video