Skip to content

Guides | TANGO Architecture

giantlkh edited this page Oct 12, 2022 · 25 revisions

TANGO Architecture


👉Note

  • This page contains some wide rendered images. If you want to see the whole contents with wider page, please use Wide GitHub extension of Chrome.
  • If you are experiencing the error on rendered images due to the low-bandwith Internet delay, please use F5 function key for refreshing current page.

Introduction

TANGO (Taget Adaptive No Code Nueral Network Generation and Operation framework) is for novices on machine learning and deep learning area. It aims to provide easy and no-code based AI application build tool for novices who have some datasets but know how to utilize them for AI application. It is based on MSA (Mircro Service Architecture) technology, especially Docker containers.

Containers in TANGO

In TANGO, there are two types of containers:

  • A Main Container : Project Manager, which makes other containers start or stop as well as coordinates them to proceed workflow.
  • One or More Member Containers: All containers except for Project Manager, which perform specific tasks in whole workflow.

Main Container

Project Manager container (after here, simply Project Manager) provides project configuration and execution of workflow defined in the project configuration for login user. Here, project means the TANGO project, which provide No code based automatic neural network model generation, based on the user's deployment target HW and dataset, and deployment to the designated target HW with optimized neural network model for AI applications.

At TANGO project creation phase, users configure following information and save it.

  • Dataset: custom dataset or public dataset (e.g., COCO dataset ).
  • Target Device: on which the optimized neural network code deployed.
  • User's customized workflow, user can use following task selectively
    • NAS (Network Architecture Search) type used in auto_nn ** Backbone NAS or Neck NAS
    • use of visualizer for adding your own enhancement on the model generated from the auto_nn phase

Upon completion of TANGO project creation, Project Manager coordinates the TANGO workflow; start, monitoring result of the member container execution for specific task and start next task if the previous task was successfully completed .

  • Project Manager iterates over tasks one by one as defined in the workflow of TANGO project by starting corresponding member container.

Member Containers

Currently, TANGO consists of following member containers;

  • labelling: provides functionality to prepare user's own dataset annotation suitable for classification and detection tasks and COCO dataset import.
  • base_model_select: suggests the basic neural network model suitable for user's dataset.
  • auto_nn: generate an automatic neural network based on the neural network model selected from base_model_select and deploy target information defined project configuration.
    • auto_nn consists of Neck NAS (Network Architecture Search) and Backbone NAS. User select which NAS used for auto_nn
  • visualizer: provides editing functionally on the model from auto_nn, if user select this feature in the workflow defined in project configuration.
  • code_gen: generates template codes around the model, passed from auto_nn or visualizer, for use in deployment target.
  • deploy : deploys the generated code in code_gen on the specific target selected at project configuration
    • deploy consists of of cloud_deploy xor ondevice_deploy, which can be selected based on the user's choice on the target.

From TANGO Project Creation To Deployment onto Target Devices

The following flowchart illustrates the whole process of TANGO from Project Creation to Deployment of Codes onto the Target Devices.

flowchart TB
  
   subgraph P[TANGO Project Creation]
     P1[Service Container Readiness Check]
     P2[Project Configuration]
     P1 --> P2
     P2 --> P21[Dataset Select] & P22[Target Select] --> P3[Workflow Configuration]
     P3 --> P4[Save Project]
   end
   
   S([Start]) --> P1
    
   subgraph W[TANGO Workflow]
     
     subgraph BMS[Base Model Select]
       P4 --> W1[1. Base Model Select]
     end

     W1 --> C{Customize NN?}
     C-->|Yes|V[Visualizer]
     C -->|No| A1{NAS Type?}
     V-->A1

     subgraph A[2. AutoNN]
       A1 -->|Neck NAS| A21[AutoNN based on Neck NAS] 
       A1 -->|Backbone NAS| A22[AutoNN based on Backbone NAS]
     end


     
     subgraph CG[3. Code Generation]
        
        A21 & A22 --> W5[Code Generation]
     end
     
     subgraph D[4 Code Deployment]
       W5--> W6{Deployment Target?}

       W6 -->|Cloud Target| W71[Cloud Deploy] 
       W6 -->|OnDevice Target| W72[OnDevice Deploy]
     end

    end

   W71 & W72 --> E([End])
