ultralytics / hub

Ultralytics HUB tutorials and support

Home Page:https://hub.ultralytics.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'OBBTrainer' object has no attribute 'data'

Burhan-Q opened this issue Β· comments

Search before asking

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

HUB Component

Training

Bug

@HAMeleON001 initially reported this issue in the Ultralytics Discord server. Originally reported the error from a Colab instance, I tested and found the same error when running locally using ultralyitcs and hub-sdk. Replicated using the dota8 dataset.

Error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "Q:\yolov8.1\ultralytics\ultralytics\engine\model.py", line 582, in train
    self.trainer = (trainer or self._smart_load("trainer"))(overrides=args, _callbacks=self.callbacks)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "Q:\yolov8.1\ultralytics\ultralytics\models\yolo\obb\train.py", line 29, in __init__
    super().__init__(cfg, overrides, _callbacks)
  File "Q:\yolov8.1\ultralytics\ultralytics\engine\trainer.py", line 139, in __init__
    self.trainset, self.testset = self.get_dataset(self.data)
                                                   ^^^^^^^^^
AttributeError: 'OBBTrainer' object has no attribute 'data'

This does not occur when using a local model however. This will not throw any error where the Minimal Reproducible Example (field below) will throw the error shown above.

from ultralytics import YOLO

model = YOLO("yolov8s-obb.pt")
results = model.train(data="dota8.yaml", epochs=15)

Environment

Ultralytics YOLOv8.1.12 πŸš€ Python-3.11.6 torch-2.1.1+cu121 CUDA:0 (NVIDIA GeForce RTX 3080, 12288MiB)
Setup complete βœ… (12 CPUs, 31.9 GB RAM, 201.9/1863.0 GB disk)

OS                  Windows-10-10.0.19045-SP0
Environment         Windows
Python              3.11.6
Install             git
RAM                 31.86 GB
CPU                 Intel Core(TM) i5-10600K 4.10GHz
CUDA                12.1

matplotlib          βœ… 3.8.2>=3.3.0
numpy               βœ… 1.26.3>=1.22.2
opencv-python       βœ… 4.9.0.80>=4.6.0
pillow              βœ… 10.2.0>=7.1.2
pyyaml              βœ… 6.0.1>=5.3.1
requests            βœ… 2.31.0>=2.23.0
scipy               βœ… 1.11.4>=1.4.1
torch               βœ… 2.1.1+cu121>=1.8.0
torchvision         βœ… 0.16.1+cu121>=0.9.0
tqdm                βœ… 4.66.1>=4.64.0
psutil              βœ… 5.9.7
py-cpuinfo          βœ… 9.0.0
thop                βœ… 0.1.1-2209072238>=0.1.1
pandas              βœ… 2.1.4>=1.1.4
seaborn             βœ… 0.13.1>=0.11.0

Minimal Reproducible Example

from ultralytics import YOLO, checks, hub
checks()

hub.login(API_KEY)

model = YOLO('https://hub.ultralytics.com/models/vo8NfBNf9TpIHbhnr5Vy')
results = model.train()

Additional

@HAMeleON001 should be the main point of contact for this issue. I offered to open the issue for them and add my details. They will include any additional information regarding their specific circumstances, but this was quickly reproducible. I can also provide additional information as required.

I am having exactly the same issue trying to train a yolov8s-obb model, using the same code.

@aharmer hello! Thank you for reporting this issue with the 'OBBTrainer' object. It seems like there might be a problem with the initialization of the training data within the OBBTrainer class. We appreciate both of you bringing this to our attention.

As a first step, please ensure that you are using the latest version of the ultralytics and hub-sdk packages, as updates may contain fixes for such issues.

If the problem persists after updating, it would be helpful to have a bit more context. Could you please verify if the dataset configuration (dota8.yaml) is correctly set up and accessible in your environment? Also, ensure that the dataset is properly formatted and compatible with the expected input for the OBB (oriented bounding box) model training.

For further troubleshooting, you can refer to the Ultralytics HUB Docs for guidance on setting up your training environment and datasets. If the issue is not resolved with the documentation, please provide any additional details about your setup or any changes you've made to the default configuration, which could help us identify the root cause of the problem.

We'll be looking into this and will keep you updated on our progress. Meanwhile, if you have any more information or questions, feel free to share them, and we'll do our best to assist you. Thank you for your patience and for being a part of the YOLO community! πŸš€

@aharmer This bug is confirmed we are looking into a resolution.

@Burhan-Q @aharmer This bug was solved and the fix deployed in ultralytics 8.1.25.