vibalab / CNNExplorer

0 stars 0 forks source link

Remove unnecessary block of code #6

Open sungwookson opened 6 months ago

sungwookson commented 6 months ago

Currently model definition is created by using variable moduleStruct and is being used in the following lines

https://github.com/Negota/vis4cnn/blob/68068f98c3438aad3bab1ada178d7f1a2ed610ad/svelte-app/src/App.svelte#L39-L44 https://github.com/Negota/vis4cnn/blob/68068f98c3438aad3bab1ada178d7f1a2ed610ad/svelte-app/src/App.svelte#L83-L88

However, this seems unnecessary as it could be referenced from variable modelData.

I am assuming that the depth of the module is only 2 indicating (module -> layer)

The basic format of the modelStruct json will contain the following.

{
  "name": "conv",
  "layers": [
    {
      "name": "Conv2D",
    },
    {
      "name": "ReLU",
    },
    "...",
  ]
}
Negota commented 6 months ago

If we change the json struct, we need a discussion with Junha. Let's talk about this issue soon.

sungwookson commented 6 months ago

Thoughts for IR

1. Nest of nesting

{
  "name": "conv",
  "parallel": true,
  "layers": [
    {
      "name": "branch1",
      "parallel": false,
      "layers": [
        {
          "name": "Conv2D"
        }
        {
          "name": "ReLU"
        }
      ]
    },
    {
      "name": "branch2",
      "parallel": false,
      "layers": [

      ]
    },
    "...",
  ]
}

2. 2D Array

{
  "name": "conv",
  "layers": [
    [
      {
        "name": "Conv2D",
      },
      {
        "name": "ReLU",
      },
      "..."
    ],
    [
      {
        "name": "Conv2D",
      },
      {
        "name": "ReLU",
      },
      "..."
    ],
  ]
}
sungwookson commented 6 months ago

2번 2d array로 받기로 함.

sungwookson commented 6 months ago

Concat, add 어떻게 핸들링할지 논의 필요

nikriz1 commented 6 months ago

제가 구현하면서 생각해봤는데 항상 2D list 인 branches가 먼저나오고, 뒤에 add or cat으로 시작하는 1D list layers가 나오게 하면 어떨까요? (conv/linear 등은 layers만 사용, residual/inception은 branches+layers 둘 다 사용)

model_info

[module_dict, ...]

module_dict

{
  "name": "residual_1",
  "type": "residual",
  "branches": [[conv_info, ...], 
               [conv_info, ...], ...],
  "layers": [add_info, relu_info]
}

layer_info

{
  "layer_type": "add",
  "input": [...], "output": [...],
  "input_index": [...], "output_index": [...],
  ...
}