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 during YOLOX training #78

Open
SliverAward opened this issue May 5, 2023 · 1 comment
Open

An error occurred during YOLOX training #78

SliverAward opened this issue May 5, 2023 · 1 comment

Comments

@SliverAward
Copy link

Initialize weights: model/backbone/backbone.pth
Starting training for 100 epochs...
0%| | 0/33 [00:15<?, ?it/s]
Traceback (most recent call last):
File "C:\Yolo-FastestV2\train.py", line 99, in
for imgs, targets in pbar:
File "C:\ProgramData\Anaconda3\lib\site-packages\tqdm\std.py", line 1195, in iter
for obj in iterable:
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch\utils\data\dataloader.py", line 634, in next
data = self._next_data()
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch\utils\data\dataloader.py", line 1346, in _next_data
return self._process_data(data)
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch\utils\data\dataloader.py", line 1372, in _process_data
data.reraise()
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch_utils.py", line 644, in reraise
raise exception
Exception: Caught Exception in DataLoader worker process 0.
Original Traceback (most recent call last):
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch\utils\data_utils\worker.py", line 308, in _worker_loop
data = fetcher.fetch(index)
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch\utils\data_utils\fetch.py", line 51, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Users\ESP\AppData\Roaming\Python\Python39\site-packages\torch\utils\data_utils\fetch.py", line 51, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "C:\Yolo-FastestV2\utils\datasets.py", line 127, in getitem
raise Exception("%s is not exist" % label_path)
Exception: C:\Yolo-FastestV2\datasets\train\KakaoTalk_20230330_195432795_03_jpg.txt is not exist

python train.py --data data/coco.data

I'm getting an error during YOLOX training,
Could you please help me with this?

@SliverAward SliverAward changed the title train error during YOLOX An error occurred during YOLOX training May 5, 2023
@SliverAward
Copy link
Author

SliverAward commented May 5, 2023

from glob import glob
import random

all_img_list = glob('C:\Yolo-FastestV2\datasets\train\.jpg') + glob('C:\Yolo-FastestV2\datasets\val\.jpg')
test_img_list = glob('C:\Yolo-FastestV2\datasets\test\*.jpg')

각 데이터셋의 비율을 8:2으로 맞춤

train_ratio = 0.9
val_ratio = 0.1 * train_ratio / (1 - train_ratio)

train_val_img_list = [x for x in all_img_list if x not in test_img_list]

random.seed(2000)
random.shuffle(train_val_img_list)

num_train = int(len(train_val_img_list) * train_ratio)
train_img_list = train_val_img_list[:num_train]
val_img_list = train_val_img_list[num_train:]

print(len(train_img_list), len(val_img_list), len(test_img_list))

with open('C:\Yolo-FastestV2\datasets\train.txt', 'w') as f:
f.write('\n'.join(train_img_list) + '\n')

with open('C:\Yolo-FastestV2\datasets\val.txt', 'w') as f:
f.write('\n'.join(val_img_list) + '\n')

with open('C:\Yolo-FastestV2\datasets\test.txt', 'w') as f:
f.write('\n'.join(test_img_list) + '\n')

I use the code

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

1 participant