Giter VIP home page Giter VIP logo

sanster / iopaint Goto Github PK

View Code? Open in Web Editor NEW
17.2K 133.0 1.7K 22.38 MB

Image inpainting tool powered by SOTA AI Model. Remove any unwanted object, defect, people from your pictures or erase and replace(powered by stable diffusion) any thing on your pictures.

Home Page: https://www.iopaint.com/

License: Apache License 2.0

Shell 0.13% HTML 0.02% TypeScript 17.70% Python 81.74% Batchfile 0.08% JavaScript 0.17% CSS 0.15%
inpainting pytorch lama latent-diffusion mat zits stable-diffusion

iopaint's Introduction

IOPaint

A free and open-source inpainting & outpainting tool powered by SOTA AI model.

total download version python version HuggingFace Spaces Open in Colab

Erase(LaMa) Replace Object(PowerPaint)
IOPaint-erase-markdown.mp4
iopaint-inpaint-markdown.mp4
Draw Text(AnyText) Out-painting(PowerPaint)
AnyText-markdown.mp4
outpainting.mp4

Features

Quick Start

Start webui

IOPaint provides a convenient webui for using the latest AI models to edit your images. You can install and start IOPaint easily by running following command:

# In order to use GPU, install cuda version of pytorch first.
# pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/cu118
# AMD GPU users, please utilize the following command, only works on linux, as pytorch is not yet supported on Windows with ROCm.
# pip3 install torch==2.1.2 torchvision==0.16.2 --index-url https://download.pytorch.org/whl/rocm5.6

pip3 install iopaint
iopaint start --model=lama --device=cpu --port=8080

That's it, you can start using IOPaint by visiting http://localhost:8080 in your web browser.

All models will be downloaded automatically at startup. If you want to change the download directory, you can add --model-dir. More documentation can be found here

You can see other supported models at here and how to use local sd ckpt/safetensors file at here.

Plugins

You can specify which plugins to use when starting the service, and you can view the commands to enable plugins by using iopaint start --help.

More demonstrations of the Plugin can be seen here

iopaint start --enable-interactive-seg --interactive-seg-device=cuda

Batch processing

You can also use IOPaint in the command line to batch process images:

iopaint run --model=lama --device=cpu \
--image=/path/to/image_folder \
--mask=/path/to/mask_folder \
--output=output_dir

--image is the folder containing input images, --mask is the folder containing corresponding mask images. When --mask is a path to a mask file, all images will be processed using this mask.

You can see more information about the available models and plugins supported by IOPaint below.

Development

Install nodejs, then install the front-end dependencies.

git clone https://github.com/Sanster/IOPaint.git
cd IOPaint/web_app
npm install

Create a .env.local file in web_app and fill in the backend IP and port.

VITE_BACKEND=http://127.0.0.1:8080

Start front-end development environment

npm run dev

Install back-end requirements and start back-end service

pip install -r requirements.txt
python3 main.py --model lama --port 8080

Then you can visit http://localhost:5173/ for development. The front-end code will automatically update after being modified, but the back-end needs to restart the service after modifying the python code.

iopaint's People

Contributors

aminejava avatar bediryilmaz avatar blessedcoolant avatar callmepantoine avatar davidbejarcaceres avatar eltociear avatar fiskbil avatar jojje avatar linuxsuren avatar loretoparisi avatar niek avatar randomblock1 avatar romixerr avatar sanster avatar targaryen avatar

Stargazers

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

Watchers

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

iopaint's Issues

Problem loading LDM, windows 10

Hi,

I run into a problem while trying to load the LDM model. FYI it's working well with the LAMA model FYI.
Also, I don't get why I get a warning at the beginning with cuda. I tried

python -c "import torch; print(torch.cuda.is_available())" and cuda is working properly

