优化vision demo

This commit is contained in:
deng_wu_jie
2025-09-11 09:52:24 +08:00
parent e889ac42dc
commit d63e36cd99
4 changed files with 8 additions and 10 deletions

View File

@@ -136,7 +136,7 @@
<dependency>
<groupId>ai.djl.tensorflow</groupId>
<artifactId>tensorflow-native-cpu</artifactId>
<classifier>win-x86_64</classifier>
<classifier>${djl.platform.windows-x86_64}</classifier>
<scope>runtime</scope>
<version>2.16.1</version>
</dependency>
@@ -144,7 +144,7 @@
<dependency>
<groupId>ai.djl.mxnet</groupId>
<artifactId>mxnet-native-mkl</artifactId>
<classifier>win-x86_64</classifier>
<classifier>${djl.platform.windows-x86_64}</classifier>
<scope>runtime</scope>
<version>1.9.1</version>
</dependency>
@@ -179,6 +179,7 @@
<classifier>${javacv.platform.linux-x86_64}</classifier>
</dependency>
<!--PyTorch离线平台依赖-->
<dependency>
<groupId>ai.djl.pytorch</groupId>
<artifactId>pytorch-native-cpu</artifactId>
@@ -190,14 +191,14 @@
<dependency>
<groupId>ai.djl.tensorflow</groupId>
<artifactId>tensorflow-native-cpu</artifactId>
<classifier>linux-x86_64</classifier>
<classifier>${djl.platform.linux-x86_64}</classifier>
<scope>runtime</scope>
<version>2.16.1</version>
</dependency>
<dependency>
<groupId>ai.djl.mxnet</groupId>
<artifactId>mxnet-native-mkl</artifactId>
<classifier>linux-x86_64</classifier>
<classifier>${djl.platform.linux-x86_64}</classifier>
<scope>runtime</scope>
<version>1.9.1</version>
</dependency>

View File

@@ -78,7 +78,7 @@ public class InstanceSegDemo {
Image image = SmartImageFactory.getInstance().fromFile(Paths.get("src/main/resources/dog_bike_car.jpg"));
R<DetectionResponse> result = detectorModel.detect(image);
if(result.isSuccess()){
log.info("实例分割结果:{}", result.getData());
log.info("实例分割结果:{}", JSONObject.toJSONString(result.getData()));
}else{
log.info("实例分割失败:{}", result.getMessage());
}

View File

@@ -41,14 +41,12 @@ public class PoseDetDemo {
* 获取姿态估计模型
* 注意事项:
* 1、更多模型请查看文档http://doc.smartjavaai.cn
* 2、模型可检测物体请查看模型同目录文件synset.txt
*/
public PoseModel getModel(){
PoseModelConfig config = new PoseModelConfig();
//姿态估计模型切换模型需要同时修改modelEnum及modelPath
config.setModelEnum(PoseModelEnum.YOLOV8N_POSE_PT);
//模型所在路径synset.txt也需要放在同目录下
config.setModelPath("/Users/wenjie/Documents/develop/model/vision/pose/yolo11n-pose-onnx/yolo11n-pose.onnx");
config.setModelEnum(PoseModelEnum.YOLO11N_POSE_PT);
config.setModelPath("/Users/wenjie/Documents/develop/model/vision/pose/yolo11n-pose-pt");
config.setDevice(device);
//置信度阈值
config.setThreshold(0.25f);

View File

@@ -53,7 +53,6 @@ public class SemSegDemo {
config.setModelPath("/Users/wenjie/Documents/develop/model/vision/semseg/deeplabv3/deeplabv3.pt");
// 指定允许的类别
// config.setAllowedClasses(Arrays.asList("person","car"));
//指定返回检测数量
config.setDevice(device);
return SemSegModelFactory.getInstance().getModel(config);
}