eriklindernoren / PyTorch-YOLOv3

Minimal PyTorch implementation of YOLOv3
GNU General Public License v3.0
7.31k stars 2.63k forks source link

A problem when run train.py using my own dataset #653

Closed chen-yuxi closed 3 years ago

chen-yuxi commented 3 years ago

When I run train.py , python3 train.py --model_def config/yolov3-custom.cfg --data_config config/custom.data there is an error that Could not read image '~/PyTorch-YOLOv3/data/custom/images/train2014/ss-214_0x0.jpg'. Could not read image '~/PyTorch-YOLOv3/data/custom/images/train2014/ss-034_0x0.jpg'. Traceback (most recent call last): File "train.py", line 107, in for batchi, (, imgs, targets) in enumerate(tqdm.tqdm(dataloader, desc=f"Training Epoch {epoch}")): File "/home/cyx/.conda/envs/pytorch/lib/python3.7/site-packages/tqdm/std.py", line 1178, in iter for obj in iterable: File "/home/cyx/.conda/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 346, in next data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/cyx/.conda/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch return self.collate_fn(data) File "/home/cyx/PyTorch-YOLOv3/utils/datasets.py", line 130, in collate_fn paths, imgs, bb_targets = list(zip(*batch)) ValueError: not enough values to unpack (expected 3, got 0) Anyone can help me?

Flova commented 3 years ago

Please check the paths in youre .txt file. The leading / indicates an absolute path and I don't think your repository is located in your root directory.

chen-yuxi commented 3 years ago

Thank you. It works.

Zzheng-6 commented 3 years ago

Do you have the wrong file path? I had the same problem

chen-yuxi commented 3 years ago

In the train.txt and valid.txt , we must use absolute path, not relative path.

Zzheng-6 commented 3 years ago

Just like this? ------------------ 原始邮件 ------------------ 发件人: "eriklindernoren/PyTorch-YOLOv3" @.>; 发送时间: 2021年3月28日(星期天) 上午10:11 @.>; @.**@.>; 主题: Re: [eriklindernoren/PyTorch-YOLOv3] A problem when run train.py using my own dataset (#653)

In the train.txt and valid.txt , we must use absolute path, not relative path.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

chen-yuxi commented 3 years ago

没看懂你在说什么,我这出现的是邮件的乱码

Zzheng-6 commented 3 years ago

就像这样嘛?

data/custom/images/beizi17.jpg

data/custom/images/beizi18.jpg

data/custom/images/beizi21.jpg

data/custom/images/beizi27.jpg

data/custom/images/beizi28.jpg

------------------ 原始邮件 ------------------ 发件人: "eriklindernoren/PyTorch-YOLOv3" @.>; 发送时间: 2021年3月28日(星期天) 上午10:19 @.>; @.**@.>; 主题: Re: [eriklindernoren/PyTorch-YOLOv3] A problem when run train.py using my own dataset (#653)

没看懂你在说什么,我这出现的是邮件的乱码

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

Zzheng-6 commented 3 years ago

已经可以训练了,多谢啦 

------------------ 原始邮件 ------------------ 发件人: "eriklindernoren/PyTorch-YOLOv3" @.>; 发送时间: 2021年3月28日(星期天) 上午10:11 @.>; @.**@.>; 主题: Re: [eriklindernoren/PyTorch-YOLOv3] A problem when run train.py using my own dataset (#653)

In the train.txt and valid.txt , we must use absolute path, not relative path.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

gongyue771234 commented 1 year ago

When I run train.py , python3 train.py --model_def config/yolov3-custom.cfg --data_config config/custom.data there is an error that Could not read image '~/PyTorch-YOLOv3/data/custom/images/train2014/ss-214_0x0.jpg'. Could not read image '~/PyTorch-YOLOv3/data/custom/images/train2014/ss-034_0x0.jpg'. Traceback (most recent call last): File "train.py", line 107, in for batchi, (, imgs, targets) in enumerate(tqdm.tqdm(dataloader, desc=f"Training Epoch {epoch}")): File "/home/cyx/.conda/envs/pytorch/lib/python3.7/site-packages/tqdm/std.py", line 1178, in iter for obj in iterable: File "/home/cyx/.conda/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 346, in next data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "/home/cyx/.conda/envs/pytorch/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 47, in fetch return self.collate_fn(data) File "/home/cyx/PyTorch-YOLOv3/utils/datasets.py", line 130, in collate_fn paths, imgs, bb_targets = list(zip(*batch)) ValueError: not enough values to unpack (expected 3, got 0) Anyone can help me?

hello,I have the same problem,but I had used absolute path Snipaste_2023-04-13_15-42-08 Snipaste_2023-04-13_15-42-08