{"id":9448,"date":"2025-05-20T13:17:48","date_gmt":"2025-05-20T04:17:48","guid":{"rendered":"https:\/\/shinko-sj.co.jp\/?page_id=9448"},"modified":"2025-05-20T16:55:07","modified_gmt":"2025-05-20T07:55:07","slug":"replacement_06","status":"publish","type":"page","link":"https:\/\/shinko-sj.co.jp\/en\/related-articles\/replacement_06\/","title":{"rendered":"I replaced a different company&#039;s GPU with SiMa.ai! [Implementation]"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"500\" height=\"435\" src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/sima_chip.png\" alt=\"\" class=\"wp-image-9453\" style=\"width:300px\" srcset=\"https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/sima_chip.png 500w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/sima_chip-300x261.png 300w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/sima_chip-14x12.png 14w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/figure><\/div>\n\n\n<p>SiMa.ai (hereinafter referred to as SiMa) is a device with strengths in edge AI, rivaling the performance of Alpha Inc., a company that provides GPUs (graphics processing units). There are also voices expressing interest in actually using SiMa's MLSoC (Machine Learning System-on-Chip). In this article, we will introduce how to port a model that was running on Alpha Inc.'s GPU to SiMa and actually run it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading heading_01\">Overall Table of Contents<\/h2>\n\n\n\n<p>The transplant procedure is as follows:<\/p>\n\n\n\n<div class=\"wp-block-columns mokuji_wrap is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"blueback\">Step 1: Overview<\/p>\n\n\n\n<div class=\"wp-block-group mokuji_thumb\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"567\" src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_01.png\" alt=\"\" class=\"wp-image-9454\" srcset=\"https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_01.png 567w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_01-300x300.png 300w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_01-150x150.png 150w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_01-12x12.png 12w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n<\/div><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"\/en\/related-articles\/replacement_01\/\" title=\"\">Overview<\/a><\/li>\n<\/ul>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"blueback\">Step-2: Preparation<\/p>\n\n\n\n<div class=\"wp-block-group mokuji_thumb\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"567\" src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_02.png\" alt=\"\" class=\"wp-image-9455\" srcset=\"https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_02.png 567w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_02-300x300.png 300w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_02-150x150.png 150w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_02-12x12.png 12w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"\/en\/related-articles\/replacement_02\/\" title=\"\">Preparation<\/a><\/li>\n<\/ul>\n<\/div><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"blueback\">Step 3: Environment setup<\/p>\n\n\n\n<div class=\"wp-block-group mokuji_thumb\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"567\" src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_03.png\" alt=\"\" class=\"wp-image-9456\" srcset=\"https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_03.png 567w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_03-300x300.png 300w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_03-150x150.png 150w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_03-12x12.png 12w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"\/en\/related-articles\/replacement_02\/\" title=\"\"><\/a><a href=\"\/en\/related-articles\/replacement_03\/\" title=\"\">Environment setup part 1<\/a><\/li>\n\n\n\n<li><a href=\"\/en\/related-articles\/replacement_04\/\" title=\"\">Environment setup part 2<\/a><\/li>\n\n\n\n<li><a href=\"\/en\/related-articles\/replacement_05\/\" title=\"\">Environment setup part 3<\/a><\/li>\n<\/ul>\n<\/div><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p class=\"blueback\">Step 4: Implementation<\/p>\n\n\n\n<div class=\"wp-block-group mokuji_thumb\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"567\" src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_04.png\" alt=\"\" class=\"wp-image-9457\" srcset=\"https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_04.png 567w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_04-300x300.png 300w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_04-150x150.png 150w, https:\/\/shinko-sj.co.jp\/wp2024\/wp-content\/uploads\/2025\/05\/flow_icon_04-12x12.png 12w\" sizes=\"(max-width: 567px) 100vw, 567px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Implementation<\/li>\n<\/ul>\n<\/div><\/div>\n<\/div>\n<\/div>\n\n\n\n<h2 class=\"wp-block-heading heading_01\">Goal of this chapter &quot;Implementation&quot;<\/h2>\n\n\n\n<ul class=\"wp-block-list dot_ul large_ul\">\n<li>Learn how to build a system using the SiMa development kit<\/li>\n<\/ul>\n\n\n\n<p>The results of this demo video are as follows:<\/p>\n\n\n\n<div class=\"wp-block-columns extrapages_movie_wrap is-layout-flex wp-container-core-columns-is-layout-2 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-video\"><video controls src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/movie_a.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"has-text-align-center\">Alpha company video<\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<figure class=\"wp-block-video\"><video controls src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/movie_sima.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"has-text-align-center\">SiMa Video<\/p>\n<\/div>\n<\/div>\n\n\n\n<p class=\"has-text-align-center bg_blue mgt50\" id=\"anchor01\" style=\"font-size:26px\"><strong>Implementing the application<\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center mgt30\">This time, we finally tracked the movements of people running on Alpha&#039;s GPU.<br>We will use SiMa to build a system that will perform heat map analysis of stay patterns.<\/p>\n\n\n\n<h4 class=\"wp-block-heading heading_03 mgt30\">The general process leading up to implementation<\/h4>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong><code><mark class=\"has-inline-color has-vivid-cyan-blue-color\"> Clone YoloV7 demo<\/mark><\/code><\/strong><br>There are some demo programs provided by SiMa in the app_zoo directory. In this case, the YoloV7 demo is the closest, so we will duplicate that folder and add the desired functions.<\/li>\n\n\n\n<li><strong><code><mark class=\"has-inline-color has-vivid-cyan-blue-color\"> Implemented heatmap drawing method in CvHelpers<\/mark><\/code><\/strong><br>In the plugin_zoo directory, there is the source code for the C++ Gstreamer overlay plugin provided by SiMa. Since it uses a helper class called CvHelpers that utilizes OpenCV, add the draw_heatmap method to the CvHelpers class to enable heatmap drawing processing.<\/li>\n\n\n\n<li><strong><code><mark class=\"has-inline-color has-vivid-cyan-blue-color\"> Added heatmap option to overlay plugin<\/mark><\/code><\/strong><br>The specification is that the overlay plugin takes the render-rules argument and performs arbitrary drawing based on the results processed by SiMa&#039;s MLA. Here, we will modify the overlay plugin in application.json to specify the heatmap option when calling it.<\/li>\n\n\n\n<li><strong><code><mark class=\"has-inline-color has-vivid-cyan-blue-color\"> Build and deploy<\/mark><\/code><\/strong><br>We will build the modified overlay plugin and build and deploy the application using the MPK tool.<\/li>\n\n\n\n<li><strong><code><mark class=\"has-inline-color has-vivid-cyan-blue-color\"> Play video sent via UDP on the host machine<\/mark><\/code><\/strong><br>This time, video data is sent to UDP port 9000 to the host machine&#039;s IP address, so it is received and played by Gstreamer.<\/li>\n<\/ol>\n\n\n\n<p class=\"grey mgt30\">Note that all of the above procedures are assumed to be executed within the Docker container created in the \"Building the host machine environment\" chapter.<\/p>\n\n\n\n<h4 class=\"wp-block-heading heading_03\">Implementing heatmap in library and calling it<\/h4>\n\n\n\n<h5 class=\"wp-block-heading heading_04\">Clone YoloV7 demo<\/h5>\n\n\n\n<p>To clone the YoloV7 demo located in the app_zoo directory, run the following command:<br>In addition, since many folders have fixed file path values, we also perform a mass replacement of path names.<\/p>\n\n\n\n<div class=\"wp-block-group code\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-code\"><code>sima-user@docker-image-id:\/home$ cd \/usr\/local\/simaai\/app_zoo\/Gstreamer\/ cp -r YoloV7 YoloV7_heatmap_demo sima-user@docker-image-id:\/home$ find YoloV7_heatmap_demo -type f \\( -name &quot;*.json&quot; -o -name &quot;*.sh&quot; \\) -exec sed -i &#039;s\/YoloV7\/YoloV7_heatmap_demo\/g&#039; {} \\; -print sima-user@docker-image-id:\/home$ find YoloV7_heatmap_demo -type f \\( -name &quot;*.json&quot; -o -name &quot;*.sh&quot; \\) -exec sed -i &#039;s\/yoloV7\/yoloV7_heatmap_demo\/g&#039; {} \\; -print<\/code><\/pre>\n<\/div><\/div>\n\n\n\n<h5 class=\"wp-block-heading heading_04\">Implemented heatmap drawing method in CvHelpers<\/h5>\n\n\n\n<p>Add the draw_heatmap method to the CvHelpers class to handle heatmap drawing.<br>The source code modifications are as follows:<\/p>\n\n\n\n<div class=\"wp-block-group mgt30 align_center\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"has-text-align-center linkbtn\"><a href=\"\/wp2024\/wp-content\/uploads\/2025\/05\/cv_helpers.zip\" title=\"\"><span>download<\/span><\/a><\/p>\n<\/div><\/div>\n\n\n\n<p class=\"grey mgt30\">Since we are only using NV12 this time, the only thing we are actually implementing is the concrete class CvHelpersNV12 class, but it can also be used with YUV420 by making a similar implementation for the CvHelpersYUV420 class.<\/p>\n\n\n\n<h5 class=\"wp-block-heading heading_04\">Added heatmap option to overlay plugin<\/h5>\n\n\n\n<p>We will modify the overlay plugin to specify the heatmap option when calling it.<br>The source code modifications are as follows:<br>Please modify the camera&#039;s rstp server information, such as location=rtsp:\/\/192.168.2.10:5005\/routecam, in the gst of application.json as appropriate to match the specifications of your camera.<\/p>\n\n\n\n<div class=\"wp-block-group mgt30 align_center\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"has-text-align-center linkbtn\"><a href=\"\/wp2024\/wp-content\/uploads\/2025\/05\/application.zip\" title=\"\"><span>download<\/span><\/a><\/p>\n<\/div><\/div>\n\n\n\n<h5 class=\"wp-block-heading heading_04\">Build and deploy<\/h5>\n\n\n\n<p>To build after adding the plugin, run the following command.<br>Plugins need to be built separately from the normal build procedure using the MPK tools.<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sima-user@docker-image-id:\/home$ cd \/usr\/local\/simaai\/plugin_zoo\/a65-apps\/build &amp;&amp; source \/opt\/poky\/4.0.10\/environment-setup-cortexa65-poky-linux &amp;&amp; cmake -DCMAKE_INSTALL_PREFIX=\/opt\/poky\/4.0.10\/sysroots\/cortexa65-poky-linux\/usr\/ .. &amp;&amp; sudo make install<\/code><\/pre>\n\n\n\n<p class=\"grey mgt30\">*The path specified in DCMAKE_INSTALL_PREFIX is the same as the path where the MPK tool searches for the built so files of the plugins required for building, so it is specified to be output to that path.<\/p>\n\n\n\n<p class=\"grey mgt30\">*This time we are building them all at once, but it is also possible to build only the plugins you want to build.<\/p>\n\n\n\n<p class=\"mgt30\">Next, to deploy, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code code mgt20\"><code>sima-user@docker-image-id:\/home$ PIPELINE_PATH=&#039;\/usr\/local\/simaai\/app_zoo\/Gstreamer\/YoloV7_heatmap_demo&#039; &amp;&amp; mpk device connect -t sima@192.168.2.10 &amp;&amp; mpk kill -i yoloV7_heatmap_demo_Pipeline &amp;&amp; mpk remove -a com.sima.awesome_app -t 192.168.2.10 &amp;&amp; mpk create -s $PIPELINE_PATH -d $PIPELINE_PATH &amp;&amp; mpk deploy -f $PIPELINE_PATH\/project.mpk -t 192.168.2.10<\/code><\/pre>\n\n\n\n<p class=\"grey mgt30\">The overlay plugin is built automatically when you create it with the MPK tool, so there is no need to run the make command separately to build it.<\/p>\n\n\n\n<p class=\"grey mgt30\">If the build or deployment does not go well, it is a good idea to check the error logs that are output to \/var\/log\/simaai\/.<\/p>\n\n\n\n<h5 class=\"wp-block-heading heading_04\">Play video sent via UDP on the host machine<\/h5>\n\n\n\n<p>To play the video data, please execute the following command.<\/p>\n\n\n\n<pre class=\"wp-block-code code\"><code>sima-user@sima-user-machine:~$ gst-launch-1.0 udpsrc port=9000 caps=&quot;application\/x-rtp, encoding-name=H264, payload=96&quot; ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! autovideosink<\/code><\/pre>\n\n\n\n<p class=\"grey mgt30 mgb30\">Please check whether port 9000 is allowed on the host machine. If it is not allowed, please change the port or allow it.<\/p>\n\n\n\n<p>The result is the following video:<\/p>\n\n\n\n<div class=\"wp-block-group extrapages_movie_wrap2\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<figure class=\"wp-block-video\"><video controls src=\"\/wp2024\/wp-content\/uploads\/2025\/05\/movie_sima.mp4\"><\/video><\/figure>\n<\/div><\/div>\n\n\n\n<p class=\"mgt30\">By completing the steps above, the porting from Alpha&#039;s GPU to the SiMa.ai MLSoC has been completed.<br>I believe that Alpha has confirmed that the porting can be completed successfully.<br>We hope that you will be able to experience the actual performance throughout all chapters and use this information in your future development.<\/p>\n\n\n\n<p>If you have any questions about this chapter, please contact us using the information below.<\/p>\n\n\n\n<div class=\"wp-block-group wrap_mail grey\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><a href=\"mailto:ml_sima.ai@st.shinko-sj.co.jp\" title=\"\"><span>Purchase the development kit here<\/span><\/a><\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-columns pagebottom_link is-layout-flex wp-container-core-columns-is-layout-3 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<p><a href=\"\/en\/related-articles\/replacement_05\/\" title=\"\">I replaced another company&#039;s GPU with SiMa.ai!<br>[Environment Construction Part 3]<\/a><\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<h2 class=\"wp-block-heading heading_01\"><strong>Company Profile<\/strong><\/h2>\n\n\n\n<dl class=\"dl_em10\">\n\t<dt>Company Name<\/dt>\n\t<dd>SiMa Technologies, Inc.<\/dd>\n\t<dt>Established<\/dt>\n\t<dd>2018<\/dd>\n\t<dt>location<\/dt>\n\t<dd>America (Silicon Valley)<\/dd>\n\t<dt>business<\/dt>\n\t<dd>Providing SoC and SDK specialized for image processing edge AI<\/dd>\n<\/dl>\n<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>SiMa.ai (hereinafter referred to as SiMa) is an edge computing platform that is comparable in performance to that of Alpha Inc., a company that provides GPUs (graphics processing units).<\/p>","protected":false},"author":1,"featured_media":0,"parent":9226,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"page_product_otherpage.php","meta":{"_acf_changed":false,"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"class_list":["post-9448","page","type-page","status-publish","hentry"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/pages\/9448"}],"collection":[{"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/comments?post=9448"}],"version-history":[{"count":6,"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/pages\/9448\/revisions"}],"predecessor-version":[{"id":9503,"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/pages\/9448\/revisions\/9503"}],"up":[{"embeddable":true,"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/pages\/9226"}],"wp:attachment":[{"href":"https:\/\/shinko-sj.co.jp\/en\/wp-json\/wp\/v2\/media?parent=9448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}