platform/core/api/machine-learning.git
2 years ago[Package] Change package dependency.
gichan [Wed, 6 Apr 2022 05:15:29 +0000 (14:15 +0900)]
[Package] Change package dependency.

Previously, the single and pipeline API were separated.
Change the pipeline package contain the single package.

Signed-off-by: gichan <gichan2.jang@samsung.com>
2 years ago[C-API/Service] Apply Singleton pattern
Sangjung Woo [Mon, 4 Apr 2022 03:27:01 +0000 (12:27 +0900)]
[C-API/Service] Apply Singleton pattern

This patch applies the singleton pattern to MLServiceLevelDB class
so that a single instance exists in runtime.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/Service] Refactoring the service API for maintainability and readability
Sangjung Woo [Mon, 28 Mar 2022 02:39:25 +0000 (11:39 +0900)]
[C-API/Service] Refactoring the service API for maintainability and readability

To support various database systems, this patch defines the interface
class IMLServiceDB and implements MLServiceLevelDB using LevelDB. If the
backend DB is changed, we just add a new class for the new DB without
changing the existing code. That increases the maintainability.
Moreover, this patch updates the signature of user-level APIs to
increase readability.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/TEST] Add various test cases for ML Service API
Sangjung Woo [Mon, 28 Mar 2022 07:27:30 +0000 (16:27 +0900)]
[C-API/TEST] Add various test cases for ML Service API

This patch newly adds the test cases for ML Service APIs. They include
the positive and negative cases for setting, getting, and deleting the
pipeline description.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API] Add Error code for DB and filesystem
Sangjung Woo [Mon, 28 Mar 2022 02:17:51 +0000 (11:17 +0900)]
[C-API] Add Error code for DB and filesystem

This patch newly adds the ML_ERROR_IO_ERROR code for the failure
of DB and filesystem operation.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[Package] Bugfix for package dependency
Sangjung Woo [Thu, 31 Mar 2022 12:05:44 +0000 (21:05 +0900)]
[Package] Bugfix for package dependency

To maintain backward compatibility, capi-machine-learning-inference
package should require pipeline, single and common libraries. However,
common is omitted and it can cause break issues when making platform
:1image. This patch fixes this bug.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/Serivce] Update the doxygen tag
Sangjung Woo [Wed, 16 Mar 2022 02:21:37 +0000 (11:21 +0900)]
[C-API/Serivce] Update the doxygen tag

This patch updates the doxygen tag and comments for ML Service API.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/Serivce] Set SYS_DB_DIR as build configuration
Sangjung Woo [Tue, 15 Mar 2022 13:22:57 +0000 (22:22 +0900)]
[C-API/Serivce] Set SYS_DB_DIR as build configuration

This patch sets the SYS_DB_DIR as build configuration. In the case
of Tizen, a predefined DB path (i.e. TZ_SYS_GLOBALUSER_DB) is used.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/Service] Add testcase for ML Service API
Sangjung Woo [Tue, 8 Mar 2022 03:24:28 +0000 (12:24 +0900)]
[C-API/Service] Add testcase for ML Service API

This patch adds the basic testcase of the ML Service API for adding
and getting the pipeline description with the name.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/Service] implement ML Service API
Sangjung Woo [Tue, 8 Mar 2022 03:13:18 +0000 (12:13 +0900)]
[C-API/Service] implement ML Service API

This patch newly adds the ML Service APIs for adding and getting the
pipeline description with the name. To store the pipeline description,
leveldb is used.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C-API/Service] Fix the compile-time error
Sangjung Woo [Tue, 8 Mar 2022 01:53:27 +0000 (10:53 +0900)]
[C-API/Service] Fix the compile-time error

Because of an omitted semicolon and header file, there is a compile-time error
when using ml-api-service.h header. This patch fixes this bug.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[debian] Rename invalid .install file names
gichan [Fri, 25 Mar 2022 05:12:50 +0000 (14:12 +0900)]
[debian] Rename invalid .install file names

Rename invalid .install file names.
...-dev-api.install -> ..-api-dev.install

Signed-off-by: gichan <gichan2.jang@samsung.com>
2 years ago[debian] Separate debian packaging
gichan [Wed, 23 Mar 2022 07:47:41 +0000 (16:47 +0900)]
[debian] Separate debian packaging

 - Separate single/pipeline debian package
 - Change library name (capi-nnstreamer-* -> ml-inference-*)

