-
Notifications
You must be signed in to change notification settings - Fork 12
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
RuntimeError: torch.cat(): input types can't be cast to the desired output type Byte #14
Comments
你好,请问一下你train_data数据集是从哪下载的, 因为train.py包含: |
您好,这块我修改为了自己想训练的数据集
…---- 回复的原邮件 ----
| 发件人 | ***@***.***> |
| 日期 | 2024年01月04日 19:23 |
| 收件人 | ***@***.***> |
| 抄送至 | ***@***.***>***@***.***> |
| 主题 | Re: [danfenghong/IEEE_TIP_UIU-Net] RuntimeError: torch.cat(): input types can't be cast to the desired output type Byte (Issue #14) |
你好,请问一下你train_data数据集是从哪下载的, 因为train.py包含:
tra_image_dir = os.path.join('DUTS', 'DUTS-TR', 'DUTS-TR', 'im_aug' + os.sep)
tra_label_dir = os.path.join('DUTS', 'DUTS-TR', 'DUTS-TR', 'gt_aug' + os.sep)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
你好,我也遇到这个问题了,请问您解决了吗 |
将num_workers改成0貌似就可以了。 |
作者为了提速把num_workers设置为1,就是多一个子进程数量,在train.py文件里面找到如下代码把num_workers改成0就好了,但是训练速度会下降 |
您好,我在使用其它两种数据集训练时,在一个epoch下,不同批次会出现报错
l0: 0.010986, l1: 0.011472, l2: 0.014452, l3: 0.004034, l4: 0.004883, l5: 0.013490, l6: 0.004046
[epoch: 1/500, batch: 45/ 213, ite: 15] train loss: 0.884871, tar: 0.183994
Traceback (most recent call last):
File "D:\contrast-methods\IEEE_TIP_UIU-Net-main\train.py", line 139, in
for i, data in enumerate(salobj_dataloader):
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data\dataloader.py", line 630, in next
data = self._next_data()
^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data\dataloader.py", line 1345, in _next_data
return self._process_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data\dataloader.py", line 1371, in _process_data
data.reraise()
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch_utils.py", line 694, in reraise
raise exception
RuntimeError: Caught RuntimeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\fetch.py", line 54, in fetch
return self.collate_fn(data)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\collate.py", line 265, in default_collate
return collate(batch, collate_fn_map=default_collate_fn_map)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\collate.py", line 127, in collate
return elem_type({key: collate([d[key] for d in batch], collate_fn_map=collate_fn_map) for key in elem})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\collate.py", line 127, in
return elem_type({key: collate([d[key] for d in batch], collate_fn_map=collate_fn_map) for key in elem})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\collate.py", line 119, in collate
return collate_fn_map[elem_type](batch, collate_fn_map=collate_fn_map)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hp-\AppData\Roaming\Python\Python311\site-packages\torch\utils\data_utils\collate.py", line 162, in collate_tensor_fn
return torch.stack(batch, 0, out=out)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: torch.cat(): input types can't be cast to the desired output type Byte。
请问这种错误有解决方案吗?
The text was updated successfully, but these errors were encountered: