Closed mofatuzi closed 9 months ago
Hi !
The image name is "image1", only 1 image. The image size is 1024*1056, 1.7M. My compute card is Quadro P1000, with only 4G memory.
I can't reproduce the error on my computer. I created a new folder named 123 and put an image called 'image1.tif' in the folder. It runs successfully. Can I have a look at your cropped folder and the name of the cropped images?
Hi! Recently I want to try vEM-i on testing vEM data, and I have met same problem as @mofatuzi (although I use vEMDiffuse-i instead of denoise). To solve upper problem, I have changed some code in dataset.py-class vEMDiffuseTestAnIsotropic:
def read_dataset(self, data_root):
# Previous
# import os
# z_depth = find_max_folder_number(data_root)
# gt_paths = []
# below_paths = []
# for i in range(0, z_depth):
# for file in os.listdir(os.path.join(data_root, str(i))):
# gt_paths.append(os.path.join(data_root, str(i), file))
# below_paths.append(os.path.join(data_root, str(i + 1), file))
# # below_paths.append(os.path.join(data_root, str(i + 1), file))
# My change
from pathlib import Path
gt_paths = list(Path(data_root).glob("*.tif"))
below_paths = list(Path(data_root).glob("*.tif"))
gt_paths = [str(p) for p in gt_paths]
below_paths = [str(p) for p in below_paths]
return gt_paths[:-1], below_paths[1:]
Although upper code can only deal with very simple and small dataset (like, gt_path and below_path are not sorted, and output image seems saved with folder name '0'), but it now works on my computer. I think it may work on others computer.
Best wishes!
BTW, my folder and images are like:
EMDiffuse_val
|---- 0.tif
|---- 1.tif
``
(emdiffuse) PS C:\Users\GD\EMDiffuse-master> python crop_single_file.py --path ./testem --task denoise (emdiffuse) PS C:\Users\GD\EMDiffuse-master> python run.py -p test -c config/EMDiffuse-n.json -g 0 -b 60 --path ./testem/denoise_test_crop_patches export CUDA_VISIBLE_DEVICES=0 run.py:28: UserWarning: You have chosen to use cudnn for accleration. torch.backends.cudnn.enabled=True warnings.warn('You have chosen to use cudnn for accleration. torch.backends.cudnn.enabled=True') {'data_root': './testem/denoise_test_crop_patches', 'norm': True, 'percent': False, 'phase': 'val'} in dataset: ./testem/denoise_test_crop_patches val network norm: True Traceback (most recent call last): File "run.py", line 97, in <module> main_worker(0, 1, opt) File "run.py", line 60, in main_worker model.test() File "C:\Users\GD\EMDiffuse-master\models\EMDiffuse_model.py", line 183, in test for phase_data in self.phase_loader: File "C:\Users\GD\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 517, in __next__ data = self._next_data() File "C:\Users\GD\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 1199, in _next_data return self._process_data(data) File "C:\Users\GD\anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 1225, in _process_data data.reraise() File "C:\Users\GD\anaconda3\lib\site-packages\torch\_utils.py", line 429, in reraise raise self.exc_type(msg) ValueError: Caught ValueError in DataLoader worker process 0. Original Traceback (most recent call last): File "C:\Users\GD\anaconda3\lib\site-packages\torch\utils\data\_utils\worker.py", line 202, in _worker_loop data = fetcher.fetch(index) File "C:\Users\GD\anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\GD\anaconda3\lib\site-packages\torch\utils\data\_utils\fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\GD\EMDiffuse-master\data\dataset.py", line 72, in __getitem__ ret['noise_level'] = torch.tensor([int(file_name.split('/')[-2].split('_')[-1])]) ValueError: invalid literal for int() with base 10: 'testem'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "run.py", line 97, in
main_worker(0, 1, opt)
File "run.py", line 60, in main_worker
model.test()
File "C:\Users\GD\EMDiffuse-master\models\EMDiffuse_model.py", line 200, in test
self.writer.save_images(self.save_current_results(), norm=self.opt['norm'])
File "C:\Users\GD\EMDiffuse-master\core\logger.py", line 126, in save_images
raise NotImplementedError('You must specify the context of name and result in save_current_results functions of model.')
NotImplementedError: You must specify the context of name and result in save_current_results functions of model.`