HighwayWu / ImageInpainting

36 stars 8 forks source link

How I can use my own image #2

Open Muhammad-Zubair opened 3 years ago

Muhammad-Zubair commented 3 years ago

Hi, I want to know how i can use my own image for model testing. Because when I put simply a 256x256 image it gives an error. File "main.py", line 85, in load_lbp img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

HighwayWu commented 3 years ago

Hi Muhammad. It seems that the model can't load your own image correctly. Can you run the demo images successfully?

Muhammad-Zubair commented 3 years ago

Yes Demo images run was successful, however I am unable to use my own image to run the test, the above error occurred whenever I try my own image.

HighwayWu commented 3 years ago

It's weird...What about replace the demo image with your own image (and rename your own image)? There may be a problem with the image path.

Muhammad-Zubair commented 3 years ago

I have tried both ways, one I placed my own image with demo images and renamed it like 006.png and same with mask the error was same, then I tried by deleting demo images and only used my own one image and one mask it produced same error.

Muhammad-Zubair commented 3 years ago

here is full error

2021-01-05 15:32:12.881648: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library libcudart.so.10.1 Test with 6 Traceback (most recent call last): File "main.py", line 219, in test() File "main.py", line 199, in test for i, data in enumerate(testset): File "main.py", line 107, in iter for i, data in enumerate(self.dataloader): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 435, in next data = self._next_data() File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 1085, in _next_data return self._process_data(data) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 1111, in _process_data data.reraise() File "/usr/local/lib/python3.6/dist-packages/torch/_utils.py", line 428, in reraise raise self.exc_type(msg) cv2.error: Caught error in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "main.py", line 33, in getitem L_i = self.load_lbp(copy.deepcopy(I_i)) File "main.py", line 85, in load_lbp img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Muhammad-Zubair commented 3 years ago

Hi, another problem that I faced is, as I am running this repo in Colab, when

  1. I put my own image it give the above error
  2. When I delete my own image it do not run even on demo images and give the same error again.
  3. Even when I reset my runtime and restart it give the same error
  4. Demo run is only successful when I delete the whole repo and re clone it. when I put my own image again the error remain same on newly cloned repo, maybe it helps you.