Closed tapiohuang closed 1 year ago
@tapiohuang
We have yolov5s model in our pytorch model zoo, however it's a object detection model, not for instance segmentation.
Criteria criteria = Criteria.builder()
.setTypes(Image.class, DetectedObjects.class)
.optModelUrls("djl://ai.djl.pytorch/yolo5s")
.optEngine("PyTorch")
.build()
Generally, DJL in Java and python API share the same engine, ie PyTorch. So in principle, the inference with a model should behave the same between DJL and python. If not, it must be a bug. Maybe you can debug parallelly by comparing the execution between DJL and python, before they call the PyTorch cpp API? Or, as Frank mentioned above, you can debug with the help of yolov5s. Or if your model file can be shared, you can also provide a more detailed code, which we can see if we can find the bug.
问题已经解决。问题出现在resize上,在python的yolo5中,对图片的缩放是等比例缩放的,但是在DJL中resize仅仅是将宽高简单的拉伸或缩小,这就导致了无法识别。我将图片等比例缩放后已经可以正常工作。
Description
我使用yolov5中export.py导出训练好的模型,这个模型在python上运行良好,但是导出torchscript后在djl中使用却识别不出结果
References
生成ZooModel的代码
export.py的参数