Development

Step 1: Setup the Docker Environment

Docker is a convenient and easy way to standardize an environment in a very lightweight Linux environment (usually Alpine Linux running in the Docker Engine) that contains all dependencies required to run a program. In this case, the docker image provided is preconfigured to include disco, discomp (disco’s parallelization multi-processes API), and other image processing and quantitative libraries such as the cv2 (computer vision library), FFmpeg (video processing library), and numpy (scientific computing library).

The purpose of this lesson is to verify that the Docker Environment is setup correctly on the machine.

  1. 1.

    Download the disco docker image with the following command line.

    docker pull iqoqo/discofy:sdc.local
  2. 2.

    Tag the docker image with the following command line.

    docker tag iqoqo/discofy:sdc.local discofy:sdc.local
  3. 3.

    Check the image is installed in docker.

    docker images
  4. 4.

    In the project root directory (e.g., /Users/raymondlo84/Documents/sdc2019), execute the following command line to run the script in the docker environment.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_1/ discofy:sdc.local pytest

The result above show that the docker had successfully executed the pytest script.

Tip

Learn more by watching the video

Step 2: Discofy an image

In Step 1, we provided a Docker environment that runs Python code with OpenCV, FFmpeg, and other scientific libraries such as numpy. In this lesson, we will provide an interesting example of how we can overlay eyeglasses onto a face detected in an image using these libraries.

Additionally, we have also added the Dlib library for supporting the face detection and face feature extraction (facial landmarks) based on machine learning. In our code, a pre-trained facial landmark detector and model (i.e., shape_predictor_68.dat) are added to estimate the location of 68 coordinates that map to facial structures on the detected face.

For further details on how the facial landmark works, please refer to https://ibug.doc.ic.ac.uk/resources/facial-point-annotations/

  1. 1.

    Open glasses_2.py in the lessons/lesson_2 directory.

    Hint: Look at mesh_overlays and overlay_transparent, these are the main functions that we use for the face detection and meshing of the images.

  2. 2.

    Add in the solution code to discofy_image.

  3. 3.

    To run the solution, execute the following command in the project root directory.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_2/
    discofy:sdc.local python glasses_2.py <input image path> <output image path>
            

    Replace <input image path> and <output image path> with your own image path. In this example, we have provided an image of dis.co team in the lessons/lesson_2/team.png directory.

  4. 4.

    Run the tester to generate and validate the results.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_2 discofy:sdc.local pytest
  5. 5.

    Open the result images located in lessons/lesson_2/disco-team1.jpg

Tip

Learn more by watching the video

Step 3: Discofy videos

Now, we have acquired a powerful tool to intelligently process and overlay our ‘disco shade’ onto a face detected in an image based on machine learning. The next natural step is how we can scale this to a video (i.e., a sequence of images) or even on hundreds of different streams of videos.

To handle video files, the FFmpeg library provided a very simple and easy-to-use interface to extract image frames from a video. Similarly, we can also create a video with image sequences with the same library.

To get started, we will first look into the lessons/lesson_3 folder.

As you can see, we have now provided the glasses_3.py and a short video clip called samsungfun.mp4 for you to test the work on.

Now, let’s start by looking into the source code itself.

  1. 1.

    Open lessons/lesson_3/glasses_3.py. This time the implementation of the discofy_video function is left to be completed. To simplify the work, we have already provided the methods supported by OpenCV for extracting frames from a video.

  2. 2.

    Replace the code from line 247 onwards with the following code.

    The code above basically read each frame from the input video and perform the mesh_overlays function discussed in Lesson 2. Then, the result is written out with the FFmpeg function. The reason that we have to perform two streams in1 and in2 is because we would like to preserve the audio stream from the original video.

  3. 3.

    To test the code, run the code on Docker with the following command with the desired video.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_3/
    discofy:sdc.local python glasses_3.py <input video path> <output video path>
            

    The <input video path> and <output video path> should be replaced by the appropriate file path such as lessons/lesson_3/samsungfun.mp4.

    Tip

    Learn more by watching the video

  4. 4.

    Run the test code and generate our test results.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_3 discofy:sdc.local pytest
  5. 5.

    Review the result from lessons/lesson_3/disco-samsungfun1.mp4

    Tip

    Learn more by watching the video

Step 4: Disco CLI

In the last two lessons, we have created pipelines to process images or videos with some of the state-of-the-art libraries and machine learning algorithms. However, as we may see quickly that these processes take a long while to analyze video footage, especially with high definition images and videos.

Here we introduce the disco command-line interface (CLI). This is one of the easiest way to get familiar with the disco interfaces that allow us to scale and offload the work to a dedicated cloud resource of your choice.

  1. 1.

    Run docker interactively. The terminal now is running under the Docker machine.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_4 discofy:sdc.local
  2. 2.

    In the same terminal from the last step, we run the following command. This will return the help menu from the disco CLI with a bit of ASCII art from disco.

    disco -h

    Now, let’s explore some of the features in the CLI. In the hello_disco.py, there is a simple print statement, and in the next step we will run the code on the disco cloud servers.

  3. 3.

    Run the hello_disco.py with disco CLI.

    disco add --name hello_job --script hello_disco.py --wait --run

    Notice the job_id [5d7f6f898d9278000a5064e2], this unique ID is going to be needed for checking the status or to download the result from the job.

  4. 4.

    To download results from the execution, run the following command

    disco view --job <your_job_id> --download

    Again, replace <your_job_id> with the appropriate job id returned by the process. Lastly, we can examine the results by extracting the downloaded results.

  5. 5.

    Extract the zip file with this command

    unzip <path to downloaded>

    In our case, the result can be found in the stdout file.

  6. 6.

    Display the output result.

    That’s it. We have just completed our first cloud-based execution without changing a single line of code.