Loading

Above flowchart was prepared with mermaid using Mermaid Online Editor

Overall Control Flow in TANGO Project

The following Sequence Diagram summarizes the overall control flow among containers within TANGO project.

sequenceDiagram
    participant DC as Docker Compose
    participant PM as Project Manager
    participant LB as Labelling
    participant BMS as Base Model Select
    participant MV as Vis2Code
    participant ANN as AutoNN
    participant CG as Code Gen
    participant CD as Cloud Deploy
    participant OD as OnDevice Deploy
    
    activate DC

    %%TANGO Container Image Build
    rect rgba(211, 211, 211, 0.3)
      Note over DC : Build Container Images for TANGO           
    end 

    Note over DC, OD: TANGO Containers Instance Creation
    rect rgba(211, 211, 211, 0.3)
      Note right of DC : Start/Run Service Containers for TANGO 
      DC->>PM : docker run Project Manager
      DC->>LB : docker run Labelling
      DC->>BMS : docker run Base Model Selector
      DC->>MV : docker run Vis2Code        
      DC->>ANN : docker run AutoNN   
      DC->>CG : docker run Code Gen
      DC->>CD : docker run Cloud Deploy
      DC->>OD : docker OnDevice Deploy
    end 

    deactivate DC

    Note over PM, OD: TANGO Project Configuration
    rect rgba(127, 255, 212, 0.3)
      activate PM
      rect rgba(211, 211, 211, 0.3)
          Note right of PM: Member Containers Health Check
          PM ->> LB : status_request(user_id="", project_id="")
          LB-->>PM: HTTP response 200 OK with text/plain "ready"

          PM ->> MV : status_request(user_id="", project_id="")
          MV-->>PM: HTTP response 200 OK with text/plain "ready"

          PM ->> BMS : status_request(user_id="", project_id="")
          BMS-->>PM: HTTP response 200 OK with text/plain "ready"

          PM ->> ANN : status_request(user_id="", project_id="")
          ANN-->>PM: HTTP response 200 OK with text/plain "ready"

          PM ->> CG : status_request(user_id="", project_id="")
          CG-->>PM: HTTP response 200 OK with text/plain "ready"

          PM ->> CD : status_request(user_id="", project_id="")
          CD-->>PM: HTTP response 200 OK with text/plain "ready"

          PM ->> OD : status_request(user_id="", project_id="")
          OD-->>PM: HTTP response 200 OK with text/plain "ready"
      end


      Note right of PM: Project Creation: Dataset and Target Configuration

      rect rgba(211, 211, 211, 0.3)
        opt Dataset Preparation
            activate LB
            Note right of LB: User defined Dataset labelling
            deactivate LB
        end

        loop
            Note over PM: Dataset Selection 
            PM->>PM: 

            Note over PM: Target Selection 
            PM->>PM: 
        end
      end  %% of rect rgba
    end %% of Project Creation rect rgba(255, 95, 71, 0.7) 

    rect rgba(0, 255, 255, 0.3) 
      Note over PM, OD: TANGO Workflow based-on Project Settings
      %% ====================
      %% 1. Base Model Select
      %% ====================
      Note over PM, BMS: 1. Base Model Select
      PM->>BMS: start(user_id=uid, prj_id=pid) 
      BMS-->>PM: HTTP response with "starting"
      activate BMS

      rect rgba(211, 211, 211, 0.3)
        loop Every heartbeat period in Project Manager
            PM->>BMS: status_request(user_id=uid, project_id=pid)
            BMS-->>PM: HTTP response 200 OK with text/plain "running"
        end
      end 

      alt Base Model Select Service Fail
          %% Base Model Select Fail
          rect rgba(255, 95, 71, 0.7) 
            break When Base Model Select Fails
            Note over BMS: Base Model Select Fails
            BMS->>PM:status_report(container_id="bms", user_id=uid, project_id=pid, result="failed")
            end
          end

          Note right of PM: Workflow Fails at AutoNN

      else Base Model Select Success
          %% Base Model Select Success
          rect rgba(173, 255,47, 0.7) 
              Note over BMS: Base Model Select Success
              BMS->>PM:status_report(container_id="bms", user_id=uid, project_id=pid, result="success")
              Note right of PM: Base Model Select Completes, Continue to directly AutoNN or via Visualizer
          end


         deactivate BMS
 
         %% ======================================
         %% Optional: Base Model Customization
         %% ======================================
         rect rgba(0, 206, 209, 0.3)
            Note over PM, MV: Optional: Base Model Customization 
            PM->>MV: start(user_id=uid, prj_id=pid) 
            MV-->>PM: HTTP response with "starting"

            rect rgba(211, 211, 211, 0.3)
                    activate MV
                    rect rgba(211, 211, 211, 0.3)
                        loop Every heartbeat period in Project Manager
                            Note over MV: Base Model Customization
                            MV->>MV: 
                            PM->>MV: status_request(user_id=uid, project_id=pid)
                            MV-->>PM: HTTP response 200 OK with text/plain "running"
                        end %% loop
                    end %% rect
            end %% rect

            rect rgba(255, 95, 71, 0.7) 
                Note over MV: Base Model Customization Fail
                MV->>PM:status_report(container_id="vis2code", user_id=uid, project_id=pid, result="fail")
            end
            Note right of PM: Workflow Fail at Base Model Customization

            rect rgba(173, 255,47, 0.7) 
                Note over MV: Base Model Customization Complete
                MV->>PM:status_report(container_id="vis2code", user_id=uid, project_id=pid, result="success")
            end
            Note right of PM: Base Model Customization Completes, Continue to AutoNN

         end %% rect for Optional: Base Model Customization
          

          %% ====================
          %% 2. AutoNN
          %% ====================
          Note over PM, ANN: 2. AutoNN

          PM->>ANN: start(user_id=uid, prj_id=pid) 
          ANN-->>PM: HTTP response with "starting"
          activate ANN

          rect rgba(211, 211, 211, 0.3)
            loop Every heartbeat period in Project Manager
                PM->>ANN: status_request(user_id=uid, project_id=pid)
                ANN-->>PM: HTTP response 200 OK with text/plain "running"
            end %% end of loop
          end

          alt AutoNN Fail
              %% AutoNN Fail
              rect rgba(255, 95, 71, 0.7) 
                break When AutoNN Fails
                    Note over ANN: AutoNN Fail
                    ANN->>PM:status_report(container_id="autonn", user_id=uid, project_id=pid, result="failed")
                end
              end

              Note right of PM: Workflow Fails at AutoNN

          else AutoNN Success
              %% AutoNN Success
              rect rgba(173, 255,47, 0.7) 
                  Note over ANN: AutoNN Success
                  ANN->>PM:status_report(container_id="autonn", user_id=uid, project_id=pid, result="success")
                  deactivate ANN
              end 
              Note right of PM: AutoNN Completes, Continue to Code Gen

              %% ====================
              %% 3. Code Gen
              %% ====================
              Note over PM, CG: 3. Code Gen

              PM->>CG: start(user_id, prj_id)  
              CG-->>PM: HTTP response with "starting"

              activate CG

              rect rgba(211, 211, 211, 0.3)
                  loop Every heartbeat period in Project Manager
                      PM->>CG: status_request(user_id=uid, project_id=pid)
                      CG-->>PM: HTTP response 200 OK with text/plain "running"
                  end
              end
    
              alt Code Gen Fails
                  %% Code Gen Fails
                  rect rgba(255, 95, 71, 0.7) 
                      break When Code Gen Fails
                          Note over CG: Code Gen Fail
                          CG->>PM:status_report(container_id="code_gen", user_id=uid, project_id=pid, result="failed")
                      end
                  end

                  Note right of PM: Workflow Fails at Code Gen

              else Code Gen Success
                  %% Code Gen Success

                  rect rgba(173, 255,47, 0.7) 
                      Note over CG: Code Gen Success
                      CG->>PM:status_report(container_id="code_gen", user_id=uid, project_id=pid, result="success")
                      deactivate CG
                  end 
                      Note right of PM: Code Gen Completes, Continue to Deployment

                  %% ====================
                  %% 4. Deployment
                  %% ====================
                  Note over PM, OD: 4. Deployment

                  alt Deployment to Cloud Target
                      %% ====================
                      %% 4.1 Cloud Deployment
                      %% ====================
                      Note over PM, CD: 4.1 Cloud Deployment
                      PM->>CD: start(user_id, prj_id)  
                      CD-->>PM: HTTP response with "starting"

                      activate CD

                      rect rgba(211, 211, 211, 0.3)
                          loop Every heartbeat period in Project Manager
                              PM->>CD: status_request(user_id=uid, project_id=pid)
                              CD-->>PM: HTTP response 200 OK with text/plain "running"
                          end  %% end of loop
                      end
                
                      alt Cloud Deployment Fail
                          %% Cloud Deployment Fail
                          rect rgba(255, 95, 71, 0.7) 
                              break When Cloud Deployment Fail
                                  Note over CD: Cloud Deployment Fails
                                  CD->>PM:status_report(container_id="cloud_deployment", user_id=uid, project_id=pid, result="failed")
                              end %% end of break
                          end %% of rect
                          Note right of PM: Workflow Fails at Cloud Deployment
                      else Cloud Deployment Success
                          %% Cloud Deployment Success
                          rect rgba(173, 255,47, 0.7) 
                              Note over CD: Cloud Deployment Success
                              CD->>PM:status_report(container_id="cloud_deployment", user_id=uid, project_id=pid, result="success")
                              deactivate CD
                          end %% end of rec
                      end %% end of alt Cloud Deployment Fail/Success
                      Note right of PM: Complete Workflow         
                  else Deployment to OnDevice Target
                      %% ====================
                      %% 4.2 OnDevice Deployment
                      %% ====================
                      Note over PM, OD: 4.2 Start OnDevice Deployment
                      PM->>OD: start(user_id, prj_id)  
                      OD-->>PM: HTTP response with "starting"
                      activate OD

                      rect rgba(211, 211, 211, 0.3)
                          loop Every heartbeat period in Project Manager
                              PM->>OD: status_request(user_id=uid, project_id=pid)
                              OD-->>PM: HTTP response 200 OK with text/plain "running"
                          end  %% end of loop
                      end
                
                      alt OnDevice Deployment Fail
                          %% OnDevice Deployment Fail
                          rect rgba(255, 95, 71, 0.7) 
                              break When Cloud Deployment Fails
                                  Note over OD: OnDevice Deployment Fail
                                  OD->>PM:status_report(container_id="ondevice_deployment", user_id=uid, project_id=pid, result="failed")
                              end %% end of break
                          end %% end of rect

                          Note right of PM: Workflow Fails at OnDevice Deployment

                      else OnDevice Deployment Success
                          %% OnDevice Deployment Success
                          rect rgba(173, 255,47, 0.7) 
                              Note over OD: OnDevice Deployment Successfully Completes!
                              OD->>PM:status_report(container_id="ondevice_deployment", user_id=uid, project_id=pid, result="success")
                              deactivate OD
                          end 

                          Note right of PM: Complete Workflow
                      end %% end of alt else for OnDevice Deployment Fail/Success             

                  end %% end of alt else for Cloud/On-Device Deployment

              end %% end of alt else for Code Gen Fail/Success
          end %% end of alt else for AutoNN Fail/Success
      end %%  end of alt else for BMS
    end %% TANGO Workflow rect rgba(0, 255, 255, 0.3) 
Loading

Above sequence diagram was prepared with mermaid using Mermaid Online Editor