Closed DC-hydrid closed 2 months ago
Sorry,I find the reasson. I edit the first setting in the Train Pipline "LoadFromFile". I comment it out because it shows that transformers has no attribute "LoadFromFile". At the first time I thought that maybe the code from torchvision import transformers
are wrong. After read the source code, I have some new realize. But in fact, I still not have a comprehensive understand of the register part. T~T
This is the information
Traceback (most recent call last): File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/tools/train.py", line 170, in
main()
File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/tools/train.py", line 164, in main
train(model, runner, lr_update_func, device, epoch, data_cfg.get('train').get('epoches'), data_cfg.get('test'), meta)
File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/utils/train_utils.py", line 208, in train
for iter, batch in enumerate(runner.get('train_loader')):
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/utils/dataloader.py", line 43, in getitem
results = self.pipeline(copy.deepcopy(self.data_infos[index]))
File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/core/datasets/compose.py", line 33, in call
data = t(data)
File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/core/datasets/transforms.py", line 764, in call
self._resize_img(results)
File "/home/l1ydr1d/MedSAM2/MedSAM-MedSAM2/Awesome-Backbones/core/datasets/transforms.py", line 726, in _resize_img
img = results[key]
KeyError: 'img'
File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 631, in next data = self._next_data() File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1346, in _next_data return self._process_data(data) File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/utils/data/dataloader.py", line 1372, in _process_data data.reraise() File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/_utils.py", line 705, in reraise raise exception KeyError: Caught KeyError in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/utils/data/_utils/worker.py", line 308, in _worker_loop data = fetcher.fetch(index) # type: ignore[possibly-undefined] File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/l1ydr1d/miniconda3/envs/medsam2_py310_torch2-3-1_cuda121_env/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py", line 51, in
the Train Pipline setting is:
train_pipeline = [
dict(type='LoadImageFromFile'),
]