YOLOv8-TensorRT-CPP icon indicating copy to clipboard operation
YOLOv8-TensorRT-CPP copied to clipboard

Detected 0 objects

Open adrianosantospb opened this issue 10 months ago • 3 comments

Hi,

Thanks for this great repo.

So, I'm trying to use it with a YOLOV8x seg model. My model uses only one class and its input is 448x448. I changed the options parameters as:

    int segChannels = 32;
    int segH = 112;
    int segW = 112;

   std::vector<std::string> classNames = {
        "tool"
    };

I confirm that segH and segW using Netron.

name: output0
tensor: float32[1,37,4116]

name: output1
tensor: float32[1,32,112,112]

I tested the onnx weights using Ultralytics, and I got the expected results (12 objects ). The command used was:

yolo predict task=segment model=~/Documents/tools/bkp/yolov8seg.onnx

I used the pytorch2onnx.py script to convert from pt to onnx.

from ultralytics import YOLO
import argparse

parser = argparse.ArgumentParser(description='Process pt file.')
parser.add_argument('--pt_path', help='path to pt file', required=True)
args = parser.parse_args()
# TODO: Specify which model you want to convert
# Model can be downloaded from https://github.com/ultralytics/ultralytics
model = YOLO(args.pt_path)
model.fuse()
model.info(verbose=False)  # Print model information
model.export(format="onnx", simplify=True, opset=12)

P.S: the simplify=True gave a different output... maybe you all can consider using it as False.

So... When I lunch the command: Searching for engine file with name: yolov8seg.engine.NVIDIAGeForceRTX2070.fp16.1.1

Engine found, not regenerating...
CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage and speed up TensorRT initialization. See "Lazy Loading" section of CUDA documentation https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#lazy-loading
**Detected 0 objects**
Saved annotated image to: /home/adriano/Documents/dataset_base/o_annotated.jpg

Versions used:

  • TensorRT-8.6.0.12
  • Cuda compilation tools, release 12.2, V12.2.140
  • Ultralytics 8.0.208

I tested with FP32 and FP16 and I got the same result.

Does someone have some idea?

adrianosantospb avatar Apr 03 '24 19:04 adrianosantospb

Can you please upload the model and I'll have a look on my end.

cyrusbehr avatar Apr 04 '24 00:04 cyrusbehr

Can you please upload the model and I'll have a look on my end.

Hi Cyrus, thank you for your response. (I sent a message to you on Linkedin).

I've noticed that it might be related to a library version issue, even though I've tested it using the Ultralytics weights and encountered the same problem. When I use the Ultralytics tools, it works as expected.

Could you please share the versions of the libraries you're using?

adrianosantospb avatar Apr 04 '24 18:04 adrianosantospb

Which libraries in particular do you need the version for?

cyrusbehr avatar Apr 04 '24 19:04 cyrusbehr