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

I am facing an error while custom training Yolov8 model #312

Closed
2 tasks done
t4tayyab2006 opened this issue Sep 26, 2024 · 5 comments
Closed
2 tasks done

I am facing an error while custom training Yolov8 model #312

t4tayyab2006 opened this issue Sep 26, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@t4tayyab2006
Copy link

Search before asking

  • I have searched the Roboflow Notebooks issues and found no similar bug report.

Notebook name

train-yolov8-object-detection-on-custom-dataset.ipynb

Bug

Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size
0% 0/77 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/usr/local/bin/yolo", line 8, in
sys.exit(entrypoint())
File "/usr/local/lib/python3.10/dist-packages/ultralytics/cfg/init.py", line 445, in entrypoint
getattr(model, mode)(**overrides) # default args from model
File "/usr/local/lib/python3.10/dist-packages/ultralytics/engine/model.py", line 341, in train
self.trainer.train()
File "/usr/local/lib/python3.10/dist-packages/ultralytics/engine/trainer.py", line 191, in train
self._do_train(world_size)
File "/usr/local/lib/python3.10/dist-packages/ultralytics/engine/trainer.py", line 325, in _do_train
for i, batch in pbar:
File "/usr/local/lib/python3.10/dist-packages/tqdm/std.py", line 1181, in iter
for obj in iterable:
File "/usr/local/lib/python3.10/dist-packages/ultralytics/data/build.py", line 42, in iter
yield next(self.iterator)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 630, in next
data = self._next_data()
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 1344, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py", line 1370, in _process_data
data.reraise()
File "/usr/local/lib/python3.10/dist-packages/torch/_utils.py", line 706, in reraise
raise exception
TypeError: Caught TypeError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/worker.py", line 309, in _worker_loop
data = fetcher.fetch(index) # type: ignore[possibly-undefined]
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.10/dist-packages/torch/utils/data/_utils/fetch.py", line 52, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.10/dist-packages/ultralytics/data/base.py", line 242, in getitem
return self.transforms(self.get_image_and_label(index))
File "/usr/local/lib/python3.10/dist-packages/ultralytics/data/augment.py", line 70, in call
data = t(data)
File "/usr/local/lib/python3.10/dist-packages/ultralytics/data/augment.py", line 824, in call
new = self.transform(image=im, bboxes=bboxes, class_labels=cls) # transformed
File "/usr/local/lib/python3.10/dist-packages/albumentations/core/composition.py", line 334, in call
self.preprocess(data)
File "/usr/local/lib/python3.10/dist-packages/albumentations/core/composition.py", line 368, in preprocess
p.preprocess(data)
File "/usr/local/lib/python3.10/dist-packages/albumentations/core/utils.py", line 125, in preprocess
data = self.add_label_fields_to_data(data)
File "/usr/local/lib/python3.10/dist-packages/albumentations/core/utils.py", line 185, in add_label_fields_to_data
encoded_labels = encoder.fit_transform(data[label_field])
File "/usr/local/lib/python3.10/dist-packages/albumentations/core/utils.py", line 60, in fit_transform
self.fit(y)
File "/usr/local/lib/python3.10/dist-packages/albumentations/core/utils.py", line 48, in fit
unique_labels = sorted(set(y))
TypeError: unhashable type: 'numpy.ndarray'

Environment

Google colab

Minimal Reproducible Example

No response

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@t4tayyab2006 t4tayyab2006 added the bug Something isn't working label Sep 26, 2024
@FilisKostas
Copy link

Did you find the solution to this issue? I have the exact same error

@LinasKo
Copy link
Contributor

LinasKo commented Oct 3, 2024

Hi @t4tayyab2006, @FilisKostas 👋

My apologies - I don't have the time to provide support this week. Tag me on Monday and I'll have a look! My assumption is that something changed on Ultralytics side, but I can probably figure it out.

@t4tayyab2006
Copy link
Author

@FilisKostas it was resolved by installing albumentations before ultralytics.
!pip install albumentations==1.4

@t4tayyab2006
Copy link
Author

@LinasKo Thanks for the help! It was solved.

@LinasKo
Copy link
Contributor

LinasKo commented Oct 3, 2024

Glad to hear! 😉

@LinasKo LinasKo closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants