Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An error occurred when running Python train_valid_reference_main.py #124

Open
hjj-lmx opened this issue May 8, 2024 · 2 comments
Open

Comments

@hjj-lmx
Copy link

hjj-lmx commented May 8, 2024

Traceback (most recent call last):
File "E:\DIS-main\DIS-main\IS-Net\train_valid_inference_main.py", line 731, in
main(train_datasets,
File "E:\DIS-main\DIS-main\IS-Net\train_valid_inference_main.py", line 600, in main
train(net,
File "E:\DIS-main\DIS-main\IS-Net\train_valid_inference_main.py", line 319, in train
for i, data in enumerate(gos_dataloader):
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch\utils\data\dataloader.py", line 631, in next
data = self._next_data()
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch\utils\data\dataloader.py", line 1346, in _next_data
return self._process_data(data)
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch\utils\data\dataloader.py", line 1372, in process_data
data.reraise()
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch_utils.py", line 705, in reraise
raise exception
RuntimeError: Caught RuntimeError in DataLoader worker process 1.
Original Traceback (most recent call last):
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch\utils\data_utils\worker.py", line 308, in worker_loop
data = fetcher.fetch(index) # type: ignore[possibly-undefined]
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torch\utils\data_utils\fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "E:\DIS-main\DIS-main\IS-Net\data_loader_cache.py", line 383, in getitem
sample = self.transform(sample)
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torchvision\transforms\transforms.py", line 95, in call
img = t(img)
File "E:\DIS-main\DIS-main\IS-Net\data_loader_cache.py", line 192, in call
image = normalize(image,self.mean,self.std)
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torchvision\transforms\functional.py", line 350, in normalize
return F_t.normalize(tensor, mean=mean, std=std, inplace=inplace)
File "E:\DIS-main\DIS-main\venv\lib\site-packages\torchvision\transforms_functional_tensor.py", line 926, in normalize
return tensor.sub
(mean).div
(std)
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

@Kaustubh-cpu
Copy link

@hjj-lmx your images contain 4 channel(alpha channel) which is not accepted by the code To resolve this error you need to remove the Alpha channel from your training data

@hjj-lmx
Copy link
Author

hjj-lmx commented May 10, 2024

@hjj-lmx 您的图像包含 4 个通道(Alpha 通道),代码不接受要解决此错误,您需要从训练数据中删除 Alpha 通道
isnet-general-use.pth, How to continue training on this model and implement it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants