-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Example] Style transfer inference ONNX model using ml-service API.
Add appsrc-pipeline based conf file for onnx-example. Signed-off-by: Suyeon Kim <[email protected]>
- Loading branch information
1 parent
085d20f
commit 4efdd5b
Showing
15 changed files
with
1,265 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
global: main; | ||
_IO_*; | ||
local: *; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>OnnxStyleTransferPipeline</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name> | ||
<triggers>full,incremental,</triggers> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.cdt.core.cnature</nature> | ||
<nature>org.eclipse.cdt.core.ccnature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature> | ||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature> | ||
</natures> | ||
<filteredResources> | ||
<filter> | ||
<id>1716767357612</id> | ||
<name></name> | ||
<type>26</type> | ||
<matcher> | ||
<id>org.eclipse.ui.ide.multiFilter</id> | ||
<arguments>1.0-projectRelativePath-matches-false-false-*/.tpk</arguments> | ||
</matcher> | ||
</filter> | ||
<filter> | ||
<id>1716767357614</id> | ||
<name></name> | ||
<type>6</type> | ||
<matcher> | ||
<id>org.eclipse.ui.ide.multiFilter</id> | ||
<arguments>1.0-name-matches-false-false-project_def.prop</arguments> | ||
</matcher> | ||
</filter> | ||
</filteredResources> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<tproject xmlns="http://www.tizen.org/tproject"> | ||
<platforms> | ||
<platform> | ||
<name>tizen-8.0</name> | ||
</platform> | ||
</platforms> | ||
<package> | ||
<blacklist/> | ||
<resFallback autoGen="true"/> | ||
</package> | ||
</tproject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: Style Transfer Onnx | ||
... | ||
|
||
# Style Transfer Onnx Sample App with NNStreamer Pipeline C-API | ||
Tizen Native App with NNStreamer Piepeline API | ||
|
||
## Description | ||
* This is a sample application of Tizen Native. | ||
* If you want to run it on your device, Tizen 9.0 or higher is required. | ||
* If you want to run it on Tizen 8.0 devices, you need to install the latest packages of nnstreamer-onnxruntime and machine-learning-service. | ||
* About details of NNStreamer, please check [this page](https://docs.tizen.org/application/native/guides/machine-learning/machine-learning-inference). | ||
* The applied ONNX model file from [here](https://github.com/onnx/models/blob/main/validated/vision/style_transfer/fast_neural_style/README.md). | ||
|
||
## Result | ||
<img src="./before.png" width="320"> <img src="./after.png" width="320"> | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
Tizen.native/OnnxStyleTransferPipeline/inc/onnxstyletransferpipeline.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @file onnxstyletransferpipeline.h | ||
* @date 27 May 2024 | ||
* @brief TIZEN Native Example App with NNStreamer/C-API. | ||
* @see https://github.com/nnstreamer/nnstreamer | ||
* @author Suyeon Kim <[email protected]> | ||
* @bug No known bugs except for NYI items | ||
*/ | ||
|
||
#ifndef __onnxstyletransferpipeline_H__ | ||
#define __onnxstyletransferpipeline_H__ | ||
|
||
#include <app.h> | ||
#include <Elementary.h> | ||
#include <system_settings.h> | ||
#include <efl_extension.h> | ||
#include <dlog.h> | ||
|
||
#ifdef LOG_TAG | ||
#undef LOG_TAG | ||
#endif | ||
#define LOG_TAG "onnxstyletransferpipeline" | ||
|
||
#if !defined(PACKAGE) | ||
#define PACKAGE "org.example.onnxstyletransferpipeline" | ||
#endif | ||
|
||
#endif /* __onnxstyletransferpipeline_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
APPNAME = onnxstyletransferpipeline | ||
|
||
type = app | ||
profile = tizen-8.0 | ||
|
||
USER_SRCS = src/onnxstyletransferpipeline.c | ||
USER_DEFS = | ||
USER_INC_DIRS = inc | ||
USER_OBJS = | ||
USER_LIBS = | ||
USER_EDCS = |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions
41
Tizen.native/OnnxStyleTransferPipeline/res/onnx_style_transfer.pipeline.appsrc.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"pipeline" : | ||
{ | ||
"description" : "appsrc name=appsrc caps=other/tensor,type=uint8,dimension=3:720:720:1,framerate=0/1 ! | ||
tensor_transform mode=transpose option=1:2:0:3 ! | ||
tensor_transform mode=arithmetic option=typecast:float32,add:0.0 ! | ||
tensor_filter framework=onnxruntime model=/opt/usr/globalapps/org.example.onnxstyletransferpipeline/res/candy.onnx ! | ||
tensor_converter ! tensor_transform mode=transpose option=2:0:1:3 ! | ||
tensor_transform mode=arithmetic option=mul:1.0,add:0.0 ! | ||
tensor_transform mode=clamp option=0:255 ! | ||
other/tensor,type=float32,dimension=3:720:720:1,framerate=0/1 ! | ||
tensor_transform mode=typecast option=uint8 ! | ||
other/tensor,type=uint8,dimension=3:720:720:1,framerate=0/1 ! | ||
tensor_decoder mode=direct_video ! videoconvert ! video/x-raw,width=720,height=720,format=BGRA,framerate=0/1 ! | ||
tensor_converter ! tensor_sink name=tensor_sink ", | ||
"input_node" : [ | ||
{ | ||
"name" : "appsrc", | ||
"info" : [ | ||
{ | ||
"type" : "uint8", | ||
"dimension" : "3:720:720:1" | ||
} | ||
] | ||
} | ||
], | ||
"output_node" : [ | ||
{ | ||
"name" : "tensor_sink", | ||
"info" : [ | ||
|
||
{ | ||
"type" : "uint8", | ||
"dimension" : "3:720:720:1" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
|
Binary file added
BIN
+56.3 KB
Tizen.native/OnnxStyleTransferPipeline/shared/res/onnxstyletransferpipeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.