(lama) F:\StableDiffusion\Lama-Cleaner\lama-cleaner>lama-cleaner --model=ldm --device=cuda --port=8080
G:\back_up\backup_windows\Users\Kharma\miniconda3\miniconda3\lib\site-packages\torch-1.12.1-py3.8-win-amd64.egg\torch\amp\autocast_mode.py:198: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
warnings.warn('User provided device_type of 'cuda', but CUDA is not available. Disabling')
2022-09-14 11:31:29.518 | INFO | lama_cleaner.helper:load_jit_model:44 - Load model from: F:\StableDiffusion\Lama-Cleaner\lama-cleaner\torch_home\hub\checkpoints\diffusion.pt
2022-09-14 11:31:33.073 | ERROR | lama_cleaner.helper:load_jit_model:48 - Failed to load F:\StableDiffusion\Lama-Cleaner\lama-cleaner\torch_home\hub\checkpoints\diffusion.pt, delete model and restart lama-cleaner

Question: How to Access Flask Server

Hey, first of all the app is amazing. I want to access only the flask server and call it through 'requests'. However, while digging in code, there are too many CONFIGS which I don't know about. I would be grateful to know how can I call it with requests through JS/python. Like what are the data I need to provide in the FORM while POSTING request.

ZITS input size

Hello
Why the inputs of ZITS must be 256256 or 512512 otherwise they are cropped?
In other word, why the input must be square?

Add a configuration to toggle automatic or manual mode

I'd love it if there was a manual "Clean up" button, rather than having to select everything within one selection.

For example, I'd mask several different items, and then click on Clean up, rather than mask the first one -> wait for clean up > mask the second one > wait for clean up, and so on...

Also, sometimes when zoomed in, I can't reach and mask all of the object so I have to let go of the mouse click which automatically starts the clean up process, rather than letting me continue it and then manually deciding when to clean up

Hope this makes sense :)

I am getting errors

C:\lama-cleaner>call conda activate lama

