Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Java] [Python] I don't know why the output is different even though they are the same input(float32) and onnx model. #23335

Open
shihaim opened this issue Jan 13, 2025 · 4 comments
Labels
api:Java issues related to the Java API

Comments

@shihaim
Copy link

shihaim commented Jan 13, 2025

Describe the issue

Hi!
It's really important. please help..

[common]
location : shape(1, 1000, 4)
confidence : shape(1, 1000, 2)
landmarks : shape(1, 1000, 10)

limited the system output to five.

[java]
Image
version : 11+
onnxruntime version : 1.14.0

explicit SessionOptions

private void setOnnxOpts(OrtSession.SessionOptions opts) throws OrtException {
	opts.addCPU(true);

	opts.setMemoryPatternOptimization(true);

	opts.disableProfiling();

	opts.setExecutionMode(OrtSession.SessionOptions.ExecutionMode.SEQUENTIAL);

	opts.setOptimizationLevel(OrtSession.SessionOptions.OptLevel.ALL_OPT);

	opts.setInterOpNumThreads(0);

	opts.setIntraOpNumThreads(0);

	opts.setOptimizedModelFilePath("");
	
	opts.addConfigEntry("session.use_ort_model_bytes_directly", "1");
}

[python]
Image
version : 3.7.9
onnxruntime version : 1.14.0

explicit SessionOptions

def set_onnx_opts(self, opts):
	opts.enable_cpu_mem_arena = True

	opts.enable_mem_pattern = True
	
	opts.enable_profiling = False

	opts.execution_mode = onnxruntime.ExecutionMode.ORT_SEQUENTIAL

	opts.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL

	opts.inter_op_num_threads = 0

	opts.intra_op_num_threads = 0

	opts.optimized_model_filepath = ""


	opts.use_deterministic_compute = False

	opts.add_session_config_entry("session.use_ort_model_bytes_directly", "1")

	return opts

To reproduce

n/a

Urgency

No response

Platform

Windows

OS Version

11

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

1.14.0

ONNX Runtime API

Java

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response

@github-actions github-actions bot added the api:Java issues related to the Java API label Jan 13, 2025
@yuslepukhin
Copy link
Member

Your version is really old, we do not even build it here. Your best chance is to try the latest. Any fixes that may come would be in the latest version.

@Craigacp
Copy link
Contributor

Ensuring consistent image processing between Java & Python can be tricky, you need to make sure the channels order lines up, that the Java buffer is prepared correctly, and that you're parsing the output right. The output looks like the parsing is ok, so I'd look into the image processing side in Java.

@shihaim
Copy link
Author

shihaim commented Jan 14, 2025

@yuslepukhin
Of course as you said the old version, but I confirmed that the output (output with the same value) did not change at all when I ran it with the latest version.

[build.gradle.kts]
Image

[Java Output]
Image

@shihaim
Copy link
Author

shihaim commented Jan 14, 2025

@Craigacp
Thank you..!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:Java issues related to the Java API
Projects
None yet
Development

No branches or pull requests

3 participants