likyoo / change_detection.pytorch

Deep learning models for change detection of remote sensing images
MIT License
331 stars 59 forks source link

使用自己的数据集报错,哪里出了问题,如何解决 #29

Closed xuxiansheng2018 closed 11 months ago

xuxiansheng2018 commented 11 months ago

Epoch: 0 train: 0%| | 0/269 [05:14<?, ?it/s] Traceback (most recent call last): File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/runpy.py", line 192, in _run_module_as_main return _run_code(code, main_globals, None, File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/runpy.py", line 85, in _run_code exec(code, run_globals) File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/main.py", line 39, in cli.main() File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 430, in main run() File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher/../../debugpy/../debugpy/server/cli.py", line 284, in run_file runpy.run_path(target, run_name="main") File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 321, in run_path return _run_module_code(code, init_globals, run_name, File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 135, in _run_module_code _run_code(code, mod_globals, init_globals, File "/home/Faith/.vscode-server/extensions/ms-python.python-2023.20.0/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_runpy.py", line 124, in _run_code exec(code, run_globals) File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/local_test.py", line 82, in train_logs = train_epoch.run(train_loader) File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/utils/train.py", line 114, in run for (x1, x2, y, filename) in iterator: File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/tqdm/std.py", line 1178, in iter for obj in iterable: File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 634, in next data = self._next_data() File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 678, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/Faith/anaconda3/envs/d2l/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 51, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/datasets/LEVIR_CD.py", line 54, in getitem img1, img2, ann, filename = self.prepare_img_ann(idx) File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/datasets/custom.py", line 217, in prepare_img_ann img1, img2 = self.get_image(img_info) File "/home/Faith/project/sim/Siamese-pytorch-bilibili/change_detection_pytorch/change_detection_pytorch/datasets/custom.py", line 178, in get_image img2 = cv2.cvtColor(cv2.imread(img_info['img']['img2_path']), cv2.COLOR_BGR2RGB) cv2.error: OpenCV(4.8.1) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'