G-U-N / PyCIL

PyCIL: A Python Toolbox for Class-Incremental Learning
Other
815 stars 138 forks source link

当我运行fetril方法,使用ImageNet数据集,data_manager.py报错 #73

Closed junkdog-joe closed 6 months ago

junkdog-joe commented 6 months ago

File "E:\PYCIL\PyCIL\utils\data_manager.py", line 260, in getitem image = self.trsf(pil_loader(self.images[idx])) img = t(img) TypeError: 'str' object is not callable

像这样trsf函数被认为是str

G-U-N commented 6 months ago

Could you please provide more detailed error logs?

junkdog-joe commented 6 months ago

Could you please provide more detailed error logs?

Traceback (most recent call last): File "E:\PYCIL\PyCIL\main.py", line 34, in main() File "E:\PYCIL\PyCIL\main.py", line 15, in main train(args) File "E:\PYCIL\PyCIL\trainer.py", line 18, in train _train(args) File "E:\PYCIL\PyCIL\trainer.py", line 67, in _train model.incremental_train(data_manager) File "E:\PYCIL\PyCIL\models\fetril.py", line 90, in incremental_train self._train(self.train_loader, self.test_loader) File "E:\PYCIL\PyCIL\models\fetril.py", line 106, in _train self._train_function(train_loader, test_loader, optimizer, scheduler) File "E:\PYCIL\PyCIL\models\fetril.py", line 179, in _trainfunction for i, (, inputs, targets) in enumerate(train_loader): File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data\dataloader.py", line 681, in next data = self._next_data() File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data\dataloader.py", line 1376, in _next_data return self._process_data(data) File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data\dataloader.py", line 1402, in _process_data data.reraise() File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch_utils.py", line 461, in reraise raise exception TypeError: Caught TypeError in DataLoader worker process 0. Original Traceback (most recent call last): File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\worker.py", line 302, in _worker_loop data = fetcher.fetch(index) File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\utils\data_utils\fetch.py", line 49, in data = [self.dataset[idx] for idx in possibly_batched_index] File "E:\PYCIL\PyCIL\utils\data_manager.py", line 260, in getitem image = self.trsf(pil_loader(self.images[idx])) File "C:\Users\86189\AppData\Local\Programs\Python\Python310\lib\site-packages\torchvision\transforms\transforms.py", line 94, in call img = t(img) TypeError: 'str' object is not callable

G-U-N commented 6 months ago

I think deleting this line should probably work. LMK if you fix it.

junkdog-joe commented 6 months ago

我认为删除这一应该可行。 LMK 如果你修复它。

十分感谢!我修复了这个错误

G-U-N commented 6 months ago

Great. Glad to help you with that.