Closed m-mehdi-git closed 9 months ago
@m-mehdi-git hello,
Thank you for reporting this issue and for providing comprehensive information around it. This NameError: name 'mask_h' is not defined
error typically suggests that Python can't find a definition for mask_h
in the current namespace.
Looking at the YOLOv8 implementation, mask_h
should be defined within the context where it is being used. Generally, this would be set when detection masks are being processed during training.
You mentioned that you're using original code from the OBB branch. It's indeed possible that there might be a bug or omission in this branch that may have caused this error. Since it is hard to diagnose the issue fully without assessing the complete environment and code, it is recommended to closely evaluate the logic related to mask_h
in your codebase.
Rest assured, we value your contribution to the community and we are here to provide any assistance needed.
Looking at the code snippet you provided, it seems like you’re doing everything correctly from the YOLO function to the training function calls. Given the complexity of the issue, it might be beneficial to debug incrementally, checking variable definitions and their scope.
If this issue persists, the next step would be to report it to the team responsible for maintaining the OBB branch (or the branch where the issue was identified) for further investigation.
We're grateful for your help in making YOLOv8 better.
Best regards, Glenn Jocher.
@m-mehdi-git a few things
torch 1.10.1
however the requirements file specifies torch 1.18
or greater👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.
For additional resources and information, please see the links below:
Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!
Thank you for your contributions to YOLO 🚀 and Vision AI ⭐
Search before asking
YOLOv8 Component
Train
Bug
d:\yoloV8\yolov8_detect-obb.ipynb Cell 3 line 5
----> 2 results = model.train(data='DOTAv2.yaml', epochs=100, imgsz=640, batch=4)
File c:\Users\user\anaconda3\envs\yolov8_obb\lib\site-packages\ultralytics\engine\model.py:341, in Model.train(self, trainer, **kwargs) 339 self.model = self.trainer.model 340 self.trainer.hub_session = self.session # attach optional HUB session --> 341 self.trainer.train() 342 # Update model and cfg after training 343 if RANK in (-1, 0):
File c:\Users\user\anaconda3\envs\yolov8_obb\lib\site-packages\ultralytics\engine\trainer.py:195, in BaseTrainer.train(self) 192 ddp_cleanup(self, str(file)) 194 else: --> 195 self._do_train(world_size)
File c:\Users\user\anaconda3\envs\yolov8_obb\lib\site-packages\ultralytics\engine\trainer.py:348, in BaseTrainer._do_train(self, world_size) 346 with torch.cuda.amp.autocast(self.amp): 347 batch = self.preprocess_batch(batch) --> 348 self.loss, self.loss_items = self.model(batch) ... --> 454 if tuple(masks.shape[-2:]) != (mask_h, mask_w): # downsample 455 masks = F.interpolate(masks[None], (mask_h, mask_w), mode='nearest')[0] 457 for i in range(batch_size):
NameError: name 'mask_h' is not defined
Environment
New https://pypi.org/project/ultralytics/8.0.202 available Update with 'pip install -U ultralytics' Ultralytics YOLOv8.0.173 Python-3.9.18 torch-1.10.1+cu102 CUDA:0 (NVIDIA GeForce GTX 1650, 4096MiB) WARNING Upgrade to torch>=2.0.0 for deterministic training. [34m[1mengine\trainer: [0mtask=obb, mode=train, model=yolov8n-obb.yaml, data=DOTAv2.yaml, epochs=100, patience=50, batch=4, imgsz=640, save=True, save_period=-1, cache=False, device=None, workers=8, project=None, name=None, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, show=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, vid_stride=1, stream_buffer=False, line_width=None, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, boxes=True, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, cfg=None, tracker=botsort.yaml, save_dir=runs\obb\train4 Overriding model.yaml nc=80 with nc=18
Minimal Reproducible Example
from ultralytics import YOLO from ultralytics import settings from PIL import Image
model = YOLO('yolov8n-obb.yaml') results = model.train(data='DOTAv2.yaml', epochs=100, imgsz=640, batch=4)
Additional
i'm using the original code with the yovov8 installed from the obb branch
Are you willing to submit a PR?