iuliaturc / detextify

Remove text from AI-generated images
MIT License
243 stars 23 forks source link

Missing requirements? #26

Closed ovsh closed 1 year ago

ovsh commented 1 year ago

Been trying to install the package in a venv but getting a bunch of weird errors all the time. Are there any missing install requirements from the README?

First, complaints about cudnn64_7.dll missing:

`(v) PS D:\code\experiments> python .\text.py
Fetching 13 files: 100%|███████████████████████████████████████████████████████████████████████| 13/13 [00:00<?, ?it/s]
Iteration 0 of 5 for image 1.jpg:
        Calling text detector...
Traceback (most recent call last):
  File "D:\code\experiments\text.py", line 6, in <module>
    detextifier.detextify("1.jpg", "/output/1.png")
  File "D:\code\experiments\v\lib\site-packages\detextify\detextifier.py", line 16, in detextify
    text_boxes = self.text_detector.detect_text(to_inpaint_path)
  File "D:\code\experiments\v\lib\site-packages\detextify\paddle_text_detector.py", line 29, in detect_text
    result = self.ocr.ocr(image_path, cls=True)[0]
  File "D:\code\experiments\v\lib\site-packages\paddleocr\paddleocr.py", line 555, in ocr
    dt_boxes, rec_res, _ = self.__call__(img, cls)
  File "D:\code\experiments\v\lib\site-packages\paddleocr\tools\infer\predict_system.py", line 71, in __call__
    dt_boxes, elapse = self.text_detector(img)
  File "D:\code\experiments\v\lib\site-packages\paddleocr\tools\infer\predict_det.py", line 244, in __call__
    self.input_tensor.copy_from_cpu(img)
  File "D:\code\experiments\v\lib\site-packages\paddle\fluid\inference\wrapper.py", line 38, in tensor_copy_from_cpu
    self.copy_from_cpu_bind(data)
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_7.dll) that Paddle depends on is not configured correctly. (error code is 126)
  Suggestions:
  1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
  2. Configure third-party dynamic library environment variables as follows:
  - Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
  - Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:305)`

Installed cuDNN & manually pasted to the CUDA path. Now getting this -


(v) PS D:\code\experiments> python .\text.py
Fetching 13 files: 100%|███████████████████████████████████████████████████████████████████████| 13/13 [00:00<?, ?it/s]
Iteration 0 of 5 for image 1.jpg:
        Calling text detector...
E0210 01:07:34.582079 27840 port.cc:36] Load symbol cudnnGetConvolutionForwardAlgorithm failed.
Traceback (most recent call last):
  File "D:\code\experiments\text.py", line 6, in <module>
    detextifier.detextify("1.jpg", "/output/1.png")
  File "D:\code\experiments\v\lib\site-packages\detextify\detextifier.py", line 16, in detextify
    text_boxes = self.text_detector.detect_text(to_inpaint_path)
  File "D:\code\experiments\v\lib\site-packages\detextify\paddle_text_detector.py", line 29, in detect_text
    result = self.ocr.ocr(image_path, cls=True)[0]
  File "D:\code\experiments\v\lib\site-packages\paddleocr\paddleocr.py", line 555, in ocr
    dt_boxes, rec_res, _ = self.__call__(img, cls)
  File "D:\code\experiments\v\lib\site-packages\paddleocr\tools\infer\predict_system.py", line 71, in __call__
    dt_boxes, elapse = self.text_detector(img)
  File "D:\code\experiments\v\lib\site-packages\paddleocr\tools\infer\predict_det.py", line 245, in __call__
    self.predictor.run()
RuntimeError: cudnnGetConvolutionForwardAlgorithm not found.
(v) PS D:\code\experiments>

Am I missing anything obvious or is there previous steps / cuDNN specific versions that are required as prereqs?

azumukupoe commented 1 year ago

you need CUDA 10.2 and cuDNN 7 for paddlepaddle https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Windows&target_arch=x86_64&target_version=10 https://developer.nvidia.com/rdp/cudnn-archive#a-collapse765-102

jameswan commented 1 year ago

@azumukupoe Thanks for confirming. I have other code that requires CUDA 12, so does that mean I have to install and reinstall each time when I am switching between different code? I am on a Windows machine.

azumukupoe commented 1 year ago

@jameswan I think you can install multiple versions of CUDA

jameswan commented 1 year ago

I can create the right virtual environment using this: conda create -n detext -c nvidia -c conda-forge -c defaults python=3.8 cudatoolkit=10.2 cudnn=7

do you know what PyTorch GPU is required for paddlepaddle?

azumukupoe commented 1 year ago

latest version's working for me

iuliaturc commented 1 year ago

Thanks @ovsh for flagging this, and thanks @azumukupoe for your help. I updated the README to specify the CUDA and cuDNN pre-requisites.