Skip to content

Commit e563f5b

Browse files
geekwenjiegitee-org
authored andcommitted
!6 优化vision demo
Merge pull request !6 from 邓武杰/dev
2 parents e889ac4 + d63e36c commit e563f5b

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

examples/vision-example/pom.xml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,15 @@
136136
<dependency>
137137
<groupId>ai.djl.tensorflow</groupId>
138138
<artifactId>tensorflow-native-cpu</artifactId>
139-
<classifier>win-x86_64</classifier>
139+
<classifier>${djl.platform.windows-x86_64}</classifier>
140140
<scope>runtime</scope>
141141
<version>2.16.1</version>
142142
</dependency>
143143

144144
<dependency>
145145
<groupId>ai.djl.mxnet</groupId>
146146
<artifactId>mxnet-native-mkl</artifactId>
147-
<classifier>win-x86_64</classifier>
147+
<classifier>${djl.platform.windows-x86_64}</classifier>
148148
<scope>runtime</scope>
149149
<version>1.9.1</version>
150150
</dependency>
@@ -179,6 +179,7 @@
179179
<classifier>${javacv.platform.linux-x86_64}</classifier>
180180
</dependency>
181181

182+
<!--PyTorch离线平台依赖-->
182183
<dependency>
183184
<groupId>ai.djl.pytorch</groupId>
184185
<artifactId>pytorch-native-cpu</artifactId>
@@ -190,14 +191,14 @@
190191
<dependency>
191192
<groupId>ai.djl.tensorflow</groupId>
192193
<artifactId>tensorflow-native-cpu</artifactId>
193-
<classifier>linux-x86_64</classifier>
194+
<classifier>${djl.platform.linux-x86_64}</classifier>
194195
<scope>runtime</scope>
195196
<version>2.16.1</version>
196197
</dependency>
197198
<dependency>
198199
<groupId>ai.djl.mxnet</groupId>
199200
<artifactId>mxnet-native-mkl</artifactId>
200-
<classifier>linux-x86_64</classifier>
201+
<classifier>${djl.platform.linux-x86_64}</classifier>
201202
<scope>runtime</scope>
202203
<version>1.9.1</version>
203204
</dependency>

examples/vision-example/src/main/java/smartai/examples/vision/InstanceSegDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void instanceSegmentation(){
7878
Image image = SmartImageFactory.getInstance().fromFile(Paths.get("src/main/resources/dog_bike_car.jpg"));
7979
R<DetectionResponse> result = detectorModel.detect(image);
8080
if(result.isSuccess()){
81-
log.info("实例分割结果:{}", result.getData());
81+
log.info("实例分割结果:{}", JSONObject.toJSONString(result.getData()));
8282
}else{
8383
log.info("实例分割失败:{}", result.getMessage());
8484
}

examples/vision-example/src/main/java/smartai/examples/vision/PoseDetDemo.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ public static void beforeAll() throws IOException {
4141
* 获取姿态估计模型
4242
* 注意事项:
4343
* 1、更多模型请查看文档:http://doc.smartjavaai.cn
44-
* 2、模型可检测物体请查看:模型同目录文件synset.txt
4544
*/
4645
public PoseModel getModel(){
4746
PoseModelConfig config = new PoseModelConfig();
4847
//姿态估计模型,切换模型需要同时修改modelEnum及modelPath
49-
config.setModelEnum(PoseModelEnum.YOLOV8N_POSE_PT);
50-
//模型所在路径,synset.txt也需要放在同目录下
51-
config.setModelPath("/Users/wenjie/Documents/develop/model/vision/pose/yolo11n-pose-onnx/yolo11n-pose.onnx");
48+
config.setModelEnum(PoseModelEnum.YOLO11N_POSE_PT);
49+
config.setModelPath("/Users/wenjie/Documents/develop/model/vision/pose/yolo11n-pose-pt");
5250
config.setDevice(device);
5351
//置信度阈值
5452
config.setThreshold(0.25f);

examples/vision-example/src/main/java/smartai/examples/vision/SemSegDemo.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ public SemSegModel getModel(){
5353
config.setModelPath("/Users/wenjie/Documents/develop/model/vision/semseg/deeplabv3/deeplabv3.pt");
5454
// 指定允许的类别
5555
// config.setAllowedClasses(Arrays.asList("person","car"));
56-
//指定返回检测数量
5756
config.setDevice(device);
5857
return SemSegModelFactory.getInstance().getModel(config);
5958
}

0 commit comments

Comments
 (0)