Development

Samsung Neural SDK provides a sample benchmarking application code to execute a model (neural network model) for image classification. This section describes how to execute a model using this sample application code on a Samsung device. Preparation of the model using offline tools are also covered which is an optional step prior to carrying out the execution on the device.

Step 1: Model processing for CPU/GPU

Neural SDK provides several tools for the benefit of model developer. These model tools include a growing set of optimizations like folding of batch normalization layer, encryption of weights, etc. for deploying Caffe models with the SDK. The complete set of options supported is depicted in the README document provided along with the tools. Currently these tools support only Caffe models.

1. Model Converter

The model converter tool applies possible static optimizations to the model. It is highly recommended to optimize the model using this tool prior to executing it on CPU, whereas if the compute unit is GPU, this step is mandatory. Additionally, the model converter provides the option of compressing the weights to different data types (for e.g.: float16).

Example: Apply static optimizations to the model

snap-caffe-tools/release/bin$ ./snap_model_converter -p model/ 
squeezenet.prototxt -w model/ squeezenet.caffemodel -o model/converted_squeezenet

Example: Weight compression to float16

snap-caffe-tools/release/bin$ ./snap_model_converter -p model/squeezenet.prototxt -w 
model/squeezenet.caffemodel -c float16 -o model/float16_squeezenet
2. Model Deconverter

The model deconverter tool changes the weights back to normal BVLC-Caffe-compatible blobs. This is required if the model, converted by the model converter tool (discussed above), is to be run by open source BVLC-Caffe. It should be noted that the original accuracy of the model cannot be regained using this tool.

Example: Model conversion back to the original format

snap-caffe-tools/release/bin$ ./snap_model_deconverter -t float16 -s 
model/float16_squeezenet.caffemodel -d model/orig_squeezenet.caffemodel
2.1 Model Encryption

Neural SDK provides a model encryption tool that provides fast symmetric key encryption on the weights file. The tool uses Advanced Encryption Standard (AES) CBC Mode, which is an advanced form of block cipher encryption. After encryption, the encrypted model can be passed to the SDK APIs, which takes care of the decryption of the model prior to loading the network.

Example: Encryption

snap-caffe-tools/release/bin$  ./snap_model_encryptor -w model/squeezenet.caffemodel -o 
model/encr_squeezenet.caffemodel --encrypt 1
2.2 Bin-Txt Converter

This is a debug tool to interchange between text- & binary-serialized prototxt formats, which can be used to view the changes made to .caffemodel for debugging, or manually change model contents.

Example: Binary to text conversion

snap-caffe-tools/release/bin$  ./bin_txt_converter -t txt -sp model/squeezenet.caffemodel -dp 
model/squeezenet.prototxt

Example: Text to binary conversion

snap-caffe-tools/release/bin$  ./bin_txt_converter -t bin  -sp model/ squeezenet.prototxt -dp 
model/squeezenet.caffemodel
Tip

Learn more by watching the video

Step 2: Model processing for NPU/DSP

The model intended to be executed needs to be converted to specific vendor formats, if it has to be run on NPU or DSP. These conversions are executed with the help of the tools provided by the vendor (Qualcomm or SLSI, as the case may be).

1. Model conversion for Qualcomm devices

In case of executing the model on NPU/DSP on a Qualcomm chipset based device, it needs to be converted to appropriate vendor format (.dlc). This is achieved using the model conversion tools provided by Qualcomm as part of SNPE SDK. Conversion to .dlc format is to be followed by quantization of the model.

