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

[Good First Issue]: [JAVA API] Async demo for Java API 2.0 #834

Open
2 tasks
likholat opened this issue Jan 17, 2024 · 22 comments
Open
2 tasks

[Good First Issue]: [JAVA API] Async demo for Java API 2.0 #834

likholat opened this issue Jan 17, 2024 · 22 comments
Labels
category: java API OpenVINO Runtime Java API good first issue Good for newcomers

Comments

@likholat
Copy link
Contributor

Context

OpenVINO Runtime supports inference in either synchronous or asynchronous mode. The key advantage of the Async API is that when a device is busy with inference, the application can perform other tasks in parallel (for example, populating inputs or scheduling other requests) rather than wait for the current inference to complete first.

What needs to be done?

We had async inference support and async demo for Java API 1.0 before, now the async mode should be supported for OV Java API 2.0.

It's necessary to:

  • Add Face Detection Async Java Sample for OV API 2.0 based on the deprecated sample and Async Mode.
  • If needed, implement missing Java bindings of C++ methods required for OV asynchronous demo via the Java Native Interface (JNI). Such methods as start_async() and wait() have already been added for Java API, but you will probably find more unsupported OV Java methods while developing demo.

Here is an example of OV Java method implementation for infer() method of InferRequest class:
Java part of implementation:

// openvino_contrib/blob/master/modules/java_api/src/main/java/org/intel/openvino/InferRequest.java

package org.intel.openvino;

public class InferRequest extends Wrapper {
    ...

    public void infer() {
        Infer(nativeObj);
    }

    private static native void Infer(long addr);
}

CPP part of method implementation:

//openvino_contrib/blob/master/modules/java_api/src/main/cpp/openvino_java.hpp

...
JNIEXPORT void JNICALL Java_org_intel_openvino_InferRequest_Infer(JNIEnv *, jobject, jlong);
// openvino_contrib/blob/master/modules/java_api/src/main/cpp/infer_request.cpp

#include <jni.h>
#include "openvino/openvino.hpp"
#include "openvino_java.hpp"
#include "jni_common.hpp"

using namespace ov;
JNIEXPORT void JNICALL Java_org_intel_openvino_InferRequest_Infer(JNIEnv *env, jobject obj, jlong addr)
{
    JNI_METHOD("Infer",
        InferRequest *infer_request = (InferRequest *)addr;
        infer_request->infer();)
}
...

Example Pull Requests

[JAVA_API][GSOC] Add Java API bindings

Resources

Contact points

@likholat

Ticket

No response

@likholat likholat added good first issue Good for newcomers category: java API OpenVINO Runtime Java API labels Jan 17, 2024
@AishaniPandey
Copy link

.take

@AishaniPandey
Copy link

Hello. I wish to take this issue in preparation for GSoc 2024

@AishaniPandey
Copy link

.take

@AishaniPandey
Copy link

@likholat could you kindly add me as an assignee for this issue.
Thanks :)

@AishaniPandey
Copy link

Implementation Plan for Asynchronous Java Sample in OpenVINO Java API 2.0

Subject: Accelerated Implementation of Async Java Sample for OpenVINO Java API 2.0

Introduction
This plan aims to implement a Face Detection Asynchronous Java Sample for OpenVINO Java API 2.0 within a tight timeline. The focus is on integrating necessary Java bindings and developing a robust async demo.

Timezone and Availability
My timezone is CET (GMT+1). I can dedicate 3 hours daily to this project.

Objective
To create an asynchronous Java sample for the OpenVINO Java API 2.0, ensuring compatibility and efficiency, and to add any missing Java bindings for C++ methods via JNI.

Expedited Implementation Steps and Timeline

Initial Setup and Analysis (Day 1)

  • Set up the development environment.
  • Review existing async demos and understand the upgrades in Java API 2.0.

Development of Java Bindings (Day 2-3)

  • Implement Java bindings for essential C++ methods (like start_async, wait).
  • Test bindings for functionality and compatibility.

Asynchronous Java Sample Development (Day 4-5)

  • Develop the core structure of the Face Detection Async Java Sample.
  • Integrate and test the new Java bindings within the sample.

Sample Refinement and Testing (Day 6)

  • Optimize the sample for performance and adherence to coding standards.
  • Conduct comprehensive testing to ensure proper functionality.

Documentation, Review, and Pull Request (Day 7)

  • Update documentation to reflect new features and instructions.
  • Finalize the sample and prepare for submission.
  • Create and submit a pull request with a detailed implementation summary.

Buffer Period (Day 8-10)

  • Use this time to address feedback, make adjustments, or conduct additional testing if needed.

Conclusion
This condensed plan aims for the swift and efficient integration of an asynchronous Java sample in the OpenVINO Java API 2.0. I'm committed to maintaining quality and functionality within this expedited timeframe.

Please feel free to reach out for any clarifications or discussions regarding this plan.

Best regards,
Aishani Pandey
pandeyaishani@gmail.com

@likholat
Copy link
Contributor Author

likholat commented Jan 22, 2024

Hi @AishaniPandey, thank you for the detailed integration plan, it looks good to me!
Please note that this issue can't be a GSoc project, but can be done as a preparation step for this program.

@likholat
Copy link
Contributor Author

likholat commented Feb 2, 2024

Hi @AishaniPandey, do you have any update on this task?
Please let me know if you have questions, you can also create a draft PR to discuss.

@AishaniPandey
Copy link

Hi likholat,

I was occupied with college midterm assessments from the past few days and I missed your message.

I will be back on track with an updated plan within next few days.

@HarshG1308
Copy link

Hello Likholat,

I could resolve this issue.

@likholat
Copy link
Contributor Author

Hi @AishaniPandey, please let me know your progress on this issue. I'll assign it to @HarshG1308 if you don't have enough time to resolve the issue

@AishaniPandey
Copy link

AishaniPandey commented Feb 15, 2024 via email

@likholat likholat assigned HarshG1308 and unassigned AishaniPandey Feb 15, 2024
@likholat
Copy link
Contributor Author

@AishaniPandey thank you for the reply. Get well!
@HarshG1308 assigned this issue to you

@HarshG1308
Copy link

HarshG1308 commented Feb 27, 2024

Unfortunately, I won't be able to work on this at the moment as I am currently swamped with another project. Thank you for understanding."

@likholat
Copy link
Contributor Author

Unfortunately, I won't be able to work on this at the moment as I am currently swamped with another project. Thank you for understanding."

Thank you for the reply!

@MonalSD
Copy link

MonalSD commented Mar 1, 2024

.take

@MonalSD MonalSD removed their assignment Mar 10, 2024
@Pranshu-S
Copy link

.take

Copy link

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

@likholat
Copy link
Contributor Author

Hello @Pranshu-S, thanks for your interest!
Do you have an update on this task? Please let me know if you have any questions. You can also create a draft PR to discuss.

@Pranshu-S
Copy link

Hi @likholat
Thanks for reaching out. I have gotten the gist of what is to be done on the issue. I'll raise a draft PR by tomorrow and follow up with testings.

Thanks!

@p-wysocki
Copy link
Contributor

Hello @Pranshu-S, are you still working on this?

@SerenityCodes
Copy link

.take

Copy link

Thank you for looking into this issue! Please let us know if you have any questions or require any help.

@SerenityCodes SerenityCodes removed their assignment Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: java API OpenVINO Runtime Java API good first issue Good for newcomers
Projects
Status: Contributors Needed
Development

No branches or pull requests

7 participants