-My command to exe is:
sudo python3 demo_darknet2onnx.py yolov4-custom.cfg yolov4-custom_best_0510.weights img2774.jpg 2
Please help me!
Loading weights from yolov4-custom_best_0510.weights… Done!
Export the onnx model …
/home/xavier/.local/lib/python3.6/site-packages/numpy/core/function_base.py:113: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can’t record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
num = operator.index(num)
/home/xavier/Son/transfer_yolov4/pytorch-YOLOv4/tool/yolo_layer.py:196: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
bx = bxy[:, ii : ii + 1] + torch.tensor(grid_x, device=device, dtype=torch.float32) # grid_x.to(device=device, dtype=torch.float32)
/home/xavier/Son/transfer_yolov4/pytorch-YOLOv4/tool/yolo_layer.py:198: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
by = bxy[:, ii + 1 : ii + 2] + torch.tensor(grid_y, device=device, dtype=torch.float32) # grid_y.to(device=device, dtype=torch.float32)
Hi @khuomdt3,
What’s the error? Can you generate the onnx model with these warning?
And, is this related to DeepStream? I think it may be better to report this issue on the github project.
“What’s the error?”
As usually, when i transfer model to TRT engine the success result apeared name of the generated onnx but when i pick batch_size=2 the result are:
Loading weights from yolov4-custom_best_0510.weights… Done!
Export the onnx model …
/home/xavier/.local/lib/python3.6/site-packages/numpy/core/function_base.py:113: TracerWarning: Converting a tensor to a Python index might cause the trace to be incorrect. We can’t record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
num = operator.index(num)
/home/xavier/Son/transfer_yolov4/pytorch-YOLOv4/tool/yolo_layer.py:196: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
bx = bxy[:, ii : ii + 1] + torch.tensor(grid_x, device=device, dtype=torch.float32) # grid_x.to(device=device, dtype=torch.float32)
/home/xavier/Son/transfer_yolov4/pytorch-YOLOv4/tool/yolo_layer.py:198: TracerWarning: torch.tensor results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
by = bxy[:, ii + 1 : ii + 2] + torch.tensor(grid_y, device=device, dtype=torch.float32) # grid_y.to(device=device, dtype=torch.float32)
" Can you generate the onnx model with these warning?"
Yes, it’s still generated. 2 onnx are generated!
Then when i try to transer new onnx (batch_size = 2) to TRT engine, it’s still success. But when i run it with deepstream-app, the terminal said my model’s batch is 2 and it was trying to rebuild and stop!
-“And, is this related to DeepStream? I think it may be better to report this issue on the github project.”
I will post this err/warn to github too.