(lama) C:\lama-cleaner>python main.py --device=cpu --gui --gui-size 800 640 --crop-margin 128
Traceback (most recent call last):
File "main.py", line 176, in
main()
File "main.py", line 160, in main
model = LaMa(crop_trigger_size=args.crop_trigger_size,
File "C:\lama-cleaner\lama_cleaner\lama_init_.py", line 38, in init
model = torch.jit.load(model_path, map_location="cpu")
File "C:\Users\breakmycurse.conda\envs\lama\lib\site-packages\torch\jit_serialization.py", line 162, in load
cpp_module = torch._C.import_ir_module(cu, str(f), map_location, _extra_files)
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

I tried to install pytorch as well with cuda support.It is giving errors.Couldn't find a way to use the lama-cleaner.

How can I solve this issue?

0.15.0 windows not working

I updated from V0.14.0 to V0.15.0 and try to run it using:
python main.py

(lama015) C:\Users\username\Documents\Ai_Ml\lama-cleaner-0.15>python main.py
OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

I installed it using conda new env and installed pytorch
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch

I wax using 0.14.0 and it was working perfictly with almost 0 issues
something had changed cusing this.

add web demo/model to Huggingface

Hi, would you be interested in adding lama-cleaner to Hugging Face? The Hub offers free hosting, and it would make your work more accessible and visible to the rest of the ML community. Models/datasets/spaces(web demos) can be added to a user account or organization similar to github.

there is already a demo for lama on spaces: https://huggingface.co/spaces/akhaliq/lama

would be great to have lama-cleaner as well to try out as a web demo

Example spaces with repos:
github: https://github.com/salesforce/BLIP
Spaces: https://huggingface.co/spaces/salesforce/BLIP

github: https://github.com/facebookresearch/omnivore
Spaces: https://huggingface.co/spaces/akhaliq/omnivore

Example from other organizations:
Keras: https://huggingface.co/keras-io
Microsoft: https://huggingface.co/microsoft
Facebook: https://huggingface.co/facebook

and here are guides for adding spaces/models/datasets to your org

How to add a Space: https://huggingface.co/blog/gradio-spaces
how to add models: https://huggingface.co/docs/hub/adding-a-model
uploading a dataset: https://huggingface.co/docs/datasets/upload_dataset.html

Please let us know if you would be interested and if you have any questions, we can also help with the technical implementation.

Out of memory

I have 6GB memory in gtx2060. trying to use a 1024x659 image. used smallest brush with just one stroke
getting this memory error

RuntimeError: CUDA out of memory. Tried to allocate 16.00 MiB (GPU 0; 6.00 GiB total capacity; 4.02 GiB already allocated; 0 bytes free; 4.38 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

is it that memory taxing or there is an error?

Error on Docker step 9

I'm on an M1 Mac.

=> ERROR [9/9] RUN cd lama_cleaner/app/ && yarn && yarn build 63.0s

[9/9] RUN cd lama_cleaner/app/ && yarn && yarn build:
#13 0.447 yarn install v1.22.19
#13 0.513 [1/4] Resolving packages...
#13 0.812 [2/4] Fetching packages...
#13 36.22 [3/4] Linking dependencies...
#13 36.23 warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
#13 36.23 warning " > [email protected]" has unmet peer dependency "eslint@^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8".
#13 36.23 warning " > [email protected]" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7".
#13 36.23 warning " > [email protected]" has unmet peer dependency "eslint@^3 || ^4 || ^5 || ^6 || ^7".
#13 36.23 warning " > [email protected]" has unmet peer dependency "eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0".
#13 36.24 warning "@typescript-eslint/eslint-plugin > @typescript-eslint/experimental-utils > [email protected]" has unmet peer dependency "eslint@>=5".
#13 36.24 warning " > @typescript-eslint/[email protected]" has unmet peer dependency "@typescript-eslint/parser@^5.0.0".
#13 36.24 warning " > @typescript-eslint/[email protected]" has unmet peer dependency "eslint@^6.0.0 || ^7.0.0 || ^8.0.0".
#13 36.24 warning "@typescript-eslint/eslint-plugin > @typescript-eslint/[email protected]" has unmet peer dependency "eslint@*".
#13 36.24 warning " > [email protected]" has unmet peer dependency "eslint@^5.16.0 || ^6.8.0 || ^7.2.0".
#13 36.24 warning "eslint-config-airbnb > [email protected]" has unmet peer dependency "eslint@^5.16.0 || ^6.8.0 || ^7.2.0".
#13 36.24 warning " > [email protected]" has unmet peer dependency "eslint@>=7.0.0".
#13 36.24 warning " > [email protected]" has unmet peer dependency "eslint@>=7.28.0".
#13 46.11 [4/4] Building fresh packages...
#13 47.58 Done in 47.14s.
#13 47.74 yarn run v1.22.19
#13 47.77 $ cross-env GENERATE_SOURCEMAP=false react-scripts build
#13 48.99 Creating an optimized production build...
#13 49.51 Browserslist: caniuse-lite is outdated. Please run:
#13 49.51 npx browserslist@latest --update-db
#13 49.51 Why you should do it regularly: https://github.com/browserslist/browserslist#browsers-data-updating
#13 62.85 The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process.
#13 62.87 error Command failed with exit code 1.
#13 62.87 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error when editing images above 2k

It seems to error out on larger images when editing the original size.
3840x2880
3648x5472
2299x3065

I've attached the error outputs:
err2.txt
err1.txt

I'm on CUDA 11.1 (I've tried 11.3/11.5 too) and have also tried torch 1.9-1.10, with the same errors occurring on my
RTX 3080 GPU. I'm using the Docker setup but with the torch replaced with the cuda 11.1+ version. Selecting 2k or 1080p usually results in it working properly (I believe sometimes 2k will throw an error, but then will work)

Suggestion: allow users to use ctrl v to paste in a image and ctrl c to copy the edited image

Instead of having to select a file it would be awesome if you could easily paste in a image you have on your clipboard.
Also the other way arround where if you do ctrl c it would copy the current image to your clipboard.

I do most of my work in photoshop and noticed that just copying part of the image into lama cleaner works great and sometimes even better then when i gave it the full image

Running the docker image on windows gives no response

I'm using Windows 11 with WSL and after building the image with
docker build -f Dockerfile -t lamacleaner .

and running on cpu with:
docker run -p 8080:8080 -e CACHE_DIR=/app/models -v ${pwd}/models:/app/models -v ${pwd}:/app --rm lamacleaner python3 main.py --device=cpu --port=8080
[ i've switched '$(pwd)' to '${pwd}' ]

It says:

But i get an empty response when i visit that url.
Neither changing the port nor accessing [::1] or the internal ip of the docker image works.

RuntimeError: The size of tensor a (2000) must match the size of tensor b (1336) at non-singleton dimension 3

Traceback (most recent call last):
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
return cors_after_request(app.make_response(f(*args, **kwargs)))
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask_compat.py", line 39, in reraise
raise value
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\flask\app.py", line 1936, in dispatch_request
return self.view_functionsrule.endpoint
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\lama_cleaner\server.py", line 115, in process
res_np_img = model(image, mask, config)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\lama_cleaner\model_manager.py", line 37, in call
return self.model(image, mask, config)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\lama_cleaner\model\base.py", line 98, in call
inpaint_result = self._pad_forward(image, mask, config)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\lama_cleaner\model\base.py", line 51, in _pad_forward
result = self.forward(pad_image, pad_mask, config)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\lama_cleaner\model\lama.py", line 63, in forward
inpainted_image = self.model(image, mask)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1130, in _call_impl
return forward_call(*input, **kwargs)
RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript, serialized code (most recent call last):
File "code/torch/saicinpainting/training/trainers/default.py", line 11, in forward
mask: Tensor) -> Tensor:
_0 = self.generator
masked_img = torch.mul(img, torch.rsub(mask, 1, 1))
~~~~~~~~~ <--- HERE
input = torch.cat([masked_img, mask], 1)
_1 = torch.mul(mask, (_0).forward(input, ))

Traceback of TorchScript, original code (most recent call last):
/root/home/code/lama/saicinpainting/training/trainers/default.py(80): forward
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/torch/nn/modules/module.py(860): _slow_forward
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/torch/nn/modules/module.py(887): _call_impl
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/torch/jit/_trace.py(940): trace_module
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/torch/jit/_trace.py(742): trace
bin/to_jit.py(46): main
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/hydra/core/utils.py(160): run_job
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/hydra/_internal/hydra.py(105): run
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/hydra/_internal/utils.py(371):
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/hydra/_internal/utils.py(211): run_and_report
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/hydra/_internal/utils.py(368): _run_hydra
/opt/venv/ocr-detection-detectron2/lib/python3.6/site-packages/hydra/main.py(53): decorated_main
bin/to_jit.py(59):
RuntimeError: The size of tensor a (2000) must match the size of tensor b (1336) at non-singleton dimension 3

Design change if possible

@Sanster Hi there...Hoping everything is going well.
It has been awhile since I checked the repo for updates. I have noticed that after dragging and dropping to canvas and after I save the photo,I realized the button function is changed to upload new,which opens explorer to load a new photo from a location on the pc which is fine but this took away the previous functionality which was cleaning the canvas and return to welcome screen,we can drag and drop a new photo to inpaint.Now the only way to drag and drop is when the gui is first launched.

Is it possible for you to revert changes back to the original design,or maybe you can add the old button back next to "upload new" if you want.That was a good functionality.

2022-08-02 02_51_35-Window

U is undefined

I'm getting a u is undefined error when I try and use the brush on an image

Flask Server Stops listening,terminates itself

It is not a bug but after some amount of time,I wasn't able to verify how much time required for that to happen but this windows shuts down itself on the background.So even the gui is in the foreground working,it is not able to process the image.I have seen this happen even in the middle of the masking,and when mouse was released to processs the image,just because the server wasn't running,it fails to process.
2022-04-09 05_57_54-C__Windows_system32_cmd exe

So is there a timeout for the server to shut down itself? or something like when it is idle,it terminates the server?
If so can it run for unlimited amount of time,until the user closes the UI?

By the way the UI is using Microsoft Edge by default on my system,if that matters or related somehow...

New resizing bug introduced

Rezise.bug.mp4

The image resizes itself auto zooms out when the mouse is released.Previously it was keeping the zoom level. It is doing it with multi stroke as well.

and this is how thee old version acts:

Old.version.behavior.mp4

Cannot switch to SD 1.4

When attempting to switch to the new SD 1.4, it fails with the following log error:

127.0.0.1 - - [22/Sep/2022 17:16:37] "GET /model_downloaded/sd1.4 HTTP/1.1" 200 -
[2022-09-22 17:16:37,877] ERROR in app: Exception on /model [POST]
Traceback (most recent call last):
  File "C:\Users\eiden\anaconda3\lib\site-packages\huggingface_hub\utils\_errors.py", line 131, in _raise_for_status
    response.raise_for_status()
  File "C:\Users\eiden\anaconda3\lib\site-packages\requests\models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/api/models/CompVis/stable-diffusion-v1-4/revision/fp16

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\Users\eiden\anaconda3\lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\Users\eiden\anaconda3\lib\site-packages\lama_cleaner\server.py", line 183, in switch_model
    model.switch(new_name)
  File "C:\Users\eiden\anaconda3\lib\site-packages\lama_cleaner\model_manager.py", line 39, in switch
    self.model = self.init_model(new_name, self.device, **self.kwargs)
  File "C:\Users\eiden\anaconda3\lib\site-packages\lama_cleaner\model_manager.py", line 21, in init_model
    model = models[name](device, **kwargs)
  File "C:\Users\eiden\anaconda3\lib\site-packages\lama_cleaner\model\base.py", line 24, in __init__
    self.init_model(device, **kwargs)
  File "C:\Users\eiden\anaconda3\lib\site-packages\lama_cleaner\model\sd.py", line 49, in init_model
    self.model = StableDiffusionInpaintPipeline.from_pretrained(
  File "C:\Users\eiden\anaconda3\lib\site-packages\diffusers\pipeline_utils.py", line 288, in from_pretrained
    cached_folder = snapshot_download(
  File "C:\Users\eiden\anaconda3\lib\site-packages\huggingface_hub\utils\_deprecation.py", line 93, in inner_f
    return f(*args, **kwargs)
  File "C:\Users\eiden\anaconda3\lib\site-packages\huggingface_hub\_snapshot_download.py", line 168, in snapshot_download
    repo_info = _api.repo_info(
  File "C:\Users\eiden\anaconda3\lib\site-packages\huggingface_hub\hf_api.py", line 1454, in repo_info
    return self.model_info(
  File "C:\Users\eiden\anaconda3\lib\site-packages\huggingface_hub\hf_api.py", line 1276, in model_info
    _raise_for_status(r)
  File "C:\Users\eiden\anaconda3\lib\site-packages\huggingface_hub\utils\_errors.py", line 169, in _raise_for_status
    raise e
huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error: Repository Not Found for url: https://huggingface.co/api/models/CompVis/stable-diffusion-v1-4/revision/fp16. If the repo is private, make sure you are authenticated. (Request ID: O9i2-ve-nozMYbNTWMSms)
127.0.0.1 - - [22/Sep/2022 17:16:37] "POST /model HTTP/1.1" 500 -

Floating point exception (core dumped)

Model: zits
High Resolution Strategy: Original
Log:

/usr/local/lib/python3.7/site-packages/torch/amp/autocast_mode.py:198: UserWarning: User provided device_type of 'cuda', but CUDA is not available. Disabling
  warnings.warn('User provided device_type of \'cuda\', but CUDA is not available. Disabling')
2022-08-02 13:13:54.692 | INFO     | lama_cleaner.model.lama:init_model:39 - Load LaMa model from: /app/models/hub/checkpoints/big-lama.pt
 * Running on http://127.0.0.1:8080/ (Press CTRL+C to quit)
127.0.0.1 - - [02/Aug/2022 13:14:00] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2022 13:14:01] "GET /inputimage HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2022 13:14:01] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [02/Aug/2022 13:14:07] "GET /model HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2022 13:14:11] "GET /model HTTP/1.1" 200 -
127.0.0.1 - - [02/Aug/2022 13:14:11] "GET /model_downloaded/zits HTTP/1.1" 200 -
2022-08-02 13:14:12.029 | INFO     | lama_cleaner.helper:load_jit_model:44 - Load model from: /app/models/hub/checkpoints/zits-wireframe-0717.pt
2022-08-02 13:14:12.322 | INFO     | lama_cleaner.helper:load_jit_model:44 - Load model from: /app/models/hub/checkpoints/zits-edge-line-0717.pt
2022-08-02 13:14:12.618 | INFO     | lama_cleaner.helper:load_jit_model:44 - Load model from: /app/models/hub/checkpoints/zits-structure-upsample-0717.pt
2022-08-02 13:14:12.625 | INFO     | lama_cleaner.helper:load_jit_model:44 - Load model from: /app/models/hub/checkpoints/zits-inpaint-0717.pt
127.0.0.1 - - [02/Aug/2022 13:14:13] "POST /model HTTP/1.1" 200 -
2022-08-02 13:14:24.397 | INFO     | lama_cleaner.server:process:107 - Origin image shape: (3072, 4862, 3)
2022-08-02 13:14:24.397 | INFO     | lama_cleaner.server:process:109 - Resized image shape: (3072, 4862, 3)
2022-08-02 13:14:24.494 | INFO     | lama_cleaner.model.base:__call__:66 - hd_strategy: Original
2022-08-02 13:14:24.887 | INFO     | lama_cleaner.model.base:_pad_forward:49 - final forward pad size: (4864, 4864, 3)
/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py:1130: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2895.)
  return forward_call(*input, **kwargs)
/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py:1130: UserWarning: floor_divide is deprecated, and will be removed in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values.
To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). (Triggered internally at  ../aten/src/ATen/native/BinaryOps.cpp:600.)
  return forward_call(*input, **kwargs)
wireframe_forward time: 10295.82ms
sample_edge_line_logits time: 608.36ms

Floating point exception (core dumped)

Image quality/size limited?

Hello,

I was wondering if you were limiting/lowering the quality or size of the image at some point in the code?

When I use full HD as input, the output is lowered to 1024x682. Is this normal and can we change it?

Thanks

Model Loading (and other suggestions)

Moving the biglama model out of the cache and putting it into a model folder would help for people training their models for different targets(looking into this myself), as well as a way to pause and apply multiple strokes would be helpful.
Something like mask filling/loading and U^2 net salient object masking would be more for a gimp-ml tool but could speed up and make the tool easier to use.

[Feature] add argument for default resolution strategy

I made my lama-cleaner installation available to some people, but since it's hosted on a low-power VPS the only option that works is using Crop as the resolution strategy (others end up crashing due to RAM or CPU).

However, with the latest version Resize is set as default and I didn't find an argument to switch to Crop at startup. Would it be possible to add an argument to change the default selection (and perhaps even lock it)?

[Feature Request] Support for passing in image path parameters to start

When used as a local tool, most of the time you may only need to process a single photo, and it could be a bit more convenient if it could support passing in the image path at startup, eliminating the need to manually select the path.
Let's say the following.

python3 main.py --device=cuda --port=8080 --model=lama --image path/example.jpg

python3 main.py --device=cuda --port=8080 --model=ldm --ldm-steps=50 --image path/example.jpg

High resolution strategies

Have you implemented the strategies which are mentioned in readme?
I mean this part:
Resize: Resize the image to a smaller size, then do inpainting on the resized image. The inpainting area will be croped, upsampled and pasted back on the original image to make sure other part of image not loss quality.
Crop: Crop masking area from the original image to do inpainting, and paste the result back. Mainly for performance and memory reasons on high resolution image.

Super slow

I use mac mini m1 super slow, photo 1920 * 1000 need 5-6 minutes

The command used is
lama-cleaner --device=cpu --port=8080

[Feature] Batch/Video input?

Hello, I really like your GUI. Would you be interested in supporting multi-picture inputs, or even video?

That would speed up the workflow for which I use this. Happy Easter!

LDM Running out of memory

I understand that the LDM model is intensive but I think something peculiar is happening. It always OOM's on the 3rd stroke. I tried lowering the steps but it doesn't matter. No matter what the step size is or the stroke size is, the model crashes on the 3rd stroke with an OOM.

Wondering if there might be a fix for that? I'm on a RTX3080.

Killed while downloading torch

Trying to install on a brand new machine. When I run pip install lama-cleaner it downloads everything until torch, completes the download, and then terminates with "Killed" message.

root@instance-20220928-1007:/home/ubuntu# pip install lama-cleaner
Collecting lama-cleaner
  Downloading lama_cleaner-0.20.1-py3-none-any.whl (1.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 18.9 MB/s eta 0:00:00
Collecting pytest
  Downloading pytest-7.1.3-py3-none-any.whl (298 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 298.2/298.2 KB 27.1 MB/s eta 0:00:00
Collecting yacs
  Downloading yacs-0.1.8-py3-none-any.whl (14 kB)
Collecting transformers==4.20.0
  Downloading transformers-4.20.0-py3-none-any.whl (4.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.4/4.4 MB 21.6 MB/s eta 0:00:00
Collecting pydantic
  Downloading pydantic-1.10.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.8/12.8 MB 21.5 MB/s eta 0:00:00
Collecting scikit-image==0.19.3
  Downloading scikit_image-0.19.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.9/13.9 MB 20.1 MB/s eta 0:00:00
Collecting flask==1.1.4
  Downloading Flask-1.1.4-py2.py3-none-any.whl (94 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 94.6/94.6 KB 17.4 MB/s eta 0:00:00
Collecting loguru
  Downloading loguru-0.6.0-py3-none-any.whl (58 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 58.3/58.3 KB 11.1 MB/s eta 0:00:00
Collecting flask-cors
  Downloading Flask_Cors-3.0.10-py2.py3-none-any.whl (14 kB)
Collecting tqdm
  Downloading tqdm-4.64.1-py2.py3-none-any.whl (78 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 78.5/78.5 KB 13.0 MB/s eta 0:00:00
Collecting diffusers==0.3.0
  Downloading diffusers-0.3.0-py3-none-any.whl (153 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 153.9/153.9 KB 22.4 MB/s eta 0:00:00
Requirement already satisfied: markupsafe==2.0.1 in /usr/lib/python3/dist-packages (from lama-cleaner) (2.0.1)
Collecting opencv-python
  Downloading opencv_python-4.6.0.66-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (60.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.9/60.9 MB 3.9 MB/s eta 0:00:00
Collecting torch>=1.8.2
  Downloading torch-1.12.1-cp310-cp310-manylinux1_x86_64.whl (776.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸ 776.3/776.3 MB 26.5 MB/s eta 0:00:01Killed
root@instance-20220928-1007:/home/ubuntu# 

This happens whether I run as root or as a regular user.

Ubuntu 22.04.1

Thank you!

ERROR: No matching distribution found for imghdr

pip3 install -r requirements.txt found imghdr error when installing
Then install imghdr separately: pip install imghdr
image
Python 3.9.12
Windows 11

It can still run normally now, I don't know what effect this will have and under what circumstances it will go wrong.

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.