enesmsahin / simple-lama-inpainting

Apache License 2.0
146 stars 25 forks source link

Error While Attempting to Run Simple Lama #6

Open DNucX opened 11 months ago

DNucX commented 11 months ago

Hello,

Upon attempting to run simple lama, I get the following error(s):

Traceback (most recent call last):
  File "simpLama3.8/bin/simple_lama", line 8, in <module>
    sys.exit(lama_cli())
  File "/home/user/pythonProjects/simpLama3.8/lib/python3.8/site-packages/simple_lama_inpainting/cli.py", line 36, in lama_cli
    fire.Fire(main)
  File "/home/user/pythonProjects/simpLama3.8/lib/python3.8/site-packages/fire/core.py", line 141, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "/home/user/pythonProjects/simpLama3.8/lib/python3.8/site-packages/fire/core.py", line 475, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "/home/user/pythonProjects/simpLama3.8/lib/python3.8/site-packages/fire/core.py", line 691, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "/home/user/pythonProjects/simpLama3.8/lib/python3.8/site-packages/simple_lama_inpainting/cli.py", line 24, in main
    assert img.mode == "RGB" and mask.mode == "L"
AssertionError

I have installed all the necessary requirements and dependencies, not unless I've missed some. Any help on this would be greatly appreciated! Thank you!

enesmsahin commented 11 months ago

Hey @DNucX, Looking at the error, I suggest that you should check the format of the image and mask files. Image should be "RGB - 3 channel", and the mask should be "Grayscale - 1 channel".

DNucX commented 11 months ago

Hi @enesmsahin ,

Thank you for writing.

It turns out the mask image was not grayscale. I converted it to grayscale and ran the command again. It worked, but this time I get the following error:

RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

My server does not have a NVIDIA GPU. Is there anyway to run the command using the CPU?

Thank you!

tzktz commented 8 months ago

Hi @enesmsahin ,

Thank you for writing.

It turns out the mask image was not grayscale. I converted it to grayscale and ran the command again. It worked, but this time I get the following error:

RuntimeError: Found no NVIDIA driver on your system. Please check that you have an NVIDIA GPU and installed a driver from http://www.nvidia.com/Download/index.aspx

My server does not have a NVIDIA GPU. Is there anyway to run the command using the CPU?

Thank you!

Edit the simple_lama_inpainting/model.py file..

self.model = torch.jit.load(model_path, map_location='cpu')

it works smoothly for cpu..