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

broken PNG file #57

Open
Fululu627 opened this issue Jul 8, 2022 · 2 comments
Open

broken PNG file #57

Fululu627 opened this issue Jul 8, 2022 · 2 comments

Comments

@Fululu627
Copy link

Thank you for your excellent work. I encountered the following problems during training. I checked the PNG image and it was normal, but I reported the following error "broken PNG file" during training. Look forward to your reply

Traceback (most recent call last):
File "main.py", line 474, in
main()
File "main.py", line 447, in main
iterate("train", args, train_loader, model, optimizer, logger, epoch) # train for one epoch
File "main.py", line 191, in iterate
for i, batch_data in enumerate(loader):
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 663, in next
data = self._next_data()
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1356, in _next_data
return self._process_data(data)
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1382, in _process_data
data.reraise()
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/_utils.py", line 475, in reraise
raise exception
SyntaxError: Caught SyntaxError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 302, in _worker_loop
data = fetcher.fetch(index)
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/hwp/PENet/dataloaders/kitti_loader.py", line 359, in getitem
rgb, sparse, target = self.getraw(index)
File "/home/hwp/PENet/dataloaders/kitti_loader.py", line 351, in getraw
(self.paths['rgb'][index] is not None and (self.args.use_rgb or self.args.use_g)) else None
File "/home/hwp/PENet/dataloaders/kitti_loader.py", line 158, in rgb_read
rgb_png = np.array(img_file, dtype='uint8') # in the range [0,255]
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/Image.py", line 675, in array
new["data"] = self.tobytes()
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/Image.py", line 718, in tobytes
self.load()
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/ImageFile.py", line 235, in load
s = read(self.decodermaxblock)
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/PngImagePlugin.py", line 896, in load_read
cid, pos, length = self.png.read()
File "/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/PngImagePlugin.py", line 166, in read
raise SyntaxError(f"broken PNG file (chunk {repr(cid)})")
File "", line None
SyntaxError: broken PNG file (chunk b'\x00\x00\x00\x00')

@JUGGHM
Copy link
Owner

JUGGHM commented Jul 11, 2022

Thanks for your interest! But we have never encountered such problems. Maybe you could check the completeness your dataset and environments.

@yhwyaaa
Copy link

yhwyaaa commented Sep 3, 2024

感谢您的出色工作。我在训练过程中遇到了以下问题。我检查了 PNG 图像,它是正常的,但我在训练期间报告了以下错误 “broken PNG file”。期待您的回复

回溯(最近一次调用最后):文件 “main.py”,第 474 行,在 main() 文件中 文件“main.py”,第 447 行,在 main iterate(“train”, args, train_loader, model, optimizer, logger, epoch) # 训练一个 epoch 文件 “main.py”,第 191 行,迭代 i 中,batch_data 在 enumerate(loader) 中):文件 “/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py”, 第 663 行,下一个 data = self._next_data() 文件“/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py”,第 1356 行,_next_data返回 self._process_data(data) 文件“/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py”,第 1382 行,_process_data data.reraise() 中文件“/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/_utils.py”,第 475 行,在 reraise 中引发异常 SyntaxError:在 DataLoader 工作进程 0 中捕获 SyntaxError。原始回溯(最近调用最后一次):文件“/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py”,第 302 行,_worker_loop data = fetcher.fetch(index)文件“/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py”,第 49 行,在 fetch data = [self.dataset[idx] for idx in possibly_batched_index] 中]文件“/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py”,第 49 行,在 data = [self.dataset[idx] 中,对于 possibly_batched_index 中的 idx]文件“/home/hwp/PENet/dataloaders/kitti_loader.py”,第 359 行,在 getitem rgb 中,稀疏,目标 = self。getraw(index) 文件 “/home/hwp/PENet/dataloaders/kitti_loader.py”,第 351 行,在 getraw 中 (self.paths['rgb'][index] 不是 None 和 (self.args.use_rgb or self.args.use_g)) else None 文件 “/home/hwp/PENet/dataloaders/kitti_loader.py”,第 158 行,rgb_read rgb_png = np.array(img_file, dtype='uint8') # 在 [0,255] 范围内文件 “/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/Image.py”,第 675 行**,数组** new[“data”] = self.tobytes() 文件 “/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/Image.py”,第 718 行,以 TB 为单位 self.load() 文件 “/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/ImageFile.py”,第 235 行,加载 s = read(self.decodermaxblock)文件 “/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/PngImagePlugin.py”,第 896 行,load_read cid, pos,长度 = self.png.read() 文件 “/home/hwp/anaconda3/envs/pytorch/lib/python3.7/site-packages/PIL/PngImagePlugin.py”,第 166 行,读取中 raise SyntaxError(f“损坏的 PNG 文件(块 {repr(cid)})”)文件“”,无行 SyntaxError:损坏的 PNG 文件(块 b'\x00\x00\x00\x00\x00')

感谢您的出色工作。您好,请问您这个问题是怎么解决的,能告知一下嘛,我修改了batchsize,修改为1时训练了5轮之后也是这个样子,修改为4时训练一轮都完成不了。期待您的回复。

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

3 participants