DexiNed icon indicating copy to clipboard operation
DexiNed copied to clipboard

Works once but stops working after testing own image

Open krummrey opened this issue 2 years ago • 3 comments

Hi,

I am able to get it to work after cloning the repo on my Mac M1. But when I try it with my own images it stops working. Even when I delete all my images and try it with your supplied Lena.tif it doesn't work anymore. Works fine on Ubuntu 22.04

python main.py
Number of GPU's available: 0
Pytorch version: 1.10.2
mean_bgr: [103.939, 116.779, 123.68]
/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/dataloader.py:478: UserWarning: This DataLoader will create 16 worker processes in total. Our suggested max number of worker in current system is 8 (`cpuset` is not taken into account), which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
  warnings.warn(_create_warning_msg(
output_dir: result/BIPED2CLASSIC
Restoring weights from: checkpoints/BIPED/10/10_model.pth
actual size: (512, 512, 3), target size: (512, 512)
Traceback (most recent call last):
  File "/Users/jan/Documents/ML/DexiNed/main.py", line 475, in <module>
    main(args)
  File "/Users/jan/Documents/ML/DexiNed/main.py", line 404, in main
    test(checkpoint_path, dataloader_val, model, device, output_dir, args)
  File "/Users/jan/Documents/ML/DexiNed/main.py", line 125, in test
    for batch_id, sample_batched in enumerate(dataloader):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
    return self._process_data(data)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
    data.reraise()
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/_utils.py", line 434, in reraise
    raise exception
AttributeError: Caught AttributeError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Users/jan/Documents/ML/DexiNed/datasets.py", line 263, in __getitem__
    im_shape = [image.shape[0], image.shape[1]]
AttributeError: 'NoneType' object has no attribute 'shape'

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/multiprocessing/popen_fork.py", line 27, in poll
    pid, sts = os.waitpid(self.pid, flag)
  File "/opt/homebrew/Caskroom/miniforge/base/envs/DexiNed/lib/python3.9/site-packages/torch/utils/data/_utils/signal_handling.py", line 66, in handler
    _error_if_any_worker_fails()
RuntimeError: DataLoader worker (pid 12019) is killed by signal: Terminated: 15. 

krummrey avatar Jun 26 '22 10:06 krummrey

Hi, For any reason you are having this message AttributeError: 'NoneType' object has no attribute 'shape' Can you check if the dataloared function is reading your image?

xavysp avatar Jun 27 '22 15:06 xavysp

Yes, I've printed the shape variables. it has width height and three color planes. That's what puzzles me. It works fine right after cloning it from the repo with the provided test image. Sometimes with one or two of my images, but then stops working even when I remove all of my images. As if the code somewhere alters something I haven't caught yet.

krummrey avatar Jun 28 '22 07:06 krummrey

At this point I do not see any problem, sorry. Maybe you can try with this lightweight model: LDC

xavysp avatar Jun 29 '22 16:06 xavysp