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

implementation of LDConv #18156

Open
1 task done
ChandraPrakash-123 opened this issue Dec 10, 2024 · 5 comments
Open
1 task done

implementation of LDConv #18156

ChandraPrakash-123 opened this issue Dec 10, 2024 · 5 comments
Labels
detect Object Detection issues, PR's question Further information is requested

Comments

@ChandraPrakash-123
Copy link

Search before asking

  • I have searched the Ultralytics YOLO issues and discussions and found no similar questions.

Question

I try to implement the LDConv as CV-ZhangXin provides code on github and its implemented already on yolov8 according to that.When I applied after adding LDConv in conv.py and rendering nn.task.py getting error after training that is

RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

what is reason to get this error. i am using Ultralytics YOLOv8.2.41 🚀 Python-3.9.0 torch-2.4.0+cu121 CUDA:0 (NVIDIA GeForce RTX 4090, 24217MiB)

Additional

Ultralytics YOLO 🚀, GPL-3.0 license

Parameters

nc: 80 # number of classes
depth_multiple: 0.33 # scales module repeats
width_multiple: 0.25 # scales convolution channels

YOLOv8.0n backbone

backbone:

[from, repeats, module, args]

  • [-1, 1, Conv, [64, 3, 2]] # 0-P1/2
  • [-1, 1, LDConv, [128, 6, 2]] # 1-P2/4
  • [-1, 3, C2f, [128, True]]
  • [-1, 1, LDConv, [256, 6, 2]] # 3-P3/8
  • [-1, 6, C2f, [256, True]]
  • [-1, 1, LDConv, [512, 6, 2]] # 5-P4/16
  • [-1, 6, C2f, [512, True]]
  • [-1, 1, LDConv, [1024, 6, 2]] # 7-P5/32
  • [-1, 3, C2f, [1024, True]]
  • [-1, 1, SPPF, [1024, 5]] # 9

YOLOv8.0n head

head:

  • [-1, 1, nn.Upsample, [None, 2, 'nearest']]

  • [[-1, 6], 1, Concat, [1]] # cat backbone P4

  • [-1, 3, C2f, [512]] # 12

  • [-1, 1, nn.Upsample, [None, 2, 'nearest']]

  • [[-1, 4], 1, Concat, [1]] # cat backbone P3

  • [-1, 3, C2f, [256]] # 15 (P3/8-small)

  • [-1, 1, LDConv, [256, 6, 2]]

  • [[-1, 12], 1, Concat, [1]] # cat head P4

  • [-1, 3, C2f, [512]] # 18 (P4/16-medium)

  • [-1, 1, LDConv, [512, 6, 2]]

  • [[-1, 9], 1, Concat, [1]] # cat head P5

  • [-1, 3, C2f, [1024]] # 21 (P5/32-large)

  • [[15, 18, 21], 1, Detect, [nc]] # Detect(P3, P4, P5)

@ChandraPrakash-123 ChandraPrakash-123 added the question Further information is requested label Dec 10, 2024
@UltralyticsAssistant UltralyticsAssistant added the detect Object Detection issues, PR's label Dec 10, 2024
@UltralyticsAssistant
Copy link
Member

👋 Hello @ChandraPrakash-123, thank you for your interest in Ultralytics 🚀! We recommend a visit to the Docs for new users, where you can find many Python and CLI usage examples, and where many of the most common questions may already be answered.

If this is a 🐛 Bug Report, please provide a minimum reproducible example to help us debug it. This would include the exact code changes you’ve made to integrate LDConv, the script you’re running, and a clear indication of any modifications to your environment.

If this is a custom training ❓ Question, please provide as much detail as possible, including datasets used, training configurations, logs, and the exact modifications you've made to files like conv.py and nn.task.py. Verifying your code against the Tips for Best Training Results might also be beneficial.

The error you're encountering suggests a CUDA device-side assertion failure, which might be related to mismatched shapes, unsupported operations, or out-of-bound index issues. For debugging, you can try setting the environment variable CUDA_LAUNCH_BLOCKING=1 before running your script to get a more accurate stack trace:

export CUDA_LAUNCH_BLOCKING=1

Additionally, please ensure you are running the latest version of the ultralytics package, including all requirements in a Python>=3.8 environment with PyTorch>=1.8. Update your installation with:

pip install -U ultralytics

Environments

Make sure your environment is up to date. YOLO models can be run seamlessly in any of these verified setups:

Join the Ultralytics community where it suits you best! For quick answers, hop on Discord 🎧. Prefer in-depth discussions? Check out Discourse. You can also explore our Subreddit for community discussions.

Status

Ultralytics CI

If this badge is green, all Ultralytics CI tests are currently passing. These CI tests verify the correct operation of all YOLO Modes and Tasks on macOS, Windows, and Ubuntu every 24 hours and on every commit.

This is an automated response to assist you quickly 🔄. An Ultralytics engineer will follow up to provide more detailed help soon! 😊

@ChandraPrakash-123
Copy link
Author

I have also tried with yolo11 and facing same issue as i told you . currently i am running this on cityscape dataset before any change in code i have already run that code and its run properly . now i want to do custom training with some change as i share my custom.yaml file to you. exact code of LDConv you can get from here LDConv
conv.zip

Copy link
Collaborator

You can run with device="cpu" and it will show you the actual error.

@ChandraPrakash-123
Copy link
Author

getting same error while running this -
from ultralytics import YOLO

device = torch.device('cpu')

Load a model

model = YOLO("yolov8_custom.yaml")

Train the model

train_results = model.train(
data="data.yaml", # path to dataset YAML
epochs=5, # number of training epochs
imgsz=640, # training image size
).to(device)

error-
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call, so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

Copy link
Collaborator

You should pass device="cpu" to model.train().

https://docs.ultralytics.com/modes/train/#train-settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
detect Object Detection issues, PR's question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants