Closed tnghieu closed 9 months ago
Did you choose the right model?
My coworker is generating a .pt weights file made from a yoloV5 object detection model.
What's the best use of this library? I'm assuming it's using the PytorchLite.loadObjectDetectionModel().
I've tried both the .pt and the exported .torchscript versions and they don't work as the model to load.
!python export.py --weights "the weights of your model" --include torchscript --img 640 --optimize
this is using yolov5 repo for example
Yes I used that to convert the .pt to torch script.
That's weird the model I have works, and I am using latest version of pytorch mobile, maybe because it's a pytorch v2 model?
What does 640 represent in the --img flag? Height or Width?
If my images are 640 width by 480 height, what should I use?
Also for Model setup as well:
await PytorchLite.loadObjectDetectionModel( "assets/models/weights1280.torchscript", 1, 640, 640, labelPath: "assets/labels/sharklabel.txt", objectDetectionModelType: ObjectDetectionModelType.yolov5, );
640 represents model input size, width and height, for yolov5 it's the same, it doesn't matter your image width and height, the code will resize it to work with your model
Thanks, I have it working now. The issue was with these dimensions. Closing this.
I'm on the latest 4.2.0+2
The following operation failed in the TorchScript interpreter. Traceback of TorchScript, serialized code (most recent call last): File "code/torch/models/yolo/___torch_mangle1054.py", line 80, in forward input31 = torch.silu(_38) _39 = torch.upsample_nearest2d(input31, None, [2., 2.]) input32 = torch.cat([_39, input20], 1)