Closed t4tayyab2006 closed 1 month ago
Did you find the solution to this issue? I have the exact same error
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.
@FilisKostas it was resolved by installing albumentations before ultralytics. !pip install albumentations==1.4
@LinasKo Thanks for the help! It was solved.
Glad to hear! :wink:
Search before asking
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?