Signed-off-by: gichan <gichan2.jang@samsung.com>
2 years ago[C/inference] Apply Substitute Algorithm instead of Switch-Case statement
Sangjung Woo [Fri, 11 Mar 2022 12:18:51 +0000 (21:18 +0900)]
[C/inference] Apply Substitute Algorithm instead of Switch-Case statement

This patch does refactoring the code by applying the Substitute
Algorithm technique. Instead of a Switch-Case statement, a hash table is
used and it increases both readability and performance.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C/inference] Refactoring the nested-if statement
Sangjung Woo [Thu, 10 Mar 2022 11:32:24 +0000 (20:32 +0900)]
[C/inference] Refactoring the nested-if statement

A nested if statement makes it hard to understand and maintain the code.
This patch reorganizes the code structure and increases readability.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[C/inference] Apply extract method for type converting
Sangjung Woo [Thu, 10 Mar 2022 10:35:56 +0000 (19:35 +0900)]
[C/inference] Apply extract method for type converting

Instead of a complicated switch-case statement in the function, this
patch extracts a new function for type converting. Since the enumeration
of both types is the same order, typecasting is good enough for
converting.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[meson] change global link -> project link
Jihoon Lee [Sat, 12 Mar 2022 05:35:19 +0000 (14:35 +0900)]
[meson] change global link -> project link

As recommended from a review in #137, add_global_link_argument has
changed to add_project_link_argument

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
2 years ago[Debian] update ml-inference-api-dev package
Jihoon Lee [Fri, 11 Mar 2022 02:39:13 +0000 (11:39 +0900)]
[Debian] update ml-inference-api-dev package

After #131, ml-inference-api-dev is relying on capi-ml-inference-single
and capi-ml-inference-pipeline pc.

It might have been better that ml-inference-api-dev relying on
ml-inference-single/pipeline-dev. As the package is not introduced,
this patch add pc files into the ml-inference-api-dev package.

See also: https://github.com/nnstreamer/nntrainer/issues/1853#issuecomment-1064220362

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
2 years agoFix libcapi-nnstremer is empty due to linker optimization
Jihoon Lee [Tue, 8 Mar 2022 14:26:52 +0000 (23:26 +0900)]
Fix libcapi-nnstremer is empty due to linker optimization

From #131, libcapi-nnstreamer.so became empty because
libcapi-nnstreamer.so does not contain any symbol from
libcapi-nnstreamer-single, libcapi-nnstreamer-pipeline.so

This should be semantically resolvable by using 'link-whole' argument in
meson but it is not implemented for shared_library.

This patch address the issue by disabling `-bas-needed=false` in meson
and add -Wl,--as-needed to global linker argument.

https://github.com/mesonbuild/meson/issues/3046.

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
2 years ago[Log] log utils from nnstreamer
Jaeyun [Thu, 3 Mar 2022 08:23:05 +0000 (17:23 +0900)]
[Log] log utils from nnstreamer

The log util was separated from nnstreamer repo.
Remove unnecessary header and update log util.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
2 years ago[Package] Separate single-shot and pipeline API.
Gichan Jang [Mon, 24 Jan 2022 04:59:59 +0000 (13:59 +0900)]
[Package] Separate single-shot and pipeline API.

 - `machine-learning-inference` is separated to `machine-learning-inference-single` and `machine-learning-inference-pipeline`.
 - Separate internal header files.

Signed-off-by: gichan <gichan2.jang@samsung.com>
2 years ago[build] Build android api with gstreamer v1.20.0 accepted/tizen/unified/20220223.132524 submit/tizen/20220222.112350
Yongjoo Ahn [Fri, 11 Feb 2022 05:45:35 +0000 (14:45 +0900)]
[build] Build android api with gstreamer v1.20.0

- Assume that android builds are with gstreamer v1.20.0
- Remove the patch file which is no needed for the new version
- Modify the patch file for tracing

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[Tizen/TEST] Add gcov package
Gichan Jang [Wed, 26 Jan 2022 07:31:15 +0000 (16:31 +0900)]
[Tizen/TEST] Add gcov package

Add gcov package for tizen coverage auto measurement tool.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
2 years ago[C-Api/Test] condition to check allowed element
Jaeyun [Fri, 21 Jan 2022 05:11:11 +0000 (14:11 +0900)]
[C-Api/Test] condition to check allowed element

1. init gstreamer before starting the unittest.
2. check element restriction flag from config file.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
2 years ago[C-Api/CodeClean] internal struct for pipeline
Jaeyun [Fri, 21 Jan 2022 03:17:51 +0000 (12:17 +0900)]
[C-Api/CodeClean] internal struct for pipeline

Code clean, cleanup definition for internal data struct.

