Closed GreatV closed 1 year ago
π Hello @GreatV, thank you for your interest in YOLOv5 π! Please visit our βοΈ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution.
If this is a π Bug Report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom training β Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available.
For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com.
Python>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started:
git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on MacOS, Windows, and Ubuntu every 24 hours and on every commit.
@GreatV this may be a TRT issue. Are you using the latest version of TRT 8?
On Colab we see identical results on TRT Engine benchmarking for segmentation models (using the latest TRT, 8.4.3.1), i.e.:
@glenn-jocher My custom dataset has only one class, does this matter?
(yolo) ubuntu@VM-0-3-ubuntu:~/yolov5$ python export.py --weights runs/train-seg/exp/weights/best.pt --include engine --simplify --device 0
export: data=data/coco128.yaml, weights=['runs/train-seg/exp/weights/best.pt'], imgsz=[640, 640], batch_size=1, device=0, half=False, inplace=False, keras=False, optimize=False, int8=False, dynamic=False, simplify=True, opset=12, verbose=False, workspace=4, nms=False, agnostic_nms=False, topk_per_class=100, topk_all=100, iou_thres=0.45, conf_thres=0.25, include=['engine']
YOLOv5 π v7.0-5-gbfa1f23 Python-3.9.15 torch-1.13.0 CUDA:0 (Tesla T4, 14961MiB)
Fusing layers...
Model summary: 165 layers, 7398422 parameters, 0 gradients, 25.7 GFLOPs
PyTorch: starting from runs/train-seg/exp/weights/best.pt with output shape (1, 25200, 38) (14.4 MB)
ONNX: starting export with onnx 1.12.0...
ONNX: simplifying with onnx-simplifier 0.4.10...
ONNX: export success β
1.6s, saved as runs/train-seg/exp/weights/best.onnx (28.7 MB)
TensorRT: starting export with TensorRT 8.4.3.1...
[11/26/2022-15:15:30] [TRT] [I] [MemUsageChange] Init CUDA: CPU +302, GPU +0, now: CPU 2487, GPU 1265 (MiB)
[11/26/2022-15:15:35] [TRT] [I] [MemUsageChange] Init builder kernel library: CPU +59, GPU +0, now: CPU 2565, GPU 1265 (MiB)
/home/ubuntu/yolov5/export.py:271: DeprecationWarning: Use set_memory_pool_limit instead.
config.max_workspace_size = workspace * 1 << 30
[11/26/2022-15:15:35] [TRT] [I] ----------------------------------------------------------------
[11/26/2022-15:15:35] [TRT] [I] Input filename: runs/train-seg/exp/weights/best.onnx
[11/26/2022-15:15:35] [TRT] [I] ONNX IR version: 0.0.7
[11/26/2022-15:15:35] [TRT] [I] Opset version: 12
[11/26/2022-15:15:35] [TRT] [I] Producer name: pytorch
[11/26/2022-15:15:35] [TRT] [I] Producer version: 1.13.0
[11/26/2022-15:15:35] [TRT] [I] Domain:
[11/26/2022-15:15:35] [TRT] [I] Model version: 0
[11/26/2022-15:15:35] [TRT] [I] Doc string:
[11/26/2022-15:15:35] [TRT] [I] ----------------------------------------------------------------
[11/26/2022-15:15:35] [TRT] [W] onnx2trt_utils.cpp:369: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
TensorRT: input "images" with shape(1, 3, 640, 640) DataType.FLOAT
TensorRT: output "output0" with shape(1, 25200, 38) DataType.FLOAT
TensorRT: output "output1" with shape(1, 32, 160, 160) DataType.FLOAT
TensorRT: building FP32 engine as runs/train-seg/exp/weights/best.engine
/home/ubuntu/yolov5/export.py:298: DeprecationWarning: Use build_serialized_network instead.
with builder.build_engine(network, config) as engine, open(f, 'wb') as t:
[11/26/2022-15:15:37] [TRT] [I] [MemUsageChange] Init cuBLAS/cuBLASLt: CPU +0, GPU +8, now: CPU 2599, GPU 1273 (MiB)
[11/26/2022-15:15:37] [TRT] [I] [MemUsageChange] Init cuDNN: CPU +0, GPU +8, now: CPU 2599, GPU 1281 (MiB)
[11/26/2022-15:15:37] [TRT] [W] TensorRT was linked against cuDNN 8.4.1 but loaded cuDNN 8.3.2
[11/26/2022-15:15:37] [TRT] [I] Local timing cache in use. Profiling results in this builder pass will not be stored.
[11/26/2022-15:16:22] [TRT] [I] Some tactics do not have sufficient workspace memory to run. Increasing workspace size will enable more tactics, please check verbose output for requested sizes.
[11/26/2022-15:17:20] [TRT] [I] Detected 1 inputs and 5 output network tensors.
[11/26/2022-15:17:21] [TRT] [I] Total Host Persistent Memory: 168992
[11/26/2022-15:17:21] [TRT] [I] Total Device Persistent Memory: 0
[11/26/2022-15:17:21] [TRT] [I] Total Scratch Memory: 0
[11/26/2022-15:17:21] [TRT] [I] [MemUsageStats] Peak memory usage of TRT CPU/GPU memory allocators: CPU 0 MiB, GPU 0 MiB
[11/26/2022-15:17:21] [TRT] [I] [BlockAssignment] Algorithm ShiftNTopDown took 22.6327ms to assign 7 blocks to 139 nodes requiring 35635200 bytes.
[11/26/2022-15:17:21] [TRT] [I] Total Activation Memory: 35635200
[11/26/2022-15:17:21] [TRT] [I] [MemUsageChange] TensorRT-managed allocation in building engine: CPU +0, GPU +0, now: CPU 0, GPU 0 (MiB)
[11/26/2022-15:17:21] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
[11/26/2022-15:17:21] [TRT] [W] The getMaxBatchSize() function should not be used with an engine built from a network created with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag. This function will always return 1.
TensorRT: export success β
112.6s, saved as runs/train-seg/exp/weights/best.engine (31.4 MB)
Export complete (116.1s)
Results saved to /home/ubuntu/yolov5/runs/train-seg/exp/weights
Detect: python segment/detect.py --weights runs/train-seg/exp/weights/best.engine
Validate: python segment/val.py --weights runs/train-seg/exp/weights/best.engine
PyTorch Hub: model = torch.hub.load('ultralytics/yolov5', 'custom', 'runs/train-seg/exp/weights/best.engine') # WARNING β οΈ SegmentationModel not yet supported for PyTorch Hub AutoShape inference
Visualize: https://netron.app
@GreatV I'll try to reproduce with GlobalWheat2020.yaml. In the meantime I've corrected the Usage example for segmentation exports to point to segment/predict.py rather than segment/detect.py in https://github.com/ultralytics/yolov5/pull/10303
@GreatV oh, nevermind, we actually don't have a single-class segmentation dataset to train. You'll have to debug this one on your own.
@glenn-jocher OK, I will try to figure it out.
π Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs.
Access additional YOLOv5 π resources:
Access additional Ultralytics β‘ resources:
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 YOLOv5 π and Vision AI β!
@GreatV great! Feel free to ask if you have any further questions. Good luck!
Search before asking
YOLOv5 Component
Detection, Export
Bug
here is the output of .engine model
Here is the output of .onnx model
Environment
Minimal Reproducible Example
Additional
Are you willing to submit a PR?