Project-MONAI / MONAI

AI Toolkit for Healthcare Imaging
https://monai.io/
Apache License 2.0
5.85k stars 1.08k forks source link

Auto3D refactor code generation for each network architecture #5748

Open AHarouni opened 1 year ago

AHarouni commented 1 year ago

Currently Auto3d generates the same exact folders for each fold for each network. the only difference is hte fold arg in the config.

this causes lots of copy pasting across folds folders when there are some modifications / enhancements to add.

Ask Please simply generate single folder with scripts and code for all folds.

I also noticed the code is very similar across network architectures, may be we can factor that in also

Nic-Ma commented 1 year ago

Hi @AHarouni ,

  1. I think the initial idea of duplicating folders for every fold is to easily support user's modification for every fold separately. @mingxin-zheng @myron @dongyang0122 Please feel free to correct me if I misunderstand anything.
  2. We didn't extract the common code of all the templates because we are still in the early stage, maybe templates will have more different logic later.

Thanks.

myron commented 1 year ago

@AHarouni I completely agree with you, thank you for bringing it up.

I also think that we duplicate code for each fold, which is very inconvenient to use, as changing some parameters requires to change configs for each fold. I recommend changing that, instead of generating flat folders:

algoA_0
algoA_1
...
AlgoA_0
algoB_0

we can generate a nested structure, without duplicated code.

algoA
   fold_0
   fold_1
 algoB
   fold_0
   fold_1

I also noticed the code is very similar across network architectures, may be we can factor that in also

this is partically due to the fact that algo code lives in monai-contributions, and it's hard to import from each other. I think we can move it to the core monai/apps/auto3dset. Then we can create common superclasses to subclass.