TODO: We now have a plan to separate single and pipeline source.
Then it is necessary to hide internal data struct for pipeline functions.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
2 years ago[C-Api/Util] util function to get gst element
Jaeyun [Fri, 21 Jan 2022 03:15:07 +0000 (12:15 +0900)]
[C-Api/Util] util function to get gst element

Add util function to get gst-element instance.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
2 years ago[TEST] Check restricted elements. accepted/tizen/unified/20220124.125228 submit/tizen/20220121.055425
Gichan Jang [Thu, 30 Dec 2021 02:22:17 +0000 (11:22 +0900)]
[TEST] Check restricted elements.

Check whether the restricted elements are properly handled or not.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
2 years agoC/Service: first prototypes of service API Phase 1
MyungJoo Ham [Wed, 3 Nov 2021 03:36:36 +0000 (12:36 +0900)]
C/Service: first prototypes of service API Phase 1

This is the start of designing https://github.com/nnstreamer/nnstreamer/issues/3473
Phase 1 and 2 APIs are declared.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years agoC/common: refactor data structure locations for service API
MyungJoo Ham [Wed, 17 Nov 2021 03:29:27 +0000 (12:29 +0900)]
C/common: refactor data structure locations for service API

A few definitions in pipeline/single APIs are used by service API.
Move such definitions to the common header.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years ago[C/inference] Use allowed_elements instead of restricted-elements
Sangjung Woo [Thu, 6 Jan 2022 10:31:46 +0000 (19:31 +0900)]
[C/inference] Use allowed_elements instead of restricted-elements

The name 'restricted-elements' of nnstreamer configuration is not
matched as its real operation. Because of this reason, its name is
renamed to 'allowed_elements'. This patch updates the related code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[TEST] Add replacing string test
gichan [Wed, 5 Jan 2022 07:19:21 +0000 (16:19 +0900)]
[TEST] Add replacing string test

Add replacing string test.
(Copied from nnstreamer/nnstreamer/tests/unitest_util.c)

Signed-off-by: gichan <gichan2.jang@samsung.com>
2 years ago[android/pytorch] Add pytorch v1.10.1 android support accepted/tizen/unified/20211222.230219 submit/tizen/20211221.100006
Yongjoo Ahn [Thu, 16 Dec 2021 11:29:42 +0000 (20:29 +0900)]
[android/pytorch] Add pytorch v1.10.1 android support

- Support pytorch v1.10.1 for android (only arm64)

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[android/tflite] Add tflite v2.7.0 support
Yongjoo Ahn [Wed, 15 Dec 2021 13:00:22 +0000 (22:00 +0900)]
[android/tflite] Add tflite v2.7.0 support

- Add tflite v2.7.0 support
- Set v2.7.0 as default version of tflite

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[CODEOWNERS] Fix codeowners syntex.
Gichan Jang [Thu, 16 Dec 2021 08:21:01 +0000 (17:21 +0900)]
[CODEOWNERS] Fix codeowners syntex.

The last matching pattern takes the most precedence.
Change orders.
Refer: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
2 years ago[Single] Fix coverity issues
Gichan Jang [Thu, 16 Dec 2021 06:16:00 +0000 (15:16 +0900)]
[Single] Fix coverity issues

 - Remove unrechable code.
 - Fix use after free.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
2 years agoC/single: elaborate invoke stream-pipe error.
MyungJoo Ham [Mon, 13 Dec 2021 07:51:39 +0000 (16:51 +0900)]
C/single: elaborate invoke stream-pipe error.

When the framework version does not match the given
model's requirement, STREAM_PIPE error may happen.
Because it appears that such cases are common,
add more explanation.

Related with https://github.com/nnstreamer/nnstreamer/issues/3603

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years ago[Single] Allow NULL value for some properties.
Gichan Jang [Thu, 9 Dec 2021 07:29:29 +0000 (16:29 +0900)]
[Single] Allow NULL value for some properties.

Allow to set NULL value for some properties such as custom, accelator
and the rest.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
2 years ago[TEST] Update the test case
Sangjung Woo [Mon, 13 Dec 2021 05:55:17 +0000 (14:55 +0900)]
[TEST] Update the test case

Both plugin_availability_fail_invalid_01_n and
plugin_availability_fail_invalid_02_n have the same test code. This
patch updates the parameter to test other case.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[CODEOWNER] Fix sourcecode path.
Gichan Jang [Fri, 10 Dec 2021 04:30:19 +0000 (13:30 +0900)]
[CODEOWNER] Fix sourcecode path.