SNPE SDK (https://developer.qualcomm.com/software/qualcomm-neural-processing-sdk) is to be downloaded and set up as explained in https://developer.qualcomm.com/docs/snpe/setup.html.

In the below procedures, $SNPE_ROOT refers to the directory path where the SNPE SDK is installed.

1.1 Caffe model conversion

Set Android NDK path as ANDROID_NDK_ROOT.

Using the SNPE SDK with Caffe models requires a valid Caffe installation which can be obtained and built from https://github.com/BVLC/caffe

Once Caffe is installed, setup the SNPE SDK environment from $SNPE_ROOT using the below script where $CAFFE_DIR is the path to the Caffe installation.

source bin/envsetup.sh -c $CAFFE_DIR

Now, the snpe-caffe-to-dlc tool is used for converting the trained caffe model to the .dlc format as below

snpe-caffe-to-dlc [-h] -c CAFFE_TXT [-b CAFFE_BIN] [-d DLC]
Example:
snpe-caffe-to-dlc --caffe_txt models/mobilenet.prototxt --caffe_bin models/mobilenet.caffemodel --dlc models/mobilenet.dlc

1.2 Tensorflow model conversion

Set Android NDK path as ANDROID_NDK_ROOT.

Using the SNPE SDK with TensorFlow models require a valid TensorFlow installation which can be obtained using the instructions given at https://www.tensorflow.org/get_started/os_setup

Once TensorFlow is installed, setup the SNPE SDK environment from $SNPE_ROOT using the below script where $TENSORFLOW_DIR is the path to the TensorFlow installation

source bin/envsetup.sh -t $ TENSORFLOW_DIR

Now, the snpe-tensorflow-to-dlc tool is used for converting a trained caffe model to the .dlc format as below

snpe-tensorflow-to-dlc [-h] --graph GRAPH - input_dim INPUT_DIM --out_node OUT_NODE [--dlc DLC]

Example:
snpe-tensorflow-to-dlc --graph models/tensorflow_inception_graph.pb --input_dim input "1,224,224,3" --out_node "softmax0" --dlc models/tensorflow_inception.dlc

1.3 Quantization of .dlc model

After conversion, the generated .dlc model file needs to be quantized using the snpe-dlc-quantize tool prior to execution on the device.

ssnpe-dlc-quantize [-h] --input_dlc DLC --input_list INPUT_LIST --output_dlc QUANTIZED_DLC

Example:
snpe-dlc-quantize --input_dlc models/mobilenet.dlc --input_list target_raw_list.txt --output_dlc models/mobilenet_quantized.dlc

The INPUT_LIST parameter is the path to a file specifying the trial inputs. This file should be a plain text file, containing one or more absolute file paths per line. An example is given below:

target_raw_list.txt

  • /home/trial_img_set/image1.raw

  • /home/trial_img_set/image2.raw

  • /home/trial_img_set/image3.raw

  • /home/trial_img_set/image4.raw

  • /home/trial_img_set/image5.raw

2. Model conversion for SLSI devices

Conversion of the model to the appropriate vendor format (.tflite) is required to execute it on NPU in Exynos chipset based devices. Currently Exynos NPU supports only Caffe trained models. Exynos provides a docker environment which helps in profiling, quantizing, and compilation of the model to provide the converted model in .tflite. The docker image is released by vendor for each compile version.

2.1 Caffe model conversion

User has to load the docker image via the following command:

docker load --input ubuntu-16.04-npuc-rel-0.972.docker.image

After the docker image is loaded to the host machine, enter the docker by running the script docker-npuc.sh script provided by the vendor along with the image.

chmod 777 docker-npuc.sh
./docker-npuc.sh
    

Model conversion to .tflite format contains mainly three steps namely Profiling, Quantization, and NPU compilation.

First, the prototxt file needs to be modified as in the below example:

name: “MODEL_NAME”
layer {
name: "data"
type: "Input"
top: "data“
top : “label”
transform_param {
scale: 1.0
mirror: false
mean_value: 104.0
mean_value: 117.0
mean_value: 123.0
} input_param {
shape {
dim: 1
dim: 3
dim: 300
dim: 300
}
}
}

Now the profiling script (profile.sh) is to be run followed by the quantizing script (quantize.sh) which are provided along with the docker image.

As the result of running the quantizing script, three files are generated: a quantized caffemodel, prototxt, and a protobin.

The final step is to combine the generated quantized caffemodel and profiling information by running the below command, which generates the .tflite model inside the mentioned out_folder.

npulite-gen -m [quantized caffemodel] -o [output_folder] -b [protobin file] -p [profiled prototxt]
Example:
npulite-gen –m Q_mobilenet.caffemodel -o out_folder -b Q_mobilenet.protobin 
-p Q_mobilenet.prototxt
Step 3: Application Development

The sample benchmark application provided can be used as a template to build your own image classification program.

In a nutshell, a model object and an execution options object are created using the model and the desired execution options. A new session instance is created and the above objects are passed on to the Open() API to load the model to memory. Further, the Execute() API is called to run the model on the device, after setting the required input data, to generate the inference results. Now, by calling the Close() API, the resources held by the session can be released and the users can utilize the inference results as deemed fit.

1. Create a model object

Create a Model object by calling SnapModel::Create().

On success, the output parameter SnapModel &model, contains the created SnapModel object.

1.1 Create the SnapModel object by passing the model as a file

static ErrCode Create(ModelFWType type, const std::vector &input_names, const std::vector &output_names, const std::string &weight_file, const std::string &model_file, SnapModel &model);
Example: 
snap_sdk::ErrCode status;  
status = snap_sdk::SnapModel::Create(type, inputNames, outputNames, weight_file, model_file,model);

OR

1.2 Create the SnapModel object by passing the model as a buffer

static ErrCode Create(ModelFWType type, std::vector &input_names, const std::vector &output_names, const std::string &model_file, const std::vector &model_buffer, SnapModel &model);

Example: 
snap_sdk::ErrCode status;  
status = snap_sdk::SnapModel::Create(type, inputNames, outputNames, model_file, model_buffer, model);
2. Create an execution options object

Create an execution options object by calling ExecutionOptions::Create().

On success, the output parameter ExecutionOptions &execTypeObj, contains the created ExecutionOptions object.

static ErrCode Create(ComputingUnit compUnit, ExecutionDataType execType, SnapModel &model, ExecutionOptions &execTypeObj);

Example:
status = snap_sdk::ExecutionOptions::Create(compUnit,execType,model,execTypeObj);
3. Create a session instance

Obtain an instance of SnapSessionInterface by calling CreateSnapSession()

extern "C++" ErrCode CreateSnapSession(SnapSessionInterface **session);

Example:
status =snap_sdk::CreateSnapSession(&session_);
4. Set the input data

Set the input data by calling SetData()

ErrCode SetData(const void *buffer, std::vector shapes, DataType type, DataFormat format);

Example for setting NHWC and float32 options :
std::vector shape = {1, modelHeight, modelWidth, modelChannels};
snap_sdk::DataType type = snap_sdk::DataType::FLOAT32;
snap_sdk::DataFormat format = snap_sdk::DataFormat::NHWC;
snap_sdk::SnapData::SetData(buffer, shape, type, format);
5. Set cache path for GPU

Set the GPU cache path (required only if the computing unit is GPU).

ErrCode SetGpuCacheSource(const std::string &cache_dir);

Example: 
status = execTypeObj.SetGpuCacheSource("/My_App/snap/tmp/");
6. Load the model

Load the model by calling Open() with the created SnapModel object and ExecutionOptions object as arguments, using the created session instance.

virtual ErrCode Open(SnapModel &model, ExecutionOptions &execOptions) = 0;

Example: 
status = session_->Open(model,execTypeObj);
7. Execute the model

Now, the model can be executed by calling Execute(), which will fill and return the "outputs" parameter.

virtual ErrCode Execute(const std::vector<SnapData> &inputs, std::vector<SnapData> *outputs) = 0; 

Example: 
status = session_->Execute(inputs, &outputs);
8. Extract the output

Extract the output on successful return of Execute().

void *GetBuffer() const;
std::vector GetShapes() const;
DataType GetType() const;
DataFormat GetFormat() const;

Example: 
std::cout << "values : " << static_cast(outputs[0].GetShapes()[0]) ;
std::cout << "format : " << outputs[0].GetFormat(); 
float *outputData = static_cast(outputs[0].GetBuffer()); 
9. Close the session

The session instance can now be released by calling Close().

virtual ErrCode Close() = 0;

Example: 
status = session_->Close();
10. Destroy the session instance

After Close(), destroy the SnapSessionInterface instance created.

extern "C++" ErrCode DestroySnapSession(SnapSessionInterface *session);

Example: 
status = snap_sdk::DestroySnapSession(session_);
Tip

Learn more by watching the video

Step 4: Running the Sample Native Benchmark Application

The benchmarking code may be executed by passing the following arguments to the script file provided. [Model name] [Android NDK version (should be at least 17b)] [Type of model (caffe/tensorflow)] [Preferred computing] [Execution Data type] [Mode of execution] [comma separated output layer names] [N, number of samples] [H, height of the model] [W, width of the model] [C, number of channels] [is_encrypted_model (true/false)] [Input name of the model]

For example, the following instructions may be followed to run the sample benchmark code on CPU for a caffemodel.

1. Copy the weight file (e.g.: squeezenet.caffemodel) to benchmark/data/model/

2. Copy the model file (e.g.: squeezenet.prototxt) to benchmark/data/prototxt/

3. Copy the libsnap_vndk.so library to benchmark/snap_libs/arm64-v8a/clang/

4. Run the Benchmark.sh file with appropriate options from benchmark folder

e.g.:  ./Benchmark.sh squeezenet.caffemodel ~/Android/Ndk/android-ndk-r17b/ 
caffe cpu float32 classifier prob 1 224 224 3 false data

Expected output is in the following manner:

Comparison of inference times

The superior performance of Neural SDK can be compared against another vendor SDK to see visible difference in inference timings.

In the below section, SNPE SDK is used to run the same model which was executed in the previous section with Neural SDK.

Procedure is as follows:

Convert the squeezenet (Caffe) model to .dlc format (refer to section 2.2.1 Caffe model conversion) to generate the model file squeezenet_snpe.dlc.

Quantization of the model is not required, as we are comparing performance on CPU.

Using the vendor benchmark application provided, execute the model as below:

1. Copy the dlc file (e.g.: squeezenet_snpe.dlc) to benchmark/data/model/

2. Run the Benchmark.sh file with appropriate options from benchmark folder

e.g.:  ./Benchmark.sh squeezenet ~/Android/Ndk/android-ndk-r17b/ clang snpe cpu 
float32 lib64 classifier prob 1 224 224 3 false

Expected output is in the following manner:

When this inference time (53.3091 ms) is compared with that of Neural SDK (18.0702 ms), the result is quite evident.

Tip

Learn more by watching the video

Congratulations! You have successfully achieved the goal of this Code Lab topic. Now, you can accelerate neural network models in your device all by yourself!

Tip

Learn more by watching the video

But, if you are having trouble finishing this topic, below is a completed sample code which you can use to help you finish the activity.

SDK LICENSE AGREEMENT

close

READ CAREFULLY BEFORE USING THE SDK: THIS SDK LICENSE AGREEMENT (“AGREEMENT”) IS A LEGAL AGREEMENT BETWEEN YOU(“LICENSEE”) AND SAMSUNG ELECTRONICS CO., LTD.(“SAMSUNG”) AND IS EFFECTIVE UPON YOUR ACCEPTANCE. BY CLICKING ON THE “I AGREE” BUTTON, INSTALLING, COPYING OR OTHERWISE USING THE SDK, YOU AGREE TO BE BOUND BY THE TERMS OF THIS AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, DO NOT CLICK ON THE “I AGREE” BUTTON AND DO NOT INSTALL OR USE THE SDK.

NOTICE:

The SDK is not intended to enable the design of Applications that (i) are used in any medical, life-saving or life sustaining systems (ii) used for the diagnosis of disease or the cure, mitigation, treatment, or prevention of disease or for any use that is intended to affect bodily structure or function or (iii) to be used as an accessory to a regulated medical device or to transform a computing platform into a regulated medical device.

Definitions

In this Agreement, the following capitalized terms shall have the meanings below:

"Affiliate" shall mean any corporation or other entity that is controlled by, or is under common control with a party (a corporation or other entity shall be deemed to control another if it owns or controls more than fifty percent (50%) of the voting stock or other ownership interest of the corporation or entity).

"Application" means a software program developed by Licensee for specific use with the SAMSUNG products in compliance with the Documentation and the program requirements and under Licensee’s own trademark and/or brand, including, in respect of such software programs, all bug fixes, enhancements, modifications, new releases, new versions, revisions, supplements, updates and upgrades.

"Authorized Users" means Licensee’s employees or other authorized contractors who have written and binding agreements with Licensee to protect the unauthorized use and disclosure of SAMSUNG’s and other third party Confidential Information (to the extent they will have access to such Confidential Information).

"Confidential Information" has the meaning given in Clause 5.1.

"Documentation" means any technical specifications and other specifications or documentation that SAMSUNG may make available or provide to Licensee relating to or for use in connection with the SDK.

"Open Source Software" means any software or software component, module or package that contains, or is derived in any manner (in whole or in part) from, any software that is distributed as free software, open source software or similar licensing or distribution models, including, without limitation, software licensed or distributed under any of the following licenses or distribution models, or licenses or distribution models similar to any of the following: (a) GNU’s General Public License (GPL) or Lesser/Library GPL (LGPL); (b) the Artistic License (e.g., PERL); (c) the Mozilla Public License; (d) the Netscape Public License; (e) the Sun Community Source License (SCSL); (f) the Sun Industry Standards License (SISL); (g) the BSD License; and (h) the Apache License.

"Published API(s)" means the documented Application Programming Interface(s) contained in the SDK.

"Sample Code” means the software marked as “sample” or delivered in a folder marked “sample” that may be included as a part of the SDK. Sample Code may be in source code or object code format.

"SDK" means Samsung Enterprise SDK, which includes the APIs, applications, Documentation, data, files, libraries, materials, IDE (Integrated Development Environment), Sample Code, software (source code and object code), simulators and tools provided or made available to Licensee by SAMSUNG pursuant to this Agreement for use in connection with the development of Applications, including any Updates that SAMSUNG may provide or make available. For the purpose of clarity, SDK is SAMSUNG’s proprietary information and software is considered neither as open source nor in the public domain.

"Term" means the term of this Agreement as specified in Clause 1.

"Third Party Software" shall mean any software, computer programming code or accompanying documentation owned by any third party including, but not limited to, any of following:

  1. (a) any software licensed from a third party, or
  2. (b) any software placed in the public domain and accessible to anyone without any specific license terms attached thereto, or
  3. (c) any software disclosed or distributed under a license that permits users to use, modify, improve or distribute such software and/or documentation and requires any or all of the following:
    1. i.the making available of source code, object code and/or accompanying documentation of the software or any modifications to, or derivatives of, such software and/or documentation; or
    2. ii.the granting of the right to distribute, use, create modifications to, or create derivative works from, such software and/or documentation at no charge or on a royalty-free basis.
  4. (d) any software licensed under the Academic Free License, Apache Software License, the Artistic License (e.g., PERL); Berkeley Software Distribution License; Eclipse Public License; GNU’s General Public License; GNU’s Lesser/Library GPL; MIT License; the Mozilla Public License; the Python License, the Sleepy Cat license, the Sun Community Source License; or licenses approved by the Free Software Foundation or the Open Source Initiative.

"Updates" means, in respect of the SDK or any part of the SDK, bug fixes, enhancements, modifications, new releases, new versions, supplements, updates or, upgrades.

1. Term

This Agreement is effective upon Licensee’s acceptance, by clicking on the “I AGREE” button, and continues to be effective until terminated by Licensee or SAMSUNG in accordance with Clause 9 (“Term”).

2. Grant of SDK License and Restrictions

  1. 2.1

    Subject to the provisions of this Agreement, SAMSUNG hereby grants Licensee a limited, non-exclusive, personal, revocable, non-sub licensable and non-transferable license during the Term to:

    1. (a) install a reasonable number of copies of the SDK on computers that Licensee owns or controls, for internal use by Licensee or Authorized Users solely for the purpose of developing or testing Applications; and
    2. (b) make a reasonable number of copies of the Documentation and distribute such copies to Authorized Users for internal use solely for the purpose of developing or testing Applications.
  2. 2.2

    Licensee acknowledges and agrees that an Application must satisfy SAMSUNG’s technical standards before it can be tested on the relevant SAMSUNG product pursuant to SAMSUNG’s internal quality assessment process. SAMSUNG reserves the right to reject any Application at its sole discretion. SAMSUNG’s testing of an Application shall not be construed as Samsung’s approval on the Application on any aspect. If a material change is made to the Application, Licensee must submit the revised version for SAMSUNG’s approval.

  3. 2.3

    Licensee must ensure that the SAMSUNG copyright disclaimers and other proprietary notices that appear in the SDK and Documentation are retained and reproduced in full in all copies of the SDK and Documentation that Licensee makes as permitted under this Agreement.

  4. 2.4

    Licensee must not, directly or indirectly, sell, redistribute, rent, lease, lend or sublicense all or any part of the SDK, or enable or allow others to do such things. Licensee must not use the SDK for any purpose that is not expressly permitted under this Agreement. Except to the extent permitted by licensing terms in respect to the Third Party Software components or Sample Code included in the SDK, Licensee must not, directly or indirectly, copy (except as expressly permitted under this Agreement), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create derivative works of the SDK or any part thereof, or enable or allow others to do such things. The foregoing restrictions apply except as prohibited by applicable law and only to the extent of such prohibition.

  5. 2.5

    Licensee must not exploit the SDK in any unauthorized way, including but not limited to, by way of trespass or burdening network capacity. Any attempt to do so constitutes a violation of the rights of SAMSUNG and licensors of the SDK.

  6. 2.6

    Except for the limited license granted to Licensee in this Agreement, all rights, title, and interest in and to the SDK and any Updates that are made available to Licensee under this Agreement remain, at all times, the sole and exclusive property of SAMSUNG. Licensee agrees to cooperate with SAMSUNG to maintain SAMSUNG's ownership of the SDK, and Licensee agrees to promptly provide notice of any claims or threatened claims relating to the SDK. Apart from the license rights expressly set out in this Agreement, SAMSUNG does not grant to Licensee and Licensee does not receive, whether by implication, estoppel or otherwise, any ownership right, title or interest nor any security interest or other interest in any intellectual property rights relating to the SDK, nor in any copy of any part of the foregoing, nor any other licenses, immunity or rights, express or implied.

  7. 2.7

    Except as expressly permitted under this Agreement, nothing in this Agreement grants Licensee any right to use any of SAMSUNG’s trademarks, trade names, copyrights, service marks, logos, domain names, patents, trade secrets, other brand features distinctive to SAMSUNG or other intellectual property, which remain, at all times, the sole and exclusive property of SAMSUNG.

  8. 2.8

    SAMSUNG may, at any time without notice, extend, enhance, or otherwise modify the SDK. If SAMSUNG makes available Updates, such Updates will be governed by this Agreement (unless a separate license is provided with the Update, in which case the terms of that license will govern the Update). Licensee acknowledges that SAMSUNG has no obligation, whether express or implied, to announce or make available any Updates. Where an Update is made available, such Update may have APIs, features, services and/or functionality that are different from those found in the SDK licensed under this Agreement.

  9. 2.9

    From time to time during the Term, SAMSUNG may provide Licensee with test versions of the SDK. Licensee acknowledges and agrees that Licensee must not rely on such test versions to perform in the same manner as a final-release commercial-grade product and Licensee must not use such test versions with data that is not sufficiently backed up on a regular basis.

  10. 2.10

    SAMSUNG has no obligation to provide any maintenance, technical or other support in respect of the SDK.

  11. 2.11

    If the Application is distributed, offered, resold, or licensed ("Distribute") under the white-labeling of a third party, SAMSUNG may object to such Distribution if SAMSUNG deems the Distribution adversely affects SAMSUNG's business. In that case, Licensee shall immediately cease to Distribute the Application and discuss in good faith to find an alternative which should be mutually beneficial to both Licensee and SAMSUNG.

3. Conditions and Requirements

  1. 3.1

    General Conditions and Requirements
    Licensee acknowledges and agrees that the Applications must comply with the conditions and requirements set out below, as modified by SAMSUNG from time to time:

    1. (a) Licensee will comply with all applicable laws and regulations in connection with this Agreement;
    2. (b) If an Application captures, collects or records any form of user or device data, images, pictures or voice data (collectively "Recordings"), or processes, maintains, uploads, syncs, or transmits any form of user data, content or information (collectively "Transmissions"), such Recordings and Transmissions must comply with all applicable laws and regulations (including but not limited to privacy laws) as well as any SAMSUNG’s internal policies or requirements in relation to such matters (including but not limited to any notice or consent requirements). In particular, Licensee must ensure that a reasonably distinctive and conspicuous visual indication that a Recording is taking place is displayed to the user as part of the Application.
    3. (c) Licensee will be solely responsible for any and all claims and/or damages arising from or related to the Application installing or launching other executable code itself through the use of a plug-in architecture, calling other frameworks, other APIs or otherwise except as authorized by SAMSUNG in writing in advance. Licensee will be solely responsible for any and all claims and/or damages arising from or related to the download or use of interpreted code in any Application other than the code that is interpreted and run by SAMSUNG's Published APIs and built-in interpreters except as authorized otherwise by SAMSUNG in advance in writing.
    4. (d) Applications must comply with all applicable laws and regulations (including the laws and regulations of any jurisdiction in which the Applications are offered or made available) and SAMSUNG’s internal policies and regulations. Especially, in respect of any Application that uses the Health package, Licensee shall comply with any and all of SAMSUNG’s registration processes. Before Applications are available to customer, end users or the public, Licensee shall obtain all required and necessary permissions and/or approvals from relevant government authorities. In addition, in respect of any Application that may collect, transmit, maintain, process, share, disclose or otherwise use personal information, location information, health information or other data that relates to a user ("User Information Handling"), Licensee shall comply, and the Application must be compliant, with all applicable privacy and data collection laws and regulations with respect to such User Information Handling. Licensee must ensure that any processing or transmission of the end user data is conducted in a manner that preserves the accuracy and security of the data. Licensee must not design or market Applications for the purpose of violating any legal rights of any person (including but not limited to privacy rights).
    5. (e) Without limiting Licensee’s obligations under paragraph (f), Licensee must ensure that any Application that offers health information or location information based services or functionality notifies and obtains consent from an individual before the individual’s health or location data is collected, transmitted or otherwise used by the Application. In addition, Applications that use health information based APIs shall comply with SAMSUNG’s registration process.
    6. (f) Applications that use location-based APIs for real-time route guidance, MUST NOT BE USED FOR ANY EMERGENCY OR LIFE SAVING PURPOSES DUE TO ITS INACCURACY and Licensee must have an end user license agreement in relation to such Applications that includes the following notice: "REAL TIME LOCATION DATA ACCESSED VIA THIS APPLICATION MAY BE INACCURATE OR INCOMPLETE. LICENSEE’S USE OF THIS APPLICATION IS AT ITS SOLE RISK." Licensee shall not use the Application for nuclear energy equipment, air traffic control, the operation of communication system, public transportation control, life support devices, or other devices that may cause deaths, injuries or severe physical or environmental losses in the event that the Application fails to perform in such devices. Any attempt to do so shall be deemed as a material breach under this Agreement.
    7. (g) Applications must not disable, override or otherwise interfere with any SAMSUNG-implemented system including, but not limited to, those that are intended to notify a user that the user's location data is being collected, transmitted, maintained, processed or used, or intended to obtain consent for such use. Applications may not provide services for which the user's consent has been denied or withdrawn.
    8. (h) If an Application includes any Third Party Software, Licensee must comply with all licensing terms applicable to such Third Party Software. However, Licensee shall separate the portion of the Third Party Software from the portion of the SDK in Licensee’s Application and shall not cause the portion of the SDK in Licensee’s Application, any derivative works thereof, and/or SAMSUNG’s Confidential Information to be subject to the licensing terms applicable to such Third Party Software (e.g., public disclosure, public distribution). Licensee shall indemnify, defend and hold harmless SAMSUNG, its distributors and its customers from and against any and all claims, demands, damages, costs or expenses (including reasonable attorney’s fees) and liabilities arising out of or in relation to the use of Third Party Software.
    9. (i) Applications may be rejected if they contain content or materials of any kind (including, but not limited to, text, graphics, images, photographs, sounds, etc.) that SAMSUNG reasonably determines to be objectionable (for example, materials that may be considered obscene, pornographic or defamatory).
    10. (j) Prior to distribution, public release or public demonstration of the Application, Licensee shall obtain prior key signing for the Application from SAMSUNG.
    11. (k) Licensee shall promptly respond to SAMSUNG regarding the use of policies and APIs in connection with the Application and/or SDK, upon SAMSUNG’s request.
    12. (l) Licensee warrants that the use of Licensee’s Application does not and will not infringe the intellectual property rights, or other proprietary rights of any third party and shall immediately notify Samsung in the event of any such infringement.
    13. (m) Licensee warrants that the Application is free from material errors and defects. Licensee warrants that the Application has been designed and developed for installation and operation solely on the devices that have been fully tested and approved by Samsung. Licensee warrants that the Application will operate with each applicable key.
    14. (n) Licensee acknowledges and agrees that in connection with Licensee’s use of the SDK, Samsung may collect and use information about the Application and use of Application. Licensee shall obtain all consents from the users of the Application necessary for Samsung to use the foregoing information for the purpose of improving SDK and for providing services, if any, related to the SDK. For the purpose of clarity, Samsung reserves the right to charge for use of the SDK in the future.
    15. (o) Applications SHALL NOT BE USED FOR ANY MEDICAL PURPOSES, including, without limitation, diagnosis of disease or other conditions; cure, mitigation, treatment, or prevention of disease; detection, diagnosis, monitoring, management or treatment of any medical condition, disease or vital physiological processes; transmission of time-sensitive health information (collectively, “Medical Purposes”). Licensee shall not develop, make, promote, market, distribute, license, sell or use Application for any Medical Purposes. Licensee hereby represents and warrants that no Application is and will be classified as a medical device under any applicable jurisdiction in the world, including, without limitation, U.S. Food and Drug Administration. Any breach of this Section 15 shall be deemed as a material breach under this Agreement. Where Licensee allegedly or actually breaches this Section 15, subject to Samsung’s interpretation, Samsung has a right to revoke the license granted under this Agreement and/or block access to Published APIs by Applications, at its sole discretion.

4. Licensee’s Responsibilities

  1. 4.1

    Licensee represents and warrants to SAMSUNG and agrees that

    1. (a) Licensee has the requisite corporate authority to enter into this Agreement and perform its obligations under this Agreement, and this Agreement does not conflict with any other agreement or obligation by which it is bound;
    2. (b) Licensee is and will be responsible for the Authorized Users’ use of the SDK and their compliance with this Agreement; and
    3. (c) Licensee will be solely responsible for all activities Licensee and the Authorized Users undertake in connection with the SDK, the Applications and the development of Applications.

5. Confidentiality and Press Release

  1. 5.1

    Licensee acknowledges and agrees that the SDK (including all test versions of the SDK) constitute "Confidential Information" for the purposes of this Agreement, unless SAMSUNG expressly indicates otherwise or makes the terms and conditions of the SDK publicly available. Notwithstanding the foregoing, Confidential Information does not include information that Licensee can demonstrate by written evidence:: (i) information that is generally and legitimately available to the public through no fault or breach by Licensee, (ii) information that SAMSUNG makes generally made available to the public, (iii) information that Licensee independently develops without use or reliance of any Confidential Information, (iv) information that Licensee lawfully obtains from a third party who has the right to transfer or disclose the information to Licensee without limitation, or (v) any Open Source Software included in the SDK, the licensing terms of which do not contain obligations of confidentiality.

  2. 5.2

    Licensee must protect Confidential Information using a degree of care that is no less than that which Licensee uses to protect Licensee’s own confidential information of the same or similar importance (and in any event, no less than a reasonable degree of care). Licensee may use Confidential Information solely for the purpose of exercising Licensee’s rights and performing Licensee’s obligations under this Agreement and Licensee must not use Confidential Information for any other purpose, or for Licensee’s own or any third party’s benefit, without the prior written consent of SAMSUNG. Licensee may disclose Confidential Information to the extent required by law, provided that Licensee takes reasonable steps to notify SAMSUNG of the relevant requirement prior to disclosing the Confidential Information and Licensee takes reasonable steps to obtain protective treatment against disclosure of the Confidential Information.

  3. 5.3

    Licensee must not issue any press releases or make any other public statements relating to this Agreement, its terms and conditions, or Licensee’s relationship with SAMSUNG without the express prior written approval of SAMSUNG.

6. DISCLAIMER OF WARRANTY

SAMSUNG EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. FURTHER, SAMSUNG DOES NOT REPRESENT OR WARRANT THAT ANY PORTION OF THE SDK IS FREE OF INACCURACIES, ERRORS, BUGS OR INTERRUPTIONS, OR IS RELIABLE, ACCURATE, COMPLETE, OR OTHERWISE VALID. THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE", WITHOUT ANY WARRANTY OF ANY KIND FROM SAMSUNG.
LICENSEE’S USE OF THE SDK IS AT ITS OWN DISCRETION AND RISK, AND LICENSEE WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE THAT RESULTS FROM THE USE OF THE SDK INCLUDING, BUT NOT LIMITED TO, ANY DAMAGE TO LICENSEE’S COMPUTER SYSTEM OR LOSS OF DATA. FOR THE PURPOSE OF CLARITY, THE SAMPLE CODE IS LICENSED “AS-IS” AND LICENSEE BEARS THE RISK OF USING IT. SAMSUNG GIVES NO EXPRESS AND/OR IMPLIED WARRANTIES, GUARANTEE OR CONDITIONS.

7. LIMITATION OF LIABILITY

SUBJECT TO TERMS AND CONDITIONS OF THIS AGREEMENT AND TO THE FULLEST EXTENT ALLOWED AND PERMITTED BY APPLICABLE LAWS AND REGULATIONS, SAMSUNG SHALL NOT, UNDER ANY CIRCUMSTANCES, BE LIABLE TO LICENSEE OR ANY THIRD PARTY THROUGH LICENSEE FOR PERSONAL INJURY OR ANY CONSEQUENTIAL, EXEMPLARY, INCIDENTAL, INDIRECT, PUNITIVE OR SPECIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR IN RELATION TO THIS AGREEMENT, LICENSEE’S USE OF THE SDK, OR LICENSEE’S DEVELOPMENT OF APPLICATIONS, WHETHER BASED ON BREACH OF CONTRACT, BREACH OF WARRANTY, TORT (INCLUDING NEGLIGENCE), PRODUCT LIABILITY OR OTHERWISE, EVEN IF IT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES AND NOTWITHSTANDING THE FAILURE OF ESSENTIAL PURPOSE OF ANY REMEDY. THE SDK LICENSED HEREUNDER IS NOT DESIGNED OR INTENDED FOR USE TO ENABLE THE DESIGN OF APPLICATIONS USED IN ANY MEDICAL, LIFE SAVING OR LIFE SUSTAINING SYSTEMS, TRANSPORTATION SYSTEMS, NUCLEAR SYSTEMS, OR FOR ANY OTHER MISSION CRITICAL APPLICATION IN WHICH THE FAILURE OF THE SDK COULD LEAD TO PERSONAL INJURY OR DEATH OR FOR USE IN ANY SECURITY-RELATED USE CASES. LICENSEE’S UNDERSTANDING, ACKNOWLEDGEMENT AND ACCEPTANCE OF THIS AGREEMENT ARE THE LEGAL BASIS AND CONSIDERATION FOR THE LICENSES GRANTED UNDER IT.

8. Indemnity

  1. 8.1

    To the fullest extent permitted by law, Licensee agrees to indemnify, defend and hold harmless SAMSUNG, its Affiliates, directors, officers, employees, independent contractors and agents (each a "SAMSUNG Indemnified Party") from any and all claims, losses, liabilities, damages, expenses and costs (including without limitation reasonable attorneys fees) (collectively "Losses") incurred by a SAMSUNG Indemnified Party as a result of Licensee’s (or an Authorized User’s) breach of this Agreement, any claims that the Applications violate or infringe any third party intellectual property or proprietary rights, or otherwise related to or arising from Licensee’s (or any Authorized User’s) use of the SDK, the Applications or Licensee’s (or any Authorized User’s) development or distribution of Applications.

  2. 8.2

    Licensee acknowledges that the SDK is not intended to be used in the development of any Application where death, personal injury, or severe physical or environmental damage could result from errors or inaccuracies in the content, data or information provided by the Application or by Application failures. To the extent permitted by law, Licensee agrees to indemnify, defend and hold harmless each SAMSUNG Indemnified Party from any Losses incurred by such SAMSUNG Indemnified Party as a result of Licensee’s use of the SDK in the development of any such Applications.

  3. 8.3

    Licensee must not enter into a settlement or like agreement with any third party that affects SAMSUNG's rights or binds SAMSUNG in any way related to or arising from Licensee’s (or any Authorized User’s) use of the SDK without the prior written consent of SAMSUNG.

9. Termination

  1. 9.1

    Right to Terminate.
    This Agreement and all rights granted by SAMSUNG hereunder maybe immediately terminated:

    1. (a) by Licensee if Licensee ceases use of the SDK;
    2. (b) by SAMSUNG: (i) if Licensee has breached any terms of this Agreement; or (ii) if SAMSUNG is required by law to terminate this Agreement or the rights granted by SAMSUNG;
    3. (c) by either party for any reason or no reason upon thirty (30) days prior written notice to the other party; or
    4. (d) by SAMSUNG if Google develops or has developed a software development kit which is same as or similar to the SDK. Licensee agrees and acknowledges that it has been advised of the possibility of Google developing or having developed a software development kit which is same or similar to this SDK, when executing this Agreement.
      SAMSUNG will have no liability to pay compensation or damages, or to provide an indemnity, of any kind as a result of terminating this Agreement in accordance with its terms, and termination of this Agreement is without prejudice to any other right or remedy that SAMSUNG may have, now or at any time in the future.
  2. 9.2

    Consequences of Termination
    Upon the termination of this Agreement: (a) all rights granted in this Agreement will terminate; (b) Licensee shall promptly stop using the SDK and return the SDK to SAMSUNG or destroy all electronic copies of the SDK and, at SAMSUNG’s request, provide written certification of such destruction to SAMSUNG. The provisions of Clauses 1, 2.4, 2.5, 2.6, 2.7, 2.8, 3, 4, 5, 6, 7, 8, 9 and 10 will survive the expiration or termination of this Agreement.

10. General

  1. 10.1

    Assignment.
    Licensee may not assign the Agreement, in whole or in part, without SAMSUNG’s prior written consent, and any attempt to do so without such consent shall be void. SAMSUNG may assign this Agreement without the Licensee’s consent. This Agreement shall be binding upon and shall inure to the benefit of the parties hereto and their respective successors and permitted assigns.

  2. 10.2

    Relationship of Between Licensee and SAMSUNG.
    This Agreement will not be construed as creating an agency, partnership, joint venture, fiduciary duty, or any other form of legal relationship between Licensee and SAMSUNG, and Licensee must not represent the existence of any such relationship, whether expressly, by implication or otherwise.

  3. 10.3

    Third Party Rights
    This Agreement is not for the benefit of any third parties.

  4. 10.4

    Development by SAMSUNG.
    Nothing in this Agreement limits or otherwise affects SAMSUNG's right to acquire, develop, license, market, promote, or distribute any product or technology that performs the same or similar functions as the Applications or any other products or technologies that Licensee develops, markets, promotes or distributes, or that otherwise competes with the Applications or such products or technologies.

  5. 10.5

    Notices.
    Any notices or other communication made pursuant to this Agreement must be in writing and will be deemed to have been fully given or made when: (a) personally delivered; or (b) three (3) days after being mailed via commercially reputable overnight delivery service, to the following address:

    SAMSUNG:
    (Maetandong) 129, Samsung-ro
    Yeongtong-gu,Suwon-si, Gyeonggi-do, Republic of Korea 443-742

    Licensee agrees to receive notices and other communications to be made to Licensee pursuant to this Agreement by email and Licensee agrees that any notices that SAMSUNG sends to Licensee by email will satisfy any legal communication requirements.

    A party may change its email or mailing address by giving the other party written notice in accordance with this Clause.

  6. 10.6

    No Waiver.
    Failure by SAMSUNG to insist upon strict performance of any of the provisions contained in this Agreement shall in no way constitute a waiver of SAMSUNG’s rights as set forth in this Agreement, at law or in equity, or a waiver of any other provisions or the right to take action in respect of a subsequent default by Licensee in the performance or compliance with any of the terms and conditions set forth in this Agreement.

  7. 10.7

    Remedies.
    Licensee acknowledges that any disclosure, use or misappropriation of Confidential Information of SAMSUNG in violation of this Agreement would cause SAMSUNG irreparable harm for which there may be no adequate remedy at law. Accordingly, Licensee agrees that SAMSUNG shall have the right to apply to any court of competent jurisdiction for injunctive relief and specific performance, without prejudice to any remedies otherwise available to SAMSUNG at law or in equity.

  8. 10.8

    Governing Law; Venue.
    This Agreement shall be governed by and construed in accordance with the laws of the Republic of Korea, without regard to any conflict-of-laws rules. All disputes, controversies or claims between the parties arising out of or in connection with this Agreement (including its existence, validity or termination) shall be finally resolved by arbitration to be held in Seoul, Korea and conducted in English under the Rules of Arbitration of the International Chamber of Commerce; provided, however, that each party may enforce its or its affiliates’ intellectual property rights in any court of competent jurisdiction, including but not limited to equitable relief. The arbitral award shall be final and binding on the parties. Except to the extent entry of judgment and any subsequent enforcement may require disclosure, all matters relating to the arbitration, including the award, shall be held in confidence.

  9. 10.9

    Entire Agreement.
    This Agreement contains the entire agreement between the parties with respect to the use of the SDK licensed hereunder and supersedes all existing agreements and all other oral, written or other communications between the parties concerning this subject matter. If any provision of this Agreement (or any portion thereof) is invalid, illegal or unenforceable, the validity, legality and enforceability of the remainder of this Agreement shall not be affected or impaired.

DownLoad