RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 58 but got size 57 fo

An error occurred: When using yolo v5n for network training, the input size used is 900*900. When connecting the Feature Map of the 11th layer and the 6th layer at the 12th layer Concat, there is a problem of different dimensions. After running, the following error message appears: RuntimeError: Sizes of tensors must match except […]

OpenMMlab exports the yolov3 model and uses onnxruntime and tensorrt for inference

Export onnx file Use script directly import torch from mmdet.apis import init_detector, inference_detector config_file = ‘./configs/yolo/yolov3_mobilenetv2_8xb24-ms-416-300e_coco.py’ checkpoint_file = ‘yolov3_mobilenetv2_mstrain-416_300e_coco_20210718_010823-f68a07b3.pth’ model = init_detector(config_file, checkpoint_file, device=’cpu’) # or device=’cuda:0′ torch.onnx.export(model, (torch.zeros(1, 3, 416, 416),), “yolov3.onnx”, opset_version=11) The exported onnx structure is as follows: The output is the output of three different levels of detection heads. If you […]

[Resolved] RuntimeError: CUDA error: device-side assert triggeredCUDA kernel errors might be asynchronous

Problem description The specific error message is ./aten/src/ATen/native/cuda/Loss.cu:240: nll_loss_forward_reduce_cuda_kernel_2d: block: [0,0,0], thread: [0,0,0] Assertion `t >= 0 & amp; & amp ; t < n_classes` failed. ../aten/src/ATen/native/cuda/Loss.cu:240: nll_loss_forward_reduce_cuda_kernel_2d: block: [0,0,0], thread: [1,0,0] Assertion `t >= 0 & amp; & amp; t < n_classes` failed. ../aten/src/ATen/native/cuda/Loss.cu:240: nll_loss_forward_reduce_cuda_kernel_2d: block: [0,0,0], thread: [2,0,0] Assertion `t >= 0 & […]

OpenMMlab exports the mobilenet-v2 model and uses onnxruntime and tensorrt for inference

Export onnx file Use mmpretrain to export the onnx model of mobilenet-v2: import torch from mmpretrain import get_model model = get_model(‘mobilenet-v2_8xb32_in1k’, pretrained=’mobilenet_v2_batch256_imagenet_20200708-3b2dc3af.pth’, device=’cpu’) input = torch.zeros(1, 3, 224, 224) out = model(input) torch.onnx.export(model, input, “mobilenet-v2.onnx”, opset_version=11) If mmdeploy is installed, you can export it as follows: from mmdeploy.apis import torch2onnx from mmdeploy.backend.sdk.export_info import export2SDK img […]

CoDeSys series-4, build Profinet master-slave environment based on Ubuntu’s codesys runtime extension package

CoDeSys series-4, building Profinet master-slave environment based on Ubuntu’s codesys runtime extension package Article directory CoDeSys series-4, build Profinet master-slave environment based on Ubuntu’s codesys runtime extension package I. Introduction 2. Data collection 3. Ubuntu 18.04 from installation to replacement of real-time kernel 1. Download and install Ubuntu18.04 2. Download and install the real-time kernel […]

[OpenCV implements images: image processing techniques, morphological filtering corrosion operation, RuntimeError: sequence argument must have length equal to input rank]]

Article directory summary Corrosion operating principle Select structural elements Corrosion operation effect summary Summary Tip: You can add a technical summary here For example: The development history of openAI’s GPT large model. Principle of corrosion operation Erosion is an operation in morphological image processing that finely shrinks objects in an image by gradually removing pixels […]

Linux Dynamic Linking 4: Runtime Linking

Recently I plan to take time to study “Android Development Master Course” by teacher Zhang Shaowen. I want to thoroughly understand the implementation principle of the framework for local monitoring of APP memory. I found that it was not that easy to understand. During the process of reading the code, I found that my skills […]

[C++] Polymorphism ⑦ (Polymorphism mechanism implementation principle | Virtual function table concept | Virtual function table working mechanism | vptr pointer | Virtual function table runtime mechanism | Virtual function and dynamic binding)

Article directory 1. The principle of polymorphism 1. Three conditions for polymorphism to be established 2. The concept of virtual function table 3. Working mechanism of virtual function table 4. vptr pointer 5. Virtual function table runtime mechanism 6. Virtual functions and dynamic binding 2. Code example – virtual function table 1. Code example analysis […]