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_api] [coco_detection_android_demo] Updating build.gradle to build libraries in Linux for android deployment #927

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ public class MainActivity extends CameraActivity implements CvCameraViewListener
public static final float CONFIDENCE_THRESHOLD = 0.6F;
public static final float NMS_THRESHOLD = 0.6F;
public static final String OPENCV_LIBRARY_NAME = "opencv_java4";
public static final String MODEL_XML = "ssd_mobilenet_v2_coco.xml";
public static final String MODEL_XML = "ssd_mobilenet_v1_coco.xml";
likholat marked this conversation as resolved.
Show resolved Hide resolved
public static final String COCO_LABELS = "labels.txt";
public static final String MODEL_BIN = "ssd_mobilenet_v2_coco.bin";
public static final String MODEL_BIN = "ssd_mobilenet_v1_coco.bin";
public static final String DEVICE_NAME = "CPU";
public static String[] COCO_CLASSES_91;

Expand Down
16 changes: 10 additions & 6 deletions modules/java_api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
import org.gradle.internal.os.OperatingSystem

println 'Operating system: ' + OperatingSystem.current()
def arch = System.getProperty("os.arch")
def arch = System.getenv('CURRENT_ANDROID_PLATFORM_TYPE') ?: "arm-v8"
def ov_arch = arch;
println 'CPU architecture: ' + arch

Expand All @@ -14,7 +14,7 @@ def nativesCPP;
def openvinoVersion = "2024.2"

def native_resources = []
def tbb_dir = System.getenv('TBB_DIR')
def tbb_dir = System.getenv('TBB_DIR') ?: "/openvino-android/one-tbb-install/lib/cmake/TBB"
IndraTheZeus marked this conversation as resolved.
Show resolved Hide resolved
if (tbb_dir) {
if (new File(tbb_dir + "/../lib/").exists()) {
native_resources.add(tbb_dir + "/../lib/");
Expand All @@ -34,15 +34,18 @@ if (arch == "x86_64" || arch == "amd64" || arch == "x64" || arch == "x86-64") {
ov_arch = "armhf";
}

def openVinoDir = System.getenv('INTEL_OPENVINO_DIR') ?: "/openvino-android/openvino_install"
IndraTheZeus marked this conversation as resolved.
Show resolved Hide resolved
println ">>> INTEL_OPENVINO_DIR -> ${openVinoDir}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add logging or remove simple print messages in demos


if (OperatingSystem.current().isMacOsX()) {
nativesCPP = 'macosx-'
native_resources.add(System.getenv('INTEL_OPENVINO_DIR') + "/runtime/lib/" + ov_arch + "/Release");
native_resources.add(openVinoDir + "/runtime/lib/" + ov_arch + "/Release");
} else if (OperatingSystem.current().isLinux()) {
nativesCPP = 'linux-'
native_resources.add(System.getenv('INTEL_OPENVINO_DIR') + "/runtime/lib/" + ov_arch);
native_resources.add(openVinoDir + "/runtime/lib/" + ov_arch);
} else if (OperatingSystem.current().isWindows()) {
nativesCPP = 'windows-'
native_resources.add(System.getenv('INTEL_OPENVINO_DIR') + "/runtime/bin/" + ov_arch + "/Release");
native_resources.add(openVinoDir + "/runtime/bin/" + ov_arch + "/Release");
} else {
logger.warn('Unknown operating system!')
}
Expand All @@ -58,6 +61,7 @@ native_resources.each {
tree.visit { FileVisitDetails details ->
if (!details.file.isDirectory()) {
resources_list += details.file.name + "\n"
println ">>> Adding ${details.file.name} to native_resources"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sames sa with logging

}
}
}
Expand Down Expand Up @@ -91,4 +95,4 @@ test {
systemProperty 'MODELS_PATH', System.getProperty('MODELS_PATH')
systemProperty 'device', System.getProperty('device')
}
test.onlyIf { project.hasProperty('run_tests') }
test.onlyIf { project.hasProperty('run_tests') }
Loading