Step 4.1: Using Disco to Perform Image Processing on the Cloud

Step 2 demonstrates a computer vision example of detecting faces, facial landmarks, and overlaying virtual eyeglasses onto a person’s face. In this lesson, we will offload the exact work to the Disco Cloud and perform such remotely with only a few lines of code changes. More importantly, with the Disco’s serverless architecture, you can scale this to 100 or 1000 times without managing the resources or making any code changes on developer’s end.

In this demo, we have created a customized docker image (with OpenCV, FFmpeg, and Dlib libraries pre-installed) that deploys by each agent running on the server. If desired, we can also setup GPU resources per server and scale even further for your jobs.

The Python script glasses_4.py provides a full-blown example of how Disco handles input and output on the server side.

Particularly, the Disco command takes the script glasses_4.py and the input image team.jpg, upload to the cloud server, and perform the processing remotely. During the executions, any data output to the ‘/local/run-result’ folder on the server side will be saved in our final result.

Upon successful execution, Disco packages the results in <job id>-<job name> folder, and we download the package back on the client side.

  1. 1.

    Run Docker interactively on the terminal. At the project root directory, we run the following command.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_4.1 discofy:sdc.local
  2. 2.

    Run the disco command to upload and run the job on the Disco cloud.

    disco add --name disco_image --script glasses_4.py --input team.jpg --wait --run --download
  3. 3.

    Extract the results (with either GUI interface or unzip command in terminal).

    unzip <job id>-<job name>/results/<job id>.zip

    As usual, we will replace <job id> and <job name> accordingly.

    The final result should match exactly what we see in Lesson 2, and that’s it.

    Tip

    Learn more by watching the video

Step 5: Using Disco to perform Video Processing on the Cloud

With the disco platform, we can now send jobs across an unlimited number of resources (devices) without the pain of managing them. Basically, compute on-demand and scale as needed. In this part of the lesson, we will demonstrate how to parallelize the video processing pipeline by splitting the work into smaller clips that can be offloaded directly to disco. For example, we can divide a ~4 minute video into 10-second clips, and process each clip in parallel and merge the results in a later step. Again, there is a trade-off on the granularity of the parallelization and it really depends on the use cases. Developers can examine this further by test running the solution with a small scale test.

Now, let’s explore how we can split videos with FFmpeg, and then how we can offload tasks to disco and merge the results back.

  1. 1.

    Run the Docker interactively.

    docker run -it -v `pwd`:/home/codelab/ -w /home/codelab/lessons/lesson_5 discofy:sdc.local
  2. 2.

    In the terminal, run the FFmpeg command to split the video into 10 second chucks.

    ffmpeg -i samsung10.mp4 -c copy -map 0 -segment_time 00:00:10 -f segment split%03d.mp4

    This command generates a set of 10 second clips as split001.mp4, split002.mp4, etc…

    Tip

    Learn more by watching the video

  3. 3.

    Create disco jobs on each video clip and process them remotely.

    disco add --name parallel_video --script glasses_5.py --wait --run --download --input "split*mp4"

    Each job ran for approximately 90 seconds on the disco resources. Each input (i.e., the video clips) is automatically distributed across the resources. On the developer side, we have zero lines of code changed to get these batches to run in parallel. Yes, it’s amazing.

    Upon completion of these tasks, the disco CLI downloads the results back to the local machine because we have provided the --download flag in the last command.

  4. 4.

    Run the commands to merge the results back with FFmpeg and some bash scripts.

    # unzip results
    cd *parallel_video/results &&
    for f in `ls *.zip`; do unzip -o $f; done
            
    # write the parts to a manifest rm -f manifest.txt;
    for f in `ls *.mp4`; do echo "file '$f'" >> manifest.txt; done
            
    # stitch back the video
    ffmpeg -f concat -safe 0 -i manifest.txt -c copy discofy_toy.mp4
            
    # move back the result to the lesson dir 
    mv discofy_toy.mp4 ../..
            
    # go back home 
    cd ../..
            

    Now, we have it, the final result can be found in lessons/lesson_5/disco-samsung.mp4

    Tip

    Learn more by watching the video

Bonus: discomp

Disco also supports multiprocessing API natively with Python. That means if you have prior experiences working with the Python MP, we can easily port the code to support MP with a single line of code changing.

This bonus lesson will demonstrate an analytics example of processing YouTube videos with the discoMP APIs that work natively with your Python code.

  1. 1.

    Learn the code by reading you_tube_face_detection.py located in lessons/lessons_6.

    The function handle_url is the entry point to analyze a video from a YouTube video URL. In the initial example, we provide a single-thread example that process these videos one at a time.

    However, there are various ways we can parallelize it in Python. Particularly, we will utilize the Pool object from the multiprocessing Python module.

    Please refer to https://docs.python.org/3/library/multiprocessing.html for additional documentation.

  2. 2.

    Run each MP version with disco. There are 4 versions of the main function:


    4 versions of the main function:

    • main_single_thread - a single-threaded main

    • main_mp - a multi-process version running locally on your computer

    • main_discomp - a multi-process version where each process handles a single video remotely on disco cloud

    • main_discomp_mp - a multi-process version where each process handles multiple videos (in parallel) remotely on disco cloud

    To run each version, we can simply comment and uncomment the relevant code in the main function.

    Show us your results and let us know how much performance gain you have squeezed out from dis.co :). This is it for our secret bonus mission. Thank you for coding.

Congratulations! You have successfully achieved the goal of this Code Lab topic. Now, you can run compute-intensive jobs and parallelize them using Dis.co by yourself!

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