Pawel Wasowski [Thu, 18 Feb 2021 10:09:04 +0000 (11:09 +0100)]
[ML][Pipeline] Implement {register, unregister}CustomFilter
ACR: TWDAPI-274
This is the first part of the implementation of nnstreamer's pipeline
CustomFilter Web API. It enables registering and unregistering
CustomFilters, but they don't process the data.
[Verification] Tested with the snippets below, works fine
var inputTI = new tizen.ml.TensorsInfo();
inputTI.addTensorInfo('ti1', 'UINT8', [4, 20, 15, 1]);
var outputTI = new tizen.ml.TensorsInfo();
outputTI.addTensorInfo('ti1', 'UINT8', [1200]);
var flattenPlusOne = function(input) {
console.log("Custom filter called with: ");
var outputTD = outputTI.getTensorsData();
var rawInputData = input.getTensorRawData(0);
for (var i = 0; i < rawInputData.data.size; ++i) {
rawInputData.data[i] = rawInputData.data[i] + 1;
}
outputTD.setTensorRawData(0, rawInputData.data);
return new tizen.ml.CustomFilterOutput(0, outputTD);
}
// register - the happy scenario
tizen.ml.pipeline.registerCustomFilter('testfilter2', flattenPlusOne, inputTI,
outputTI, function errorCallback(error) {
console.warn('custom filter error:') ; console.warn(error);
});
var pipeline_def = "videotestsrc num-buffers=3 "
+ "! video/x-raw,width=20,height=15,format=BGRA "
+ "! tensor_converter "
+ "! tensor_filter framework=custom-easy model=testfilter2 "
+ "! appsink name=mysink";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
state => {console.log(state);})
// READY
pipeline.start()
// unregister - the happy scenario
tizen.ml.pipeline.unregisterCustomFilter('testfilter2')
// overwrite a previously registered filter - that's ok
tizen.ml.pipeline.registerCustomFilter('testfilter2', flattenPlusOne, inputTI,
outputTI, function errorCallback(error) {
console.warn('custom filter error:') ; console.warn(error);
});
tizen.ml.pipeline.registerCustomFilter('testfilter2', flattenPlusOne, inputTI,
outputTI, function errorCallback(error) {
console.warn('custom filter error:') ; console.warn(error);
});
// unregister nonexistent filter
tizen.ml.pipeline.unregisterCustomFilter('nonexistentfilter')
// InvalidValuesError: ""nonexistentfilter" CustomFilter not found"
Change-Id: Ib01490e669376149eae654937131116f5ec1a4df
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Mon, 22 Feb 2021 12:23:48 +0000 (12:23 +0000)]
Merge "[ML][Common] Minor fixes" into tizen
[ML] Fixed SVACE issue - not initialized size_in_bytes
[SVACE] Issue 456940
Change-Id: Icc31326b1768939ed82dbd5efde76c156c5f9be9
Pawel Wasowski [Fri, 19 Feb 2021 01:29:00 +0000 (02:29 +0100)]
[ML][Common] Minor fixes
ACR: TWDAPI-273/TWDAPI-274
This commit adds 2 missing logs and replaces one variable name with a
proper one.
[Verification] Tested with below snippets, works as expected
// This snippets triggers the added log:
var pipeline_def = "videotestsrc num-buffers=3 ! videoconvert"
+ " ! tensor_converter ! tensor_sink name=sinkx";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
function(state) {console.log(state);});
// READY
// PAUSED
pipeline.registerSinkListener('sinkx', function(sinkName, data) {
console.log('SinkListener for "' + sinkName + '" sink called');
console.log(data);
})
pipeline.start()
// registered SinkListener is called 3 times
///////////////////////////////////////////////////////////
// This snippet no longer triggers the changed log:
var outputTI = new tizen.ml.TensorsInfo();
outputTI.addTensorInfo('ti1', 'UINT8', [1200]);
var outputTD = outputTI.getTensorsData();
outputTD.dispose()
///////////////////////////////////////////////////////////
// This snippet triggers the exception which message is now correct:
var outputTI = new tizen.ml.TensorsInfo();
outputTI.addTensorInfo('ti1', 'UINT8', [1200]);
var outputTD = outputTI.getTensorsData();
outputTD.setTensorRawData(0, 'invalid data');
Change-Id: Iec192971882b094cc93679f2104499568dc43777
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Thu, 18 Feb 2021 05:19:04 +0000 (05:19 +0000)]
Merge "[ML-API] Use capi-ml-inference package instead of capi-nnstreamer" into tizen
[ML] Added SingleShot openModelAsync() implementation
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-273
[Verification] Code compiles without errors.
Checked in chrome console with few calls:
// Success calls:
tizen.ml.single.openModelAsync("documents/mobilenet_v1_1.0_224_quant.tflite", (s) => console.log(s))
tizen.ml.single.openModelAsync("documents/mobilenet_v1_1.0_224_quant.tflite", (s) => console.log(s), null, null, null, "TENSORFLOW_LITE")
tizen.ml.single.openModelAsync("documents/mobilenet_v1_1.0_224_quant.tflite", (s) => console.log(s), null, null, null, "TENSORFLOW_LITE", "ANY", true)
// Fails for invalid or not-existing file:
tizen.ml.single.openModelAsync("documents/fail.tflite", (s) => console.log(s), (e) => console.log(e)) // Abort Error
tizen.ml.single.openModelAsync("documents/notexisting", (s) => console.log(s), (e) => console.log(e)) // NotFound
tizen.ml.single.openModelAsync("notexisting", (s) => console.log(s), (e) => console.log(e)) // NotFound
// ASYNC version verification //
// without storage privilege
tizen.ml.single.openModelAsync("notexistingfile", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // async NotFoundError
tizen.ml.single.openModelAsync("/dddd/notexistingfile", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // async NotFoundError
tizen.ml.single.openModelAsync("documents/notexistingfile", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // throws SecurityError
tizen.ml.single.openModelAsync("documents/mobilenet_v1_1.0_224_quant.tflite", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // throws SecurityError
// with storage privilege
tizen.ml.single.openModelAsync("notexistingfile", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // async NotFoundError
tizen.ml.single.openModelAsync("/dddd/notexistingfile", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // async NotFoundError
tizen.ml.single.openModelAsync("documents/notexistingfile", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // async NotFoundError
tizen.ml.single.openModelAsync("documents/mobilenet_v1_1.0_224_quant.tflite", (s) => console.log(s), (e) => console.log("Async: " + JSON.stringify(e))) // success
// SYNC version verification //
// without storage privilege
tizen.ml.single.openModel("notexistingfile") // throws NotFoundError
tizen.ml.single.openModel("/dddd/notexistingfile") // throws NotFoundError
tizen.ml.single.openModel("documents/notexistingfile") // throws SecurityError
tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite") // throws SecurityError
// with storage privilege
tizen.ml.single.openModel("notexistingfile") // throws NotFoundError
tizen.ml.single.openModel("/dddd/notexistingfile") // throws NotFoundError
tizen.ml.single.openModel("documents/notexistingfile") // throws NotFoundError
tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite") // success
Change-Id: I93e009efec4e1bcbe6d6c3b381b34cada910d8aa
Piotr Kosko [Wed, 17 Feb 2021 05:50:52 +0000 (05:50 +0000)]
Merge "[ML][single] SingleShot.setValue and SingleShot.getValue" into tizen
Sangjung Woo [Wed, 17 Feb 2021 04:43:31 +0000 (13:43 +0900)]
[ML-API] Use capi-ml-inference package instead of capi-nnstreamer
The name of capi-nnstreamer and its pc file is changed to
capi-ml-inference. To build without any errors, this patch updates its
related information.
Change-Id: I037cc1151461fbaacfd87fcf2175e32b65dd337e
Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Rafal Walczyna [Mon, 15 Feb 2021 14:02:14 +0000 (15:02 +0100)]
[ML][single] SingleShot.setValue and SingleShot.getValue
ACR: TWDAPI-273
Test code:
var m = tizen.ml.single.openModel('documents/mobilenet_v1_1.0_224_quant.tflite')
var arr = ["input", "inputtype", "inputlayout", "output", "outputtype", "outputlayout",
"accelerator", "is-updatable", "inputname", "outputname", "custom" ]
arr.forEach((v) => {
try {
console.log(v, ':', m.getValue(v));
} catch (error) {
console.log(v, ':', error.message)
}
});
m.setValue("input", "3:244:244:4");
console.log("input: " + m.getValue("input"))
m.setValue("is-updatable", "true");
console.log("is-updatable: " + m.getValue("is-updatable"))
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: Id911ed1717fb7b96c7ac75350ea27c78786cc5d9
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Pawel Wasowski [Tue, 2 Feb 2021 09:58:52 +0000 (10:58 +0100)]
[ML][common] Add synchronization of access to tensor info/data maps
ACR: TWDAPI-273/TWDAPI-274
Pipeline's SinkCallbacks and CustomFilters may be called from threads
other than the main thread. As they access members of
Tensors{Data, Info}Managers, the access to these members should be
synchronized to prevent 2 threads from modifying the same data
concurrently.
[Verification] Tested with code snippets used from other commits
implementing Tensors{Data, Info} or Pipeline - the snippets still work.
The snippets used for tests were found in commit messages of these changes:
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/251435
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/251699
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/251524
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/252001
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/252002
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/252289
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/252290
https://review.tizen.org/gerrit/c/platform/core/api/webapi-plugins/+/252482
Change-Id: I32f5df4ba92e86034c78d751e901c77a9d60ca4e
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Mon, 1 Feb 2021 14:01:13 +0000 (15:01 +0100)]
[ML][pipeline] Implement Pipeline::{register,unregister}SinkListener
ACR: TWDAPI-274
[Verification] Tested in Chrome DevTools with the snippets below. Works
fine
var pipeline_def = "videotestsrc num-buffers=3 ! videoconvert"
+ " ! tensor_converter ! tensor_sink name=sinkx";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
function(state) {console.log(state);});
// READY
// PAUSED
pipeline.registerSinkListener('sinkx', function(sinkName, data) {
console.log('SinkListener for "' + sinkName + '" sink called');
console.log(data);
})
pipeline.start()
// registered SinkListener is called 3 times
Change-Id: I8790327d070e54d27fd9cc028882773487a48d7a
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Fri, 12 Feb 2021 07:19:38 +0000 (07:19 +0000)]
Merge "[ML][Common] Add unit tests to TensorsData::GetTensorRawData" into tizen
Piotr Kosko [Fri, 12 Feb 2021 07:19:33 +0000 (07:19 +0000)]
Merge "[ML][Common] Add TensorsData.getTensorRawData location/size support" into tizen
Piotr Kosko [Fri, 12 Feb 2021 07:19:29 +0000 (07:19 +0000)]
Merge "[ML][Common] Add unit tests to TensorsData::SetTensorRawData" into tizen
Piotr Kosko [Fri, 12 Feb 2021 07:19:23 +0000 (07:19 +0000)]
Merge "[ML][Common] Add TensorsData.setTensorRawData location/size support" into tizen
Rafal Walczyna [Wed, 3 Feb 2021 14:48:06 +0000 (15:48 +0100)]
[ML][Common] Add unit tests to TensorsData::GetTensorRawData
[==========] 17 tests from 2 test suites ran. (120 ms total)
[ PASSED ] 17 tests.
[Verification] Built successful. Tested on TM1
Change-Id: Ia73add4cab4500de078ce45933ca68f952975e4e
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Mon, 1 Feb 2021 14:55:36 +0000 (15:55 +0100)]
[ML][Common] Add TensorsData.getTensorRawData location/size support
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor", "INT16", [3, 3])
var td = ti.getTensorsData();
td.setTensorRawData(0, [1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 0], [3, 3])
var data = td.getTensorRawData(0, [1, 1], [])
console.log(data)
console.log(data.data)
// Int16Array(4) [5, 6, 8, 9]
// 5, 6
// 8, 9
data = td.getTensorRawData(0, [0, 0], [3, 1])
console.log(data)
console.log(data.data)
// Int16Array(3) [1, 2, 3]
// 1, 2, 3
data = td.getTensorRawData(0, [2, 0], [1, 2])
console.log(data)
console.log(data.data)
// Int16Array(2) [3, 6]
// 3
// 6
data = td.getTensorRawData(0, [], [1, 1])
console.log(data)
console.log(data.data)
// Int16Array(1) [1]
data = td.getTensorRawData(0, [0, 1], [-1,1])
console.log(data)
console.log(data.data)
// Int16Array(1) [3] (4, 5, 6)
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: Ife781390e8806309bc72963f43a5d001bcd2f5c2
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Pawel Wasowski [Wed, 10 Feb 2021 09:20:12 +0000 (10:20 +0100)]
[ML] Fix issues found by SVACE
This commit fixes the following SVACE problems (WGIDs) in ML:
456856, 456857, 456858
[Verification] Code compiles. The changed code was tested with the
snippets below
// Source
var pipeline_input = tizen.ml.pipeline.createPipeline("appsrc name=srcx ! "
+ "other/tensor,dimension=(string)1:1:1:1,type=(string)int8,"
+"framerate=(fraction)0/1 ! tensor_sink name=sinkx")
var source_input = pipeline_input.getSource("srcx")
// Valve
var pipeline_def = "videotestsrc is-live=true ! videoconvert ! videoscale"
+ " ! video/x-raw,format=RGBx,width=16,height=16,framerate=10/1"
+ " ! tensor_converter ! valve name=valve1 ! fakesink";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
function(state) {console.log(state);});
// READY
// PAUSED
var v = pipeline.getValve('valve1')
// Valve {name: "valve1", _pipeline_id: 1}
// Switch
var pipeline_def = "videotestsrc is-live=true"
+ " ! videoconvert"
+ " ! tensor_converter"
+ " ! output-selector name=outs outs.src_0"
+ " ! tensor_sink name=sink0 async=false outs.src_1"
+ " ! tensor_sink name=sink1 async=false"
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def, function(state) {console.log(state);})
pipeline.getSwitch('outs')
// Switch {name: "outs", type: "OUTPUT_SELECTOR", _pipeline_id: 3}
Change-Id: I9316f6a9f6f225aaa741e25458b53109f7c17c16
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Rafal Walczyna [Tue, 2 Feb 2021 14:38:14 +0000 (15:38 +0100)]
[ML][Common] Add unit tests to TensorsData::SetTensorRawData
[==========] 10 tests from 1 test suite ran. (60 ms total)
[ PASSED ] 10 tests.
[Verification] Built successful. Tested on TM1.
Change-Id: I1b89508d28973e3b4ed7ae4a39eee88fb8685fbe
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Tue, 26 Jan 2021 12:46:17 +0000 (13:46 +0100)]
[ML][Common] Add TensorsData.setTensorRawData location/size support
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor", "INT16", [3, 3])
var td = ti.getTensorsData();
console.log(td.getTensorRawData(0).data)
// Int16Array(9) [0, 0, 0, 0, 0, 0, 0, 0, 0]
// 0 0 0
// 0 0 0
// 0 0 0
td.setTensorRawData(0, [1, 2, 3], [0, 2], [3, 1])
console.log(td.getTensorRawData(0).data)
// Int16Array(9) [0, 0, 0, 0, 0, 0, 1, 2, 3]
// 0 0 0
// 0 0 0
// 1 2 3
td.setTensorRawData(0, [4, 5, 6], [2, 0], [1, 3])
console.log(td.getTensorRawData(0).data)
// Int16Array(9) [0, 0, 4, 0, 0, 5, 1, 2, 6]
// 0 0 4
// 0 0 5
// 1 2 6
td.setTensorRawData(0, [9], [1, 1], [1, 1])
console.log(td.getTensorRawData(0).data)
// Int16Array(9) [0, 0, 4, 0, 9, 5, 1, 2, 6]
// 0 0 4
// 0 9 5
// 1 2 6
td.setTensorRawData(0, [-4,3,-7], [0, 2], [-1, 1])
console.log(td.getTensorRawData(0).data)
// Int16Array(9) [0, 0, 4, 0, 9, 5, -4, 3, -7]
// 0 0 4
// 0 9 5
// -4 3 -7
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: Ibc4ae4ddef35941678a765acd5a300cefa6671b0
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Pawel Wasowski [Wed, 10 Feb 2021 09:18:19 +0000 (10:18 +0100)]
[Notification] Fix SVACE issue
This commit fixes SVACE issue with WGID: 449860
[Verification] tct-notification-tizen-tests (auto): 100% pass rate
(The CommonNotification::SetAppControlInfoFrmJson function that was
changed, was called several times during tests)
Change-Id: If1caa5d141edb6c776a49ee9c2bfa5abc575efab
Piotr Kosko [Wed, 3 Feb 2021 09:14:15 +0000 (09:14 +0000)]
Merge "[ML][Pipeline] Input data" into tizen
Lukasz Bardeli [Fri, 29 Jan 2021 11:43:15 +0000 (12:43 +0100)]
[ML][Pipeline] Input data
ACR: TWDAPI-274
[Verification] Code compiles without error. Tested in chrome console.
var pipeline_input = tizen.ml.pipeline.createPipeline("appsrc name=srcx ! other/tensor,dimension=(string)1:1:1:1,type=(string)int8,framerate=(fraction)0/1 ! tensor_sink name=sinkx")
var source_input = pipeline_input.getSource("srcx")
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
var td = ti.getTensorsData();
console.log(td.count)
source_input.inputData(td)
tensor_input = source_input.inputTensorsInfo
td_input = tensor_input.getTensorsData()
tt = td_input.tensorsInfo
console.log(tt.getTensorName(0))
Change-Id: I4dd4c3cec5d77d36598551a5d3aa8d8a9fbc9b5a
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
Pawel Wasowski [Mon, 1 Feb 2021 14:01:02 +0000 (15:01 +0100)]
[ML][common] Add a method for cloning native tensors
ACR: TWDAPI-273/TWDAPI-274
This commit adds a method for cloning data and info from
ml_tensors_data_h and ml_tensors_info_h to TensorsData and related
TensorsInfo objects.
[Verification] Code compiles. Operation is verified in the next commit.
Change-Id: I0268e4d902b7f9a25b5ae531471cdf2028acd77b
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
[ML] Fixed logger type with macro
For some architectures int64_t is not casted to lld, for partablitiy
stackoverflow suggests using macro.
[Verification] Code compiles for aarch64 architecture
Change-Id: I7aaa3dabeacae6ea7b212c09c5070ff011c64ab1
Piotr Kosko [Mon, 1 Feb 2021 07:33:51 +0000 (07:33 +0000)]
Merge "[systeminfo] Prevent possible crash when failure initialization" into tizen
[systeminfo] Prevent possible crash when failure initialization
SVACE: 456450
[verification] Code compiles without errors
Change-Id: I0b2f0c0c8d27ff0cc6edf3099f7ec77a2d825c7c
Rafal Walczyna [Thu, 28 Jan 2021 16:35:08 +0000 (17:35 +0100)]
[ML][Common] Add TensorRawData and size/location validation on JS side
C++ validation will be added in future commit
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
ti.addTensorInfo("tensor2", "INT16", [2, 4])
ti.addTensorInfo("tensor3", "FLOAT32", [2, 2])
var td = ti.getTensorsData();
console.log(td.getTensorRawData(0))
console.log(td.getTensorRawData(1))
console.log(td.getTensorRawData(2))
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: I14caa9a91b04ed2664cca241da54977a711b1abd
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Mon, 25 Jan 2021 14:31:38 +0000 (15:31 +0100)]
[ML][Common] Add TensorsData.setTensorRawData method
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
var td = ti.getTensorsData();
console.log(td.getTensorRawData(0));
td.setTensorRawData(0, [13]);
console.log(td.getTensorRawData(0));
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: I522112df9a69f1a5ec7bbcbc12094296a11ec1c9
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Mon, 25 Jan 2021 14:51:40 +0000 (15:51 +0100)]
[ML][Common] Add TensorsData.getTensorRawData method
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
var types = ["INT8", "INT16", "INT32", "INT64", "UINT8", "UINT16",
"UINT32", "UINT64", "FLOAT32", "FLOAT64" ]
types.forEach((t) => {
ti.addTensorInfo("", t, [3, 3, 2]);
})
var td = ti.getTensorsData();
for(var i = 0; i < 10; i++) {
console.log(td.getTensorRawData(i));
}
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: Ia3772b7488d48a593f03dcd158ee66092633d886
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Pawel Wasowski [Thu, 21 Jan 2021 09:19:14 +0000 (10:19 +0100)]
[ML][pipeline] implement Valve::{setOpen, isOpen}
ACR: TWDAPI-274
[Verification] Tested in Chrome DevTools with the snippets below, works
fine.
var pipeline_def = "videotestsrc is-live=true ! videoconvert ! videoscale"
+ " ! video/x-raw,format=RGBx,width=16,height=16,framerate=10/1"
+ " ! tensor_converter ! valve name=valve1 ! fakesink";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
function(state) {console.log(state);});
// READY
// PAUSED
var v = pipeline.getValve('valve1')
// Valve {name: "valve1", _pipeline_id: 1}
v.isOpen
// true
pipeline.isOpen = false
v.isOpen
// true
v.setOpen(false)
v.isOpen
// false
Change-Id: Ibdeaba23082356b5143c2a1796bbd181b4d5d027
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Fri, 29 Jan 2021 07:42:50 +0000 (07:42 +0000)]
Merge "[ML][Pipeline] GetSource implementation" into tizen
[Common] Fixed invalid parsing of decimal values
[Bug] Decimal values fails to parse properly when locale of device
was e.g. Deutsch
[Verification]
//Below code works well for locales: English, Deutsch, Francais
// sound values are changing and show aproximately same values
// (depending on platform adjustments)
tizen.sound.setVolume("MEDIA", 0.1);
console.log(tizen.sound.getVolume("MEDIA"))
>> 0.13
Change-Id: Icde211bcfcc66cf0d66852816d2a00907adf4571
Lukasz Bardeli [Tue, 26 Jan 2021 12:56:06 +0000 (13:56 +0100)]
[ML][Pipeline] GetSource implementation
ACR: TWDAPI-274
[Verification] Code compiles without error. Tested in chrome console.
var pipeline = tizen.ml.pipeline.createPipeline("appsrc name=appsrc ! other/tensor,dimension=(string)4:1:1:1, type=(string)uint8,framerate=(fraction)0/1 ! tensor_if name=tif compared-value=CUSTOM compared-value-option=tif_custom_cb_name ")
var source = pipeline.getSource("appsrc")
var tensor = source.inputTensorsInfo
Change-Id: I3c09d2f91758c19e82ade9e6e5237ddc0a8ef76e
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
[ML][Single] Implemented SingleShot.input member - set
* added set feature for SingleShot.input
* added single gathering of SingleShot.input and output (wihout checking native layer every time)
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-273
[Verification] Code compiles without errors.
Checked in Chrome console:
var model = tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite")
model.input
> TensorsInfo {_previouslyConstructed: true, _id: 1}
var newTI = new tizen.ml.TensorsInfo()
newTI.addTensorInfo("input", "UINT8", [3,224,224,1])
model.input = newTI;
model.input
> TensorsInfo {_previouslyConstructed: true, _id: 2}
/// calling getter multiple times return always the same TensorsInfo
Change-Id: I16c33a0ba515aba1efe2f5d93d0d3225b410aced
Piotr Kosko [Tue, 26 Jan 2021 12:40:15 +0000 (12:40 +0000)]
Merge "[ML][Single] Implemented SingleShot.output member - get" into tizen
Piotr Kosko [Tue, 26 Jan 2021 08:12:03 +0000 (08:12 +0000)]
Merge changes I9997467b,Id480d20c into tizen
* changes:
[ML][Common] Add TensorsData.dispose method
[ML][Common] Add TensorsInfo.getTensorsData and TensorsData
Rafal Walczyna [Wed, 20 Jan 2021 13:19:15 +0000 (14:19 +0100)]
[ML][Common] Add TensorsData.dispose method
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
ti.addTensorInfo("tensor2", "UINT8", [2, 4])
var td = ti.getTensorsData();
console.log(td.count)
td.dispose();
console.log(td.count)
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: I9997467b36908d6e031473e58e2b3defbf253e00
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Wed, 20 Jan 2021 10:28:50 +0000 (11:28 +0100)]
[ML][Common] Add TensorsInfo.getTensorsData and TensorsData
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
ti.addTensorInfo("tensor2", "UINT8", [2, 4])
var td = ti.getTensorsData();
console.log(td.count)
Verification: Built successful. Tested in Chrome Dev console.
Change-Id: Id480d20c1a32d03113c6dbc73cbd81938a98931f
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Lukasz Bardeli [Wed, 20 Jan 2021 12:48:43 +0000 (13:48 +0100)]
[ML][Pipeline] Implementation setProperty and getProperty
ACR: TWDAPI-274
[Verification] Code compiles without error. Tested in chrome console.
// test code
var pipeline = tizen.ml.pipeline.createPipeline("videotestsrc name=vsrc is-live=true ! videoconvert ! videoscale name=vscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! input-selector name=is01 ! tensor_sink name=sinkx")
//BOOLEAN
var nodeinfo_bool = pipeline.getNodeInfo("is01")
nodeinfo_bool.setProperty("sync-streams", "BOOLEAN", true)
nodeinfo_bool.getProperty("sync-streams", "BOOLEAN")
nodeinfo_bool.setProperty("sync-streams", "BOOLEAN", false)
nodeinfo_bool.getProperty("sync-streams", "BOOLEAN")
//DOUBLE
var nodeinfo_double = pipeline.getNodeInfo("vscale")
nodeinfo_double.setProperty("sharpness", "DOUBLE", 0.72)
nodeinfo_double.getProperty("sharpness", "DOUBLE")
//INT32
var nodeinfo_int32 = pipeline.getNodeInfo("vsrc")
nodeinfo_int32.setProperty("kx", "INT32", 10)
nodeinfo_int32.getProperty("kx", "INT32")
//UINT32
var nodeinfo_uint32 = pipeline.getNodeInfo("vsrc")
nodeinfo_uint32.setProperty("foreground-color", "UINT32", 123456)
nodeinfo_uint32.getProperty("foreground-color", "UINT32")
//INT64
var nodeinfo_int64 = pipeline.getNodeInfo("vsrc")
nodeinfo_int64.setProperty("timestamp-offset", "INT64", 10)
nodeinfo_int64.getProperty("timestamp-offset", "INT64")
//UINT64
var pipeline_uint64 = tizen.ml.pipeline.createPipeline("udpsrc name=usrc port=5555 caps=application/x-rtp ! queue ! fakesink")
var nodeinfo_uint64 = pipeline_uint64.getNodeInfo("usrc")
nodeinfo_uint64.setProperty("timeout", "UINT64",
166513216516510)
nodeinfo_uint64.getProperty("timeout", "UINT64")
//STRING
var pipeline_string = tizen.ml.pipeline.createPipeline("videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink")
var nodeinfo_string = pipeline_string.getNodeInfo("demux")
nodeinfo_string.setProperty("tensorpick", "STRING", "1,2")
nodeinfo_string.getProperty("tensorpick", "STRING")
// ENUM
var vscale_enum = {
GST_VIDEO_SCALE_NEAREST:0,
GST_VIDEO_SCALE_BILINEAR:1,
GST_VIDEO_SCALE_4TAP:2,
GST_VIDEO_SCALE_LANCZOS:3
}
var pipeline_enum = tizen.ml.pipeline.createPipeline("videotestsrc name=vsrc is-live=true ! videoconvert ! videoscale name=vscale ! video/x-raw,format=RGBx,width=224,height=224,framerate=60/1 ! tensor_converter ! valve name=valvex ! input-selector name=is01 ! tensor_sink name=sinkx")
var nodeinfo_enum = pipeline_enum.getNodeInfo("vscale")
nodeinfo_enum.setProperty("method", "ENUM", vscale_enum.GST_VIDEO_SCALE_4TAP)
nodeinfo_enum.getProperty("method", "ENUM")
Change-Id: I90f9a3986beeb6a071ce4b265965eec399679c55
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
[ML][Single] Implemented SingleShot.output member - get
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-273
[Verification] Code compiles without errors.
Checked in Chrome console:
// open model
var model = tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite")
// below works well
model.input.getDimensions(0)
model.output.getDimensions(0)
Change-Id: I43120610873a455eb813bb02db9c3eeff7a02e91
[ML][Single] Implemented SingleShot.input member - get
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-273
[Verification] Code compiles without errors.
Checked in Chrome console:
// open model
var model = tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite")
// all implemented members of input work
model.input.getDimensions(0)
Change-Id: I132d5e6262f7142c8040c7f40f69f11a1ef63827
Piotr Kosko [Mon, 25 Jan 2021 10:10:06 +0000 (10:10 +0000)]
Merge "[ML][pipeline] Implement Pipeline::getValve()" into tizen
Piotr Kosko [Mon, 25 Jan 2021 10:05:57 +0000 (10:05 +0000)]
Merge "[ML][Single] Added manager file and implementation for openModel()" into tizen
[ML][Single] Added manager file and implementation for openModel()
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-273
[Verification] Code compiles without errors.
Checked in chrome console with few calls:
Success calls:
tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite")
tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite", null, null, "TENSORFLOW_LITE")
tizen.ml.single.openModel("documents/mobilenet_v1_1.0_224_quant.tflite", null, null, "TENSORFLOW_LITE", "ANY", true)
Fail for invalid or not-existing file:
tizen.ml.single.openModel("documents/fail.tflite") // Abort Error
tizen.ml.single.openModel("documents/notexisting") // NotFound
tizen.ml.single.openModel("notexisting") // NotFound
Change-Id: I8b2b89e60d8f265185d3ddcafcc224f4e5c15fa1
Piotr Kosko [Fri, 22 Jan 2021 13:19:01 +0000 (13:19 +0000)]
Merge "[ML][pipeline] Implement Switch::{getPadList, select}" into tizen
Pawel Wasowski [Wed, 20 Jan 2021 15:49:03 +0000 (16:49 +0100)]
[ML][pipeline] Implement Pipeline::getValve()
ACR: TWDAPI-274
[Verification] Tested in Chrome DevTools with the below snippets, works
fine.
var pipeline_def = "videotestsrc is-live=true ! videoconvert ! videoscale"
+ " ! video/x-raw,format=RGBx,width=16,height=16,framerate=10/1"
+ " ! tensor_converter ! valve name=valve1 ! fakesink";
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
function(state) {console.log(state);});
pipeline.getValve('valve1')
// alve {name: "valve1", _pipeline_id: 1}
pipeline.getValve('valve_XXX')
// WebAPIException {code: 0, name: "InvalidValuesError", ...
pipeline.getValve()
// WebAPIException {code: 0, name: "InvalidValuesError", ...
Change-Id: Id11414f80c42a9879532dfc1c651f766c4f12834
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Thu, 21 Jan 2021 09:34:58 +0000 (09:34 +0000)]
Merge "[ML][Common] Add support for creating TensorsInfo from native handle" into tizen
[Common] Moved convertUriToPath to common::tools
convertingUriToPath is used in few modules and usage of one version
of this function will be beneficial.
[Verification] TCT exif, package, metadata 100% pass.
Change-Id: Ifbca0fa3a83de0757faa30b214e4b298c4678789
Rafal Walczyna [Wed, 20 Jan 2021 11:49:15 +0000 (12:49 +0100)]
[ML][Common] Add support for creating TensorsInfo from native handle
ACR: TWDAPI-273
Some of the ml native functions require not initialized handle.
TensorsInfo::CreateTensorsInfo() uses ml_tensors_info_create which allocates
memory for tensors info - but i.e. ml_single_get_input_info allocates memory
again without freeing old handle.
[Verification] Builts successfully, TensorsInfo.count tested in Chrome dev console.
Change-Id: I6b2e9c60dbed23a2d1962e68cc9408a8faecb383
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
[ML] Added placeholders for further development
[Verification] Code compiles without errors
Change-Id: I2b69891c596e31ae87fb519b60aa3811e949c5d5
Pawel Wasowski [Tue, 19 Jan 2021 01:36:44 +0000 (02:36 +0100)]
[Datacontrol] Prevent crashes by purging code with undefined behavior
The following line caused crashes:
IdMap[info->requestId] = info.release();
Argument evaluation order was not strictly defined in C++
before C++17 - behavior of the expression above was undefined.
C++17 introduced more strict rules and their implementation in GCC
caused a crash after setting -std=c++17 - it seems, that info.release()
would be now called before info->requestId.
[Verification] tct-datacontrol-tizen-tests (auto, c++14 and c++17 build):
100% pass rate
The snippet below crashed apps 100% times when webapi-plugins were
compiled with C++17. Now, the snippet works fine
var PROVIDER_ID =
"http://tizen.org/datacontrol/provider/DictionaryDataControlProvider";
var DATA_ID = "Dictionary";
var TYPE_SQL = "SQL";
var TYPE_MAP = "MAP";
var globalDataControl = tizen.datacontrol.getDataControlConsumer(PROVIDER_ID,
DATA_ID,
TYPE_MAP);
function successcb(id) {
console.log("Ok: reqid " + id);
}
function errorcb(id, error) {
console.log("Error id: " + id + ", error msg: " + error.message);
}
try {
globalDataControl.addValue(123, "tizen", "Foo", successcb, errorcb);
}
catch (err)
{
console.log(err.name + ": " + err.message);
}
Change-Id: Ibd80f60d100a616b8a9607c27e9eebf8a64e7a10
Pawel Wasowski [Mon, 18 Jan 2021 21:11:55 +0000 (22:11 +0100)]
[mediacontroller] Prevent undefined behavior
Constructing a std::string from nullptr is undefined behavior and
caused an exception after setting std=c++17 flag in GCC
(no exception was thrown when compiling with std=c++14).
This commit removes the UB.
The problem caused MediaControllerServerInfo_iconURI_attribute test
from tct-mediacontroller-tizen-tests failures.
[Verification] auto tct-mediacontroller-tizen-tests
1. with std=c++14: 100% pass rate
2. with std=c++17: 100% pass rate
Change-Id: I4857e3d9f8ba2940b50223e89ff952625ba37b3c
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Mon, 18 Jan 2021 19:35:14 +0000 (20:35 +0100)]
[common] Add std::exception handler to ParsedInstance
When an exception derived from std::exception and not PlatformException
is thrown in webapi-plugins code, only the following error message was
logged:
HandleException(393) > Exception: Unknown exception
As std::exception inheritance is a very common practice, especially in
standard library, we add logging std::exception::what() message to make
debugging easier.
[Verification] An exception thrown from std::string is caught and its
what() message is logged properly.
Change-Id: I879ebe80b609cf26a7e68be822a783aa9ef145eb
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Rafal Walczyna [Mon, 18 Jan 2021 14:19:54 +0000 (15:19 +0100)]
[ML][Common] Add TensorsInfo.getTensorSize
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
console.log(ti.getTensorSize(0))
ti.addTensorInfo("tensor2", "UINT8", [2, 3, 4])
console.log(ti.getTensorSize(1))
ti.addTensorInfo("tensor2", "FLOAT32", [2, 3, 4])
console.log(ti.getTensorSize(2))
console.log(ti.getTensorSize(-1))
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: I841da30d03a0590cea66ec6217130163a87f59ec
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Fri, 15 Jan 2021 11:56:20 +0000 (12:56 +0100)]
[ML][Common] Add TensorsInfo.dispose method
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
ti.getTensorName(0)
ti.dispose()
ti.getTensorName(0)
[Verification] Built successful. Tested in Chrome Dev console.
Change-Id: Icae3447ea266de67404f05e23a5d157e5f899ee9
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Thu, 14 Jan 2021 12:13:12 +0000 (13:13 +0100)]
[ML][Common] Add TensorsInfo.clone and TensorsInfo.equals
ACR: TWDAPI-273
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
var ti2 = ti.clone();
console.log(ti.equals(ti2))
ti2.setTensorName(0, "different")
console.log(ti.equals(ti2))
ti2.setTensorType(0, "INT8")
console.log(ti.equals(ti2))
[Verification] Built successful, tested in Chrome Dev console.
Change-Id: I30d9b1b73ab97735b6ecfaf1a408b6561912808d
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Wed, 13 Jan 2021 12:52:21 +0000 (13:52 +0100)]
[ML][Common] Add TensorsInfo getters / setters
ACR: TWDAPI-273
Methods added:
TensorsInfo.getTensorName
TensorsInfo.setTensorName
TensorsInfo.getTensorType
TensorsInfo.setTensorType
TensorsInfo.getDimensions
TensorsInfo.setDimensions
Test code:
var ti = new tizen.ml.TensorsInfo();
ti.addTensorInfo("tensor1", "UINT8", [1, 1])
console.log(ti.getTensorName(0));
ti.setTensorName(0, "changedName");
console.log(ti.getTensorName(0));
console.log(ti.getTensorType(0));
ti.setTensorType(0, "INT8");
console.log(ti.getTensorType(0));
console.log(ti.getDimensions(0));
ti.setDimensions(0, [2,4]);
console.log(ti.getDimensions(0));
[Verification] Built successful, tested in Chrome Dev console.
Change-Id: I197072bfbc48812fd44a00cfaceb09ee8928f1a1
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Fri, 8 Jan 2021 15:40:47 +0000 (16:40 +0100)]
[ML][Common] Add TensorsInfo constructor and TensorsInfo::addTensorInfo
ACR: TWDAPI-273
Added:
- TensorsInfo constructor
- TensorsInfo::addTensorInfo method
- TensorsInfo::count property
Test code:
var ti = new tizen.ml.TensorsInfo();
console.log(ti.count)
ti.addTensorInfo(null, "UINT8", [1, 1])
console.log(ti.count)
console.log(JSON.stringify(ti))
[Verification] Built successful, tested in Chrome Dev console
Change-Id: Ic194d71439e4c4ce30b9722de031e9312c1c8183
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Fri, 8 Jan 2021 15:39:37 +0000 (16:39 +0100)]
[ML][Common] Add MLTensorsInfoManager
ACR: TWDAPI-273
[Verification] Built successful
Change-Id: I85a0fdcbcbc42ddcce406d5c6ae5a428536d4ce7
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Pawel Wasowski [Tue, 12 Jan 2021 17:03:25 +0000 (18:03 +0100)]
[ML][pipeline] Implement Switch::{getPadList, select}
ACR: TWDAPI-274
[Verification] Tested in Chrome DevTools with the snippets below, works
fine.
var pipeline_def = "videotestsrc is-live=true"
+ " ! videoconvert"
+ " ! tensor_converter"
+ " ! output-selector name=outs outs.src_0"
+ " ! tensor_sink name=sink0 async=false outs.src_1"
+ " ! tensor_sink name=sink1 async=false"
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def,
function(state) {console.log(state);});
pipeline.getSwitch('outs').getPadList()
// ["src_0", "src_1"]
pipeline.getSwitch('outs').select('src_1')
// dlog: I/nnstreamer( 4274): Switched to [src_1] successfully at switch [outs].
pipeline.getSwitch('outs').select('src_3')
// WebAPIException: InvalidValuesError
pipeline.getSwitch('outs').select()
// WebAPIException: InvalidValuesError
Change-Id: I992e17841a8f8bec19aa60383e9d3ad0baf62975
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Tue, 12 Jan 2021 15:38:43 +0000 (16:38 +0100)]
[ML][pipeline] Implement Pipeline::getSwitch()
ACR: TWDAPI-274
[Verification] Code tested in Chrome DevTools with below snippets works
fine
var pipeline_def = "videotestsrc is-live=true"
+ " ! videoconvert"
+ " ! tensor_converter"
+ " ! output-selector name=outs outs.src_0"
+ " ! tensor_sink name=sink0 async=false outs.src_1"
+ " ! tensor_sink name=sink1 async=false"
var pipeline = tizen.ml.pipeline.createPipeline(pipeline_def, function(state) {console.log(state);})
pipeline.getSwitch('outs')
// Switch {name: "outs", type: "OUTPUT_SELECTOR", _pipeline_id: 3}
pipeline.getSwitch('non existent switch')
// VM31:1 Uncaught WebAPIException {code: 0, name: "InvalidValuesError"
Change-Id: Ia7d6838b5e49072c35f0b796151c436d4a3b60e1
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Tue, 19 Jan 2021 06:16:30 +0000 (06:16 +0000)]
Merge "[ML][common] Add tizen.ml.checkNNFWAvailability method" into tizen
Lukasz Bardeli [Tue, 12 Jan 2021 09:24:45 +0000 (10:24 +0100)]
[ML][Pipeline] Implement getNodeInfo
ACR: TWDAPI-274
[Verification] Code compiles without error. Tested in chrome console
var pipeline = tizen.ml.pipeline.createPipeline("videotestsrc ! video/x-raw,format=RGB,width=640,height=480 ! videorate max-rate=1 ! tensor_converter ! tensor_mux ! tensor_demux name=demux ! tensor_sink")
var nodeinfo = pipeline.getNodeInfo("demux")
Change-Id: I503f0a2a52b151ac676a64e2ad888f45abc51170
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
Lukasz Bardeli [Mon, 11 Jan 2021 07:29:29 +0000 (08:29 +0100)]
[ML][Pipeline] Implement Start and Stop method.
ACR: TWDAPI-274
[Verification] Code compiles without error.
var pipeline = tizen.ml.pipeline.createPipeline("videotestsrc! tizenwlsink");
pipeline.start()
// pipeline.state = "PLAYING"
pipeline.stop()
// pipeline.state = "PAUSED"
Change-Id: I529c47fd349741d3e11b0b57e265d3a9a930f652
Signed-off-by: Lukasz Bardeli <l.bardeli@samsung.com>
Rafal Walczyna [Wed, 23 Dec 2020 07:54:06 +0000 (08:54 +0100)]
[ML][common] Add tizen.ml.checkNNFWAvailability method
ACR: TWDAPI-273
Test code:
var HWType = ["ANY", "AUTO", "CPU", "CPU_NEON", "CPU_SIMD", "GPU", "NPU",
"NPU_EDGE_TPU", "NPU_MOVIDIUS", "NPU_SR", "NPU_VIVANTE"];
var NNFWType = ["ANY", "ARM_NN", "CUSTOM_FILTER", "EDGE_TPU", "MVNC", "NNFW", "OPEN_VINO",
"SNPE", "TENSORFLOW", "TENSORFLOW_LITE", "VIVANTE"];
HWType.forEach(hw => {
NNFWType.forEach(nnfw => {
console.log(nnfw + ", " + hw + ": " + tizen.ml.checkNNFWAvailability(nnfw, hw))
});
});
[Verificaion] Tested in Google Chrome Dev Console
Change-Id: I2ac7752f410a70e98d8c0cd387ac5dfcabdbef88
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Pawel Wasowski [Mon, 18 Jan 2021 13:01:19 +0000 (14:01 +0100)]
[ML][pipeline] Prepare room for a bugfix
Native handles to all pipeline elements (switches, node infos, etc.)
have to be released BEFORE Pipeline::pipeline_ handle.
Pipeline::Dispose() will release them in proper order and from now on
will be called from ~Pipeline() to not repeat the error prone release
logic.
[Verification] Code tested with below snippets in Chrome DevTools works
fine.
var pipeline = tizen.ml.pipeline.createPipeline('videotestsrc ! tizenwlsink',
function(state) {console.log(state);})
// test screen appears
pipeline.dispose() // no errors, test screen disappear;
// DLOG message about successful disposal
<press F5> // no crash; DLOG message tells that pipeline_ has been destroyed
Change-Id: Ibe8b1260bc7bf057fed375ac579b87fce59d8caf
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Tue, 5 Jan 2021 21:47:17 +0000 (22:47 +0100)]
[ML][pipeline] Implement Pipeline::dispose()
ACR: TWDAPI-274
[Verification] Tested in Chrome DevTools with the snippet below, works
fine.
var pipeline = tizen.ml.pipeline.createPipeline('videotestsrc ! tizenwlsink',
function(state) {console.log(state);})
// test screen appears
pipeline.dispose() // no errors, test screen disappears
Change-Id: I5401c3210f73619d5577380abf17139fadc390f1
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Mon, 4 Jan 2021 09:59:39 +0000 (10:59 +0100)]
[ML][pipeline] Implement Pipeline::state getter
ACR: TWDAPI-274
[Verification] Tested in Chrome DevTools with the snippets below. Works fine
var pipeline = tizen.ml.pipeline.createPipeline('videotestsrc ! tizenwlsink',
function(state) {console.log(state);})
<wait a few seconds>
pipeline.state
Change-Id: Iae5e70c63d5c9fd98877defe0949024516c8c41d
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Thu, 24 Dec 2020 10:36:26 +0000 (11:36 +0100)]
[ML][Pipeline] Add Pipeline and PipelineManager
ACR: TWDAPI-274
[Verification] createPipeline() tested in Chrome
DevTools with the snippet below works fine
var pipeline = tizen.ml.pipeline.createPipeline(
'videoteststrc ! tizenwlsink',
function(state) {
console.log(state);
})
//a moment later:
// READY
// PAUSED
tizen.ml.createPipeline()
// WebAPIException: InvalidValuesError
Change-Id: I68beaebf7e248b61bba9dc06ce6124c187c45fae
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Fri, 8 Jan 2021 11:06:03 +0000 (12:06 +0100)]
[ML][pipeline] Add placeholders for implementation
ACR: TWDAPI-274
This commit adds placeholders for implementation of PipelineManager and
Pipeline to avoid merge conflicts of changes done by different
committers.
[Verification] Code compiles
Change-Id: Id4a2b33943e390526929bb5c2dba42cd55d7ad12
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Piotr Kosko [Fri, 8 Jan 2021 10:38:08 +0000 (10:38 +0000)]
Merge "[Download][TDAF-1353] Exception fix for 'start' function" into tizen
Arkadiusz Pietraszek [Thu, 7 Jan 2021 19:32:28 +0000 (20:32 +0100)]
[Download][TDAF-1353] Exception fix for 'start' function
`start` function was returning unknown error exception instead of
unsupported error in case when networkType in DownloadRequest wasn't
supported by the device.
Additionally fix enables null values to be used (in accordance with the documentation).
[Verification] Code builds without errors. TCT suites deprecated, download and systeminfo pass rate: 100%.
Tested in developer console on devices with telephony set to true and false.
Below code was used with all network types, as well as invalid values.
```
var downloadRequest = new tizen.DownloadRequest(
"http://download.tizen.org/tct/2_1/webapi-tizen-download-test-image-lq.png",
null, null, "CELLULAR", null);
tizen.download.start(downloadRequest);
```
Change-Id: I4f2866a07019f129c852024970783b110ef11abc
Signed-off-by: Arkadiusz Pietraszek <a.pietraszek@samsung.com>
Rafal Walczyna [Tue, 5 Jan 2021 13:27:05 +0000 (14:27 +0100)]
[Common] Moved helper functions to decode/encode strings/binary to common
[Verification] Built successfully. Metadata and filesystem auto tct 100%.
Change-Id: I751e5cad95f8c7dc907214225f8f27cabbb3e5e7
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Piotr Kosko [Tue, 5 Jan 2021 10:56:42 +0000 (10:56 +0000)]
Merge "[ML][utils] Add native error to PlatformResult converter" into tizen
Piotr Kosko [Tue, 5 Jan 2021 10:56:32 +0000 (10:56 +0000)]
Merge "[ML][pipeline] Add files structure" into tizen
Piotr Kosko [Tue, 5 Jan 2021 10:56:07 +0000 (10:56 +0000)]
Merge "[ML] Add files structure" into tizen
Merge branch 'tizen_6.0' into tizen
Change-Id: I8134cac10af7ba5439eecba63db59fb6ea97496f
Merge commit 'tizen_5.5' into tizen_6.0
Change-Id: I7d175b5f87cdcbc8a2d701dc5228a6f4b98a92a8
Merge branch 'tizen_5.0' into tizen_5.5
Change-Id: I4663c3fd5eb5bf03bb1f421ffe39cd761c1b30ca
Merge branch 'tizen_4.0' into tizen_5.0
Change-Id: Ia3f1067915717be06164910e4efa5660cdb4f6aa
Merge branch 'tizen_3.0' into tizen_4.0
Change-Id: If6af4a7e369bb22bdd3b8817095680e6db7a0abe
Pawel Wasowski [Tue, 29 Dec 2020 15:56:01 +0000 (16:56 +0100)]
[ML][utils] Add native error to PlatformResult converter
[Verification] The code builds fine
Change-Id: I88234f6474850f554dc617bb0ccc5343b6ed7e93
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
[version] 2.46
Change-Id: I1d625296e33677999739d473d445b2c09d1ec4e7
Pawel Wasowski [Tue, 1 Dec 2020 09:30:10 +0000 (11:30 +0200)]
[Bluetooth] Prevent "Wrong listener identifier" errors for BLE scan
The following app code caused aforementioned errors:
var adapter = tizen.bluetooth.getLEAdapter();
adapter.startScan();
setTimeout(function() {
adapter.stopScan();
}, 10000);
Now, the error is not thrown.
[Validation] tct-bluetooth-tizen-tests: auto: 100% pass rate,
manual Bluetooth04_BLE_wearable suite: 100% pass rate
The code above runs in ChromeDevTools without errors
Change-Id: Id9ec278b4bb1c5ce38d0b3ffb1324498152ab645
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Pawel Wasowski [Tue, 22 Dec 2020 11:04:09 +0000 (12:04 +0100)]
[ML][pipeline] Add files structure
ACR: TWDAPI-274
Change-Id: I1941dba3cc1cfab2e0be514608e7b936da12b20e
Signed-off-by: Pawel Wasowski <p.wasowski2@samsung.com>
Rafal Walczyna [Mon, 21 Dec 2020 12:43:54 +0000 (13:43 +0100)]
[ML] Add files structure
[Verification] Build successful, tizen.ml.single and tizen.ml.pipeline
are visible in WebApplication
Change-Id: Iddd81dbff6531db9395495ecbbd94f0a9b81f95c
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
Rafal Walczyna [Mon, 4 Jan 2021 09:44:44 +0000 (10:44 +0100)]
[Common] Moved ArrayToString function to utils
[Verification] TCT-auto filesystem 100% passrate.
Change-Id: I323c80ef353ceef5723b423bed4a0ee4f9844656
Signed-off-by: Rafal Walczyna <r.walczyna@samsung.com>
[Common] Moved StringToArray function to utils and applied auto-format
[Verification] TCT filesystem 100% passrate.
Checked metadata features in chrome console.
Change-Id: I807d8514bfda1afccd136fe74b37f80ff45190ca
[Metadata] Fixes for implementation
[Verification] Code works as expected by documentation, fixed crash
when calling api without arguments. Verified in chrome console
Change-Id: I80a021d1804d2b0ac55279df1d3d4cc699bc0a8b
[Metadata] Add getSyncLyrics to MetadataHandle
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271
[Verification] Code compiles withotu errors.
Works well for mp3 file with SYLT data.
// Prectondition - file preparation (with python code)
// important - SYLT need to be UTF-8 or ISO-8859 encoded to be supported on Tizen device
from mutagen.id3 import ID3, SYLT, Encoding
tag = ID3("sample.mp3")
sync_lrc = [("TEST lyrics 1", 100),
("another TEST lyrics - 2", 2000),
("yet another TEST lyrics", 4000)] # [(lrc, millisecond), ]
tag.setall("SYLT", [SYLT(encoding=Encoding.UTF8, lang='eng', format=2, type=1, text=sync_lrc)])
tag.save()
tag.getall("SYLT")
// then push file to device
// then run below code in chrome console
var path = "videos/sample.mp3";
var fileHandle = tizen.metadata.createFileHandle(path);
var lyrics_num = fileHandle.get("SYNCLYRICS_NUM");
for (var i = 0; i < lyrics_num; ++i) {
var lyrics = fileHandle.getSyncLyrics(i);
console.log("Lyrics " + i + " (" + lyrics.timestamp + "ms): " + lyrics.lyrics);
}
// expected return be like
console-via-logger.js:173 Lyrics 0 (100ms): TEST lyrics 1
console-via-logger.js:173 Lyrics 1 (2000ms): another TEST lyrics - 2
console-via-logger.js:173 Lyrics 2 (4000ms): yet another TEST lyrics
Change-Id: I01a502f40655532a37fc4055480e35826bb7a697
Piotr Kosko [Thu, 1 Oct 2020 08:10:30 +0000 (10:10 +0200)]
[Metadata] Aded getFrameAtTime method of MetadataFileHandle
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271
[Verification] Code compiles without errors.
Works well for mp4 video.
var path = "videos/sample_video.mp4";
function showBlob(bbb) {
var elem = document.getElementById("blobImage") || document.createElement("img");
elem.setAttribute("id", "blobImage");
elem.setAttribute("height", "240");
elem.setAttribute("width", "240");
elem.setAttribute("alt", "invalid frame");
document.getElementById("test").appendChild(elem)
var objectURL = URL.createObjectURL(bbb);
elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var frame = fileHandle.getFrameAtTime(2000, true);
console.log(frame);
showBlob(frame)
Change-Id: Ib39c32566fe1d63711d7ce5ce991f216d7a84389
Piotr Kosko [Thu, 1 Oct 2020 06:02:45 +0000 (08:02 +0200)]
[Metadata] Aded getFrame method of MetadataFileHandle
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271
[Verification] Code compiles withotu errors.
Works well for mp4 video.
var path = "videos/sample_video.mp4";
function showBlob(bbb) {
var elem = document.getElementById("blobImage") || document.createElement("img");
elem.setAttribute("id", "blobImage");
elem.setAttribute("height", "240");
elem.setAttribute("width", "240");
elem.setAttribute("alt", "invalid frame");
document.getElementById("test").appendChild(elem)
var objectURL = URL.createObjectURL(bbb);
elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var frame = fileHandle.getFrame();
console.log(frame);
showBlob(frame)
Change-Id: I2d5e81b19d7f11ff2c08a0096a0b58fb7e3bfc48
Piotr Kosko [Wed, 30 Sep 2020 06:23:20 +0000 (08:23 +0200)]
[Metadata] Added getArtwork method of MetadataFileHandle
[ACR] https://code.sec.samsung.net/jira/browse/TWDAPI-271
[Verification]
Code compiles without errors.
Checked in chrome console with below code.
Precondition: sample.mp3 with artwork need to be pushed on device
// test artwork
var path = "videos/sample.mp3";
function showBlob(bbb) {
var elem = document.getElementById("blobImage") || document.createElement("img");
elem.setAttribute("id", "blobImage");
elem.setAttribute("height", "240");
elem.setAttribute("width", "240");
elem.setAttribute("alt", "invalid blob");
document.getElementById("test").appendChild(elem)
var objectURL = URL.createObjectURL(bbb);
elem.src = objectURL;
}
var fileHandle = tizen.metadata.createFileHandle(path);
var artwork = fileHandle.getArtwork();
console.log(artwork);
showBlob(artwork)
Change-Id: Ia0cbe5ade542ad71224a91c0c1a4618072b5538e
Merge branch 'tizen_6.0' into tizen
Change-Id: I2d08f181e8b6b7f3673d959c22f17cc67e8358f1
Merge branch 'tizen_5.5' into tizen_6.0
Change-Id: If24e8f3bf63cc1315e49ea67801d2742b8f7eb55
Merge branch 'tizen_5.0' into tizen_5.5
Change-Id: I813db4cffb3862ced142c7a94e62679259f53c6d
Merge branch 'tizen_4.0' into tizen_5.0
Change-Id: I660b3b2b74fb33acbb89b9d06b7a230abee28315
Merge branch 'tizen_3.0' into tizen_4.0
Change-Id: Ia0f2c393b1aa339c1881c084636dbfb91245602d
[version] 2.45
Change-Id: I96f465c583720abbb514635a56adf50988bdac4f