Currently, the source code path of the CODEOWNER is set differently than we were intended.
For example, /c/* mathces files like `c/README.md`
but not further nested files like `c/src/ml-api-common.c`
To include nested files, fix source code path syntex.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
2 years agoC/common: override dlog infra with stderr for unit testing
MyungJoo Ham [Thu, 9 Dec 2021 05:36:16 +0000 (14:36 +0900)]
C/common: override dlog infra with stderr for unit testing

With unittesting, especially in GBS, dlog output is
not shown because dlog server is not running.

Replace it with stderr print in unittesting
for better readability in GBS.

This is similar with
https://github.com/nnstreamer/nnstreamer/pull/3571

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years agoC/Single: elaborate error messages.
MyungJoo Ham [Tue, 7 Dec 2021 02:43:33 +0000 (11:43 +0900)]
C/Single: elaborate error messages.

For the sake of app developers, let's elaborate error messages.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years ago[build/android] Add comments for nnfw and snpe makefiles about external libs
Yongjoo Ahn [Wed, 8 Dec 2021 07:27:10 +0000 (16:27 +0900)]
[build/android] Add comments for nnfw and snpe makefiles about external libs

- Add comments for how external libs should be configured.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[build/android] Fix Pytorch makefile to compatibile with tflite (xnnpack)
Yongjoo Ahn [Wed, 8 Dec 2021 06:48:54 +0000 (15:48 +0900)]
[build/android] Fix Pytorch makefile to compatibile with tflite (xnnpack)

- Exclude xnnpack and other prebuilt libs from `LOCAL_WHOLE_STATIC_LIBRARIES`
  to avoid link crash issue with tflite which also contains xnnpack and other common prebuilt libs

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[build/android] Add a comment in file `Android-nnstreamer-prebuilt.mk`
Yongjoo Ahn [Wed, 8 Dec 2021 06:47:36 +0000 (15:47 +0900)]
[build/android] Add a comment in file `Android-nnstreamer-prebuilt.mk`

- Add a comment for native developers.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years agoC/inference: more errors with elaborated messages.
MyungJoo Ham [Wed, 17 Nov 2021 08:58:34 +0000 (17:58 +0900)]
C/inference: more errors with elaborated messages.

Elaborate error and exception messages of pipeline API
and internal functions.
Use the new log/report infrastructure.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years agoC/common: update error reporting macros
MyungJoo Ham [Wed, 17 Nov 2021 08:58:02 +0000 (17:58 +0900)]
C/common: update error reporting macros

1. Error continue-report only if the op has returned a non-zero value.
2. Commonize formatting macro.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years ago[C-Api] Fix the omitted Requires section in capi-ml-inference.pc accepted/tizen/unified/20211129.035247 submit/tizen/20211126.064049
Sangjung Woo [Thu, 25 Nov 2021 11:43:09 +0000 (20:43 +0900)]
[C-Api] Fix the omitted Requires section in capi-ml-inference.pc

Because of the bug in the meson file, Requires section in
capi-ml-inference.pc is empty. It causes the compile-time error when
using ML APIs. This patch fixes this bug.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[fix/trivial] Fix unnecessary null check
Yongjoo Ahn [Mon, 22 Nov 2021 06:31:04 +0000 (15:31 +0900)]
[fix/trivial] Fix unnecessary null check

- Remove unnecessary null check

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[fix/trivial] Fix unreacable code
Yongjoo Ahn [Mon, 22 Nov 2021 06:17:07 +0000 (15:17 +0900)]
[fix/trivial] Fix unreacable code

- Remove unreachable code

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years agoC/Service: introduction of the new API set.
MyungJoo Ham [Wed, 3 Nov 2021 03:36:36 +0000 (12:36 +0900)]
C/Service: introduction of the new API set.

Declaration of what the "ML Service APIs" will provide.

This is the start of designing https://github.com/nnstreamer/nnstreamer/issues/3473

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years agoC-API/Common: more elaborated error reporting.
MyungJoo Ham [Tue, 26 Oct 2021 04:47:19 +0000 (13:47 +0900)]
C-API/Common: more elaborated error reporting.

As an example for other API implementations,
error messages of ml-api-common.c are elaborated
with the new error reporting infra.

Unit test cases will follow later.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years agoC-API/Common: macro for formatting error messages.
MyungJoo Ham [Tue, 26 Oct 2021 04:46:41 +0000 (13:46 +0900)]
C-API/Common: macro for formatting error messages.

New macros for error reporting infrastructure with some more info.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2 years ago[android/test] Add pipeline api test for mqtt elements
Yongjoo Ahn [Tue, 16 Nov 2021 00:54:01 +0000 (09:54 +0900)]
[android/test] Add pipeline api test for mqtt elements

- Add a test for mqtt elements. Because it needs running mqtt broker,
  it should be ignored at this moment.
- At least it is passed in configured environment (mqtt broker is
  installed in the android device and running locally)
- Add permisiion for internet in AndroidManifest.xml

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[android/mqtt] Add MQTT support
Yongjoo Ahn [Mon, 15 Nov 2021 09:55:23 +0000 (18:55 +0900)]
[android/mqtt] Add MQTT support

- Add MQTT support
- It requires paho.mqtt.c prebuilt lib

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
2 years ago[Build/CodeClean] std headers
Jaeyun [Tue, 16 Nov 2021 08:06:28 +0000 (17:06 +0900)]
[Build/CodeClean] std headers

Code clean, it is recommended to not use stddef for NDK build, use stdlib instead.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
2 years ago[Spec] Fix the typo in Requires section accepted/tizen/unified/20211116.130316 submit/tizen/20211116.063435
Sangjung Woo [Tue, 16 Nov 2021 05:56:02 +0000 (14:56 +0900)]
[Spec] Fix the typo in Requires section

This patch fixes the typo in Requires section.
* capi-machine-larning-common -> capi-machine-learning-common

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
2 years ago[Singleshot] Enhance dim inference for nntrainer submit/tizen/20211116.052326
Jihoon Lee [Mon, 15 Nov 2021 08:03:04 +0000 (17:03 +0900)]
[Singleshot] Enhance dim inference for nntrainer

There was a voc that `ml_single_open(&single, 'model.ini', NULL, NULL,
ML_NNFW_TYPE_NNTR_INF, ML_NNFW_HW_ANY);` should work, which is giving
NULL for the tensor_input info and tensor output info.

This was not feasible because the nntrainer inference filter is not
defining `getInputDim()`, `getOutputDim()` on purpose to make it able to
infer output dimension from input dimension in pipeline scenario.

This patch introduce the dimension inferencing mechanism for nntrainer
to make it coherent with the pipeline api.

Below rules apply when input_info or output_info is nullptr for
nntrainer.

1. After opening the framework, allow calling set_input_dim with input_info with
count==0 in case of nntrainer.
2. nntrainer checks if input_info->count==0, if true, nntrainer assums
it should be default dimension and set input/output dimension accordingly.

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
3 years agoC-API/Common: add _ prefix for internal functions.
MyungJoo Ham [Tue, 26 Oct 2021 04:16:55 +0000 (13:16 +0900)]
C-API/Common: add _ prefix for internal functions.

Add _ prefix for all internal functions
so that developers can distinguish external (API) functions
and internal functions easily.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoC-API/Common: add _ prefix to internal interface - log
MyungJoo Ham [Tue, 26 Oct 2021 01:49:56 +0000 (10:49 +0900)]
C-API/Common: add _ prefix to internal interface - log

Rename mlapi_log* --> _ml_log*

This is the first of adding _ prefix to internal interfaces series.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoC-API/Common: error reporting API implementation.
MyungJoo Ham [Mon, 25 Oct 2021 10:52:46 +0000 (19:52 +0900)]
C-API/Common: error reporting API implementation.

API implementation:
ml_error(), ml_strerror()

Internal interface for API implementation:
_ml_error_report()

TODO: apply _ prefix for all internal interfaces.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoC-API/Common: error reporting function skeleton.
MyungJoo Ham [Thu, 21 Oct 2021 08:21:03 +0000 (17:21 +0900)]
C-API/Common: error reporting function skeleton.

dlerror()-like function that can provide error descriptions and
strerror()-like function that provide general descriptions for error codes.

This is to review its format and behavior.
The contents and internal APIs for API implementation will
follow after this API is approved.

This addresses (starts addressing) https://github.com/nnstreamer/nnstreamer/issues/3528

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years ago[C/Inference] Refactoring C-API module relations.
MyungJoo Ham [Tue, 19 Oct 2021 09:54:21 +0000 (18:54 +0900)]
[C/Inference] Refactoring C-API module relations.

ML C-API interfaces and implementations are being refactored for better relations.

ml-common will be no longer depending on nnstreamer.

Then, in the future, nntrainer will be no longer depending on nnstreamer except for its nnstreamer-nntrainer subplugin.

1. Renamed headers and sources (except for Tizen Studio's files, which we need to tend later)
2. Refactored inter-file dependency and relations.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years ago[Headers] Fix missing include in ml-api-common
Jihoon Lee [Wed, 20 Oct 2021 04:59:31 +0000 (13:59 +0900)]
[Headers] Fix missing include in ml-api-common

As tensor data structure now being moved to ml-api-common.
`size_t` is now used in `int ml_tensors_info_get_tensor_size`.

Does including <stddef.h> here.

Please  refer to below error in http://nnstreamer.mooo.com/nntrainer/ci/repo-workers/pr-checker/1648-202110201315200.81315588951111-c03945380718edd44c6a19b56056dcf80a64636d/report/build_log_1648_android_error.txt

```
 error: unknown type name 'size_t'
int ml_tensors_info_get_tensor_size (ml_tensors_info_h info, int index, size_t *data_size);
```

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
3 years ago[Common] refactor headers to clean up dependency
MyungJoo Ham [Mon, 18 Oct 2021 10:03:40 +0000 (19:03 +0900)]
[Common] refactor headers to clean up dependency

Data handling APIs are used by ML.training as well as ML.inference.
Move such APIs to common header.

TODO: Move implementation to another .c file so that
we can refactor subpackage dependencies, too.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agoRelease of ML-API 1.8.0 accepted/tizen/6.5/unified/20211028.095631 accepted/tizen/unified/20211001.001315 submit/tizen/20210930.052115 submit/tizen_6.5/20211028.161801 tizen_6.5.m2_release
Gichan Jang [Fri, 24 Sep 2021 06:55:51 +0000 (15:55 +0900)]
Release of ML-API 1.8.0

 - Release of ML-API 1.8.0.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Single] Don't close single handle during invoke process
Gichan Jang [Fri, 24 Sep 2021 06:39:08 +0000 (15:39 +0900)]
[Single] Don't close single handle during invoke process

Don't close single handle during invoke process.
If single handle is released during invoke prcoess, an interpreter may
access invalid memory.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Coverage] Set coverage badge
Jihoon Lee [Thu, 16 Sep 2021 10:22:15 +0000 (19:22 +0900)]
[Coverage] Set coverage badge

This patch enables coverage badge. Behind the scene, daily coverage
check is enabled :)

**Self evaluation:**
1. Build test: [ ]Passed [ ]Failed [X]Skipped
2. Run test: [ ]Passed [ ]Failed [X]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
3 years ago[TEST] Add checking nnfw availability util accepted/tizen/unified/20210915.100116 submit/tizen/20210915.065224
gichan [Wed, 1 Sep 2021 10:05:50 +0000 (19:05 +0900)]
[TEST] Add checking nnfw availability util

Add checking nnfw availability util.

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years agoUnittest: data type consistency with nnstreamer/gstreamer
MyungJoo Ham [Fri, 6 Aug 2021 07:19:08 +0000 (16:19 +0900)]
Unittest: data type consistency with nnstreamer/gstreamer

There are type re-definitions in C ML-API, which
should inherit values from nnstreamer and gstreamer.
Add unittests that ensures the consistency.

Fixes https://github.com/nnstreamer/nnstreamer/issues/2587

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
3 years agonnfw_ver to 1.17.0
Chunseok Lee [Thu, 26 Aug 2021 08:06:25 +0000 (17:06 +0900)]
nnfw_ver to 1.17.0

nnfw(ONE) v1.17.0 is released. This will bump up nnfw version to 1.17.0

Signed-off-by: Chunseok Lee <chunseok.lee@samsung.com>
3 years ago[C-Api] function to check hw availability accepted/tizen/unified/20210826.123542 submit/tizen/20210826.061507
Jaeyun [Fri, 20 Aug 2021 06:35:39 +0000 (15:35 +0900)]
[C-Api] function to check hw availability

Add new function to check hw availability with custom option string.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Android/Build] remove release flag
Jaeyun [Wed, 18 Aug 2021 10:04:21 +0000 (19:04 +0900)]
[Android/Build] remove release flag

Remove release flag and related source.
Uploading library to jcenter is not available anymore.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-API] Change src-callback name
gichan [Tue, 17 Aug 2021 01:45:07 +0000 (10:45 +0900)]
[C-API] Change src-callback name

Change src-callback function name.
 - Names of callback function types should have the '_cb' suffix.
 - A modile providing callbacks called on events should support exactly one of two registration schemes.
   > single callback registration: {module}_set_{details}_cb

Signed-off-by: gichan <gichan2.jang@samsung.com>
3 years ago[Android/Build] dependency to glib
Jaeyun [Fri, 13 Aug 2021 10:12:05 +0000 (19:12 +0900)]
[Android/Build] dependency to glib

clearly denote dependency to glib in android build.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-API] Use ML_NNFW_TYPE_TRIX_ENGINE instead of ML_NNFW_TYPE_TRIx_ENGINE accepted/tizen/unified/20210810.135355 submit/tizen/20210809.021120
Sangjung Woo [Fri, 6 Aug 2021 06:51:40 +0000 (15:51 +0900)]
[C-API] Use ML_NNFW_TYPE_TRIX_ENGINE instead of ML_NNFW_TYPE_TRIx_ENGINE

According to the Tizen naming convention, the names of the entities must
be composed of upper case letters. This patch fixes this issue.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years ago[Test/C-Api] src-callback test submit/tizen/20210806.045403
Jaeyun [Wed, 4 Aug 2021 10:05:07 +0000 (19:05 +0900)]
[Test/C-Api] src-callback test

Add new testcases for src callback.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-API] Rename srnpu to trix-engine
Sangjung Woo [Wed, 4 Aug 2021 05:52:41 +0000 (14:52 +0900)]
[C-API] Rename srnpu to trix-engine

The patch updates the name 'srnpu' to 'trix-engine'.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years ago[Test] update flex-tensor caps
Jaeyun [Mon, 5 Jul 2021 10:11:24 +0000 (19:11 +0900)]
[Test] update flex-tensor caps

Update caps for flexible tensor, old mime type for flex-tensor is removed.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-Api] implement src callback
Jaeyun [Tue, 3 Aug 2021 03:26:46 +0000 (12:26 +0900)]
[C-Api] implement src callback

Implement new API - appsrc callbacks.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Android] Test SNAP with tensorflow lite model
Yongjoo Ahn [Mon, 2 Aug 2021 11:11:49 +0000 (20:11 +0900)]
[Android] Test SNAP with tensorflow lite model

- SNAP v3.0 supports tensorflow lite model.
- Add pipeline and singleshot test using it.

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[C-Api] framework priority from conf submit/tizen/20210723.070532
Jaeyun [Mon, 19 Jul 2021 06:51:21 +0000 (15:51 +0900)]
[C-Api] framework priority from conf

Load framework priority from nnstreamer conf file.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-Api] remove warning while checking framework
Jaeyun [Mon, 19 Jul 2021 05:05:49 +0000 (14:05 +0900)]
[C-Api] remove warning while checking framework

When checking fw with model files is failed, it returns null and this will print warning message even if this works properly.
Update macro to not print this message. (requested from VD)

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[TEST] Add tensor clone test
Gichan Jang [Tue, 13 Jul 2021 05:49:10 +0000 (14:49 +0900)]
[TEST] Add tensor clone test

 - Add tensor clone test

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[debian] Add jni debian package accepted/tizen/unified/20210702.133345 accepted/tizen/unified/20210714.014156 submit/tizen/20210702.044746 submit/tizen/20210713.072613
Gichan Jang [Wed, 30 Jun 2021 05:46:29 +0000 (14:46 +0900)]
[debian] Add jni debian package

Add jni wrapper debian package.

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[JNI] remove unnecessary feature in native
Jaeyun [Wed, 30 Jun 2021 07:58:19 +0000 (16:58 +0900)]
[JNI] remove unnecessary feature in native

We should call subplugin registration only on Android.
Remove unnecessary feature in native code.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-Api/Util] Add ML_NNFW_HW_NPU_SLSI case to converting function
Sangjung Woo [Tue, 29 Jun 2021 07:34:40 +0000 (16:34 +0900)]
[C-Api/Util] Add ML_NNFW_HW_NPU_SLSI case to converting function

To support VD product, this patch adds the ML_NNFW_HW_NPU_SLSI case
to ml_nnfw_to_accl_hw() function.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years ago[Build/Java] add script to build jar
Jaeyun [Thu, 24 Jun 2021 05:44:49 +0000 (14:44 +0900)]
[Build/Java] add script to build jar

Add new script to build java library.
To prevent build error, mark prefix in java files and change it while building the library.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Java] prepare ubuntu build
Jaeyun [Tue, 22 Jun 2021 10:42:07 +0000 (19:42 +0900)]
[Java] prepare ubuntu build

Prepare Java API on ubuntu, add feature for android and remove android annotation.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-Api] handle flexible tensor
Jaeyun [Fri, 23 Apr 2021 11:17:35 +0000 (20:17 +0900)]
[C-Api] handle flexible tensor

In flexible tensor stream, sink and src handle cannot set exact tensor info from pad caps.
To handle flex-tensor, ignore tensor info while configuring the element handle.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Android/Build] check target abi
Jaeyun [Wed, 23 Jun 2021 07:00:17 +0000 (16:00 +0900)]
[Android/Build] check target abi

Check target abi when build android library, and set dir name to get gstreamer prebuilt libs.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Java] build JNI wrapper
Jaeyun [Wed, 23 Jun 2021 06:11:24 +0000 (15:11 +0900)]
[Java] build JNI wrapper

Build JNI wrapper using meson.
The source for JNI wrapper is same with Android native code.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Api/TensorsData] hold tensors info in data handle
Jaeyun [Wed, 9 Jun 2021 05:11:53 +0000 (14:11 +0900)]
[Api/TensorsData] hold tensors info in data handle

Clone tensors-info handle and hold it in tensors-data handle.
Also, pass info handle to parse data object in Android native build.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[C-Api/Util] remove duplicated source
Jaeyun [Fri, 28 May 2021 07:29:40 +0000 (16:29 +0900)]
[C-Api/Util] remove duplicated source

Add private util function and remove duplicated source.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Android] min sdk version to 24
Jaeyun [Wed, 23 Jun 2021 05:20:03 +0000 (14:20 +0900)]
[Android] min sdk version to 24

For android release, set minimum sdk version to 24.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[Data] Unlock data and remove unreachable code
Gichan Jang [Wed, 23 Jun 2021 06:02:00 +0000 (15:02 +0900)]
[Data] Unlock data and remove unreachable code

 - Unlock data when policy neither ML_PIPELINE_BUF_POLICY_AUTO_FREE nor
ML_PIPELINE_BUF_POLICY_DO_NOT_FREE.
 - Remove unreachable code

Signed-off-by: Gichan Jang <gichan2.jang@samsung.com>
3 years ago[Android] nnfw feature
Jaeyun [Mon, 21 Jun 2021 10:47:29 +0000 (19:47 +0900)]
[Android] nnfw feature

Change nnfw feature definition in android build, same to c-api define.

Signed-off-by: Jaeyun <jy1210.jung@samsung.com>
3 years ago[android/build] Fix android build script for wget accepted/tizen/unified/20210621.123012 submit/tizen/20210621.072743
Yongjoo Ahn [Fri, 18 Jun 2021 07:59:10 +0000 (16:59 +0900)]
[android/build] Fix android build script for wget

- Fix wget urls to support git lfs files

Signed-off-by: Yongjoo Ahn <yongjoo1.ahn@samsung.com>
3 years ago[capi] Update on thread safety for ml_tensors_info
Parichay Kapoor [Mon, 14 Jun 2021 07:01:21 +0000 (16:01 +0900)]
[capi] Update on thread safety for ml_tensors_info

This patch fixes the case of Time of Check Time of Use bug in
ml_pipeline_custom_easy_filter_register().
The provided arguments `in` and `out` are first checked for validity
under their locks and then used for clone again under their locks.
However, between the two operations, both the variable are left lock
free, and the two variables can become invalid.
This patch adds the corresponding fix by adding support for
checking validity of ml_tensors_info_s lockfree which is done
under the lock acquired inside ml_tensors_info_clone().

Further, as a minor fix, redundant locking and unlocking
has been removed from ml_pipeline_custom_easy_filter_register().

See also #42 https://github.com/nnstreamer/api/pull/42#issuecomment-840265534
Resolves https://github.com/nnstreamer/nnstreamer/issues/2600

**Self evaluation:**
1. Build test: [x]Passed [ ]Failed [ ]Skipped
2. Run test: [x]Passed [ ]Failed [ ]Skipped

Signed-off-by: Parichay Kapoor <pk.kapoor@samsung.com>
3 years ago[C-API] Fix the coverity issue accepted/tizen/unified/20210611.144944 submit/tizen/20210611.070742
Sangjung Woo [Thu, 10 Jun 2021 08:16:07 +0000 (17:16 +0900)]
[C-API] Fix the coverity issue

This patch fixes the coverity issue: "waiting while holding a lock".
Before entering the loop, mutex lock is release so that other thread can
use the CPU.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
3 years agoThread safety for ml_tensors_data APIs
MyungJoo Ham [Tue, 11 May 2021 10:59:50 +0000 (19:59 +0900)]
Thread safety for ml_tensors_data APIs

Fixes #nnstreamer/2600
Note that locally created-and-freed ml-tensors-data
are not required to be protected.

Another fix: do not destroy user data even if it is AUTO_FREE
if push_buffer is NOT called.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>