public class YoloInference {
public static void main(String[] args) {
String modelPath = "D:/yolov10/yolov10n.pt";
String streamPath = "rtmp://192.168.200.201:1935/live/hahaha";
runPythonScript(modelPath, streamPath);
}
public static void runPythonScript(String modelPath, String streamPath) {
try {
// Command to execute the Python script
String[] command = new String[] {
"C:/Users/Administrator/anaconda3/envs/yolov10/python.exe",
"D:/yolov10/tests/yolo_inference.py", // Replace with the actual path to your Python script
modelPath,
streamPath
};
// Start the process
ProcessBuilder processBuilder = new ProcessBuilder(command);
processBuilder.redirectErrorStream(true);
Process process = proce