-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
23 lines (18 loc) · 739 Bytes
/
Main.java
File metadata and controls
23 lines (18 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package dev.troyer.sam;
import ai.onnxruntime.OrtException;
import java.io.IOException;
import java.nio.file.Path;
public class Main {
public static void main(String[] args) throws IOException, OrtException {
SamPredictor predictor = new SamPredictor(
Path.of("./src/main/resources/data/vit_b/encoder-vit_b.quant.onnx"),
Path.of("./src/main/resources/data/vit_b/decoder-vit_b.quant.onnx")
);
predictor.setImageFromPath(
Path.of("./test/assets/mingjun-liu-mVWqCdTHfxs-unsplash.jpg")
);
final SamResult result = predictor.predict(new SamConstraint[]{
new SamConstraint(1980, 1200, ConstraintType.FOREGROUND)
});
}
}