mirror of
https://github.com/geekwenjie/SmartJavaAI.git
synced 2026-09-09 19:18:52 +00:00
优化vision demo
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user