deepjavalibrary / deepjavalibrary/djl
I was using djl version 0.25, if I upgrade to version 0.32, do I need to change the method?
- Dominant language
- Java
- Stars
- 4.9k
- Forks
- 759
- Avg merge
- 16h 15m
- Merged PRs (30d)
- 15
Description
this is my POM
```
ai.djl
api
${djl.version}
ai.djl.pytorch
pytorch-engine
${djl.version}
ai.djl.pytorch
pytorch-native-cpu
win-x86_64
2.0.1
runtime
ai.djl.pytorch
pytorch-model-zoo
${djl.version}
```
This is my code
```
public void init() {
try {
String modelPath = Paths.get(modelBasePath, "fire.torchscript.pt").toString();
String synsetPath = Paths.get(modelBasePath, "fire.txt").toString();
logger.info("正在加载模型,路径: {}", modelPath);
File modelFile = new File(modelPath);
if (!modelFile.exists()) {
throw new RuntimeException("模型文件不存在: " + modelPath);
}
Translator translator = YoloV5Translator.builder()
.addTransform(new Resize(640, 480))
.addTransform(new ToTensor())
.optSynsetArtifactName(synsetPath)
.build();
Criteria criteria = Criteria.builder()
.setTypes(Image.class, DetectedObjects.class)
.optModelPath(Paths.get(modelPath))
.optTranslator(translator)
.build();
model = ModelZoo.loadModel(criteria);
logger.info("模型加载成功");
} catch (Exception e) {
logger.error("无法初始化对象检测服务: {}", e.getMessage(), e);
throw new RuntimeException("Failed to initialize object detection service", e);
}
}
public DetectedObjects detectObjects(Image image) throws Exception {
try (Predictor predictor = model.newPredictor()) {
return predictor.predict(image);
}
}
```
I'm using windows, my cuda version is 12.4, and I see that the documentation supports gpu acceleration, what should I do?
It's not clear enough for me to view the document
```
ai.djl.pytorch
pytorch-native-cu124
win-x86_64
2.4.0
runtime
ai.djl.pytorch
pytorch-jni
2.4.0-0.30.0
runtime
```
Contributor guide
Assessment
This issue has not been assessed yet.