About Deep Learning (DNN) Project Management

Introduction

I am doing research using DNN.

After a year, I feel like I've finally found the best practice for project management, so I'll expose it.

environment

Since Onedrive is insurance when a file suddenly blows off, I think that GitHub is basically enough.

Directory structure

program/
  ├ dataset/
  │   ├ dev/
  │   └ test/
  └ src/
      ├ common/
      │   ├ hoge.py
      │   ├ fuga.py
      │   ├ ...
      ├ method_xxx/
      │   ├ output/
      │   │   ├ YYYYMMDD_ID/
      │   │   │  ├ loss/
      │   │   │  │   ├ training_loss.npy
      │   │   │  │   └ validation_loss.npy
      │   │   │  ├ prediction/
      │   │   │  │   ├ img/
      │   │   │  │   ├ wav/
      │   │   │  │   ├ ...
      │   │   │  ├ condition.json
      │   │   │  ├ model.pth
      │   │   │  └ network.txt
      │   │   ├ YYYYMMDD_ID/
      │   │   ├ ...
      │   ├ generate_dataset.py
      │   ├ dataset_loader.py
      │   ├ dnn_model.py
      │   ├ dnn_training.py
      │   ├ dnn_evaluation.py
      │   ├ training_config.json
      │   └ evaluation_config.json
      ├ method_zzz/
      ├ ...

Description of each folder / file

Output DNN model structure



class Model(nn.Module):
    def __init__(self, in_units, hidden_units, out_units):
        super(Model, self).__init__()
        self.l1 = nn.Linear(in_units, hidden_units)
        self.a1 = nn.ReLU()
        self.l2 = nn.Linear(hidden_units, hidden_units)
        self.a2 = nn.ReLU()

    def forward(self, x):
        x = self.a1(self.l1(x))
        y = self.a2(self.l2(x))

        return y

#Export network information for DNN model(.txt)
model = Model(in_size, hidden_size, out_size)
with open(OUT_DIR_NAME+'/network.txt', 'w') as f:
    f.write(str(model))

network.txt


Model(
  (l1): Linear(in_features=8546, out_features=682, bias=True)
  (a1): ReLU()
  (l2): Linear(in_features=682, out_features=682, bias=True)
  (a2): ReLU()
)

About json files

Learning parameter settings, model evaluation, and experimental results are managed in a json file. The contents of each are as follows.

training_config.json


{
    "method": "A detailed explanation of the method is described here.",
    "parameters": {
        "max_epochs": 1000,
        "batch_size": 128,
        "optimizer": "adam",
        "learning_rate": 0.001,
        "patience": 50,
        "norm": true
    },
    "datasets": {
        "data1": "../../dataset/dev/<file1_name>",
        "data2": "../../dataset/dev/<file2_name>"
    }
}

evaluation_config.json


{
    "target_dir": "YYYYMMDD_ID",
    "src_dir": {
        "file1": "../../dataset/test/<file1_name>",
        "file2": "../../dataset/test/<file2_name>"
    },
    "output_dir": "OUTPUT_DIR_NAME"
}

condition.json


{
    "method": "Explanation of the method",
    "parameters": {
        "max_epochs": 345,
        "batch_size": 128,
        "optimizer": "adam",
        "learning_rate": 0.001,
        "patience": 50,
        "norm": true
    },
    "datasets": {
        "data1": "../../dataset/dev/<file1_name>",
        "data2": "../../dataset/dev/<file1_name>",
    },
    "dnn": {
        "input_size": 8546,
        "output_size": 682
    },
    "loss": {
        "training_loss": 0.087654,
        "validation_loss": 0.152140
    }
}

Regarding the evaluation of DNN performance, ʻevaluation.json is read first, the target folder is specified from target_dir, and the parameters etc. are acquired from condition.json` in it.

the end

After some twists and turns, I settled on this kind of management method, but please tell me if there is a better management method ...

Recommended Posts

About Deep Learning (DNN) Project Management
Deep Learning
About data expansion processing for deep learning
[Deep Learning from scratch] About hyperparameter optimization
Deep Learning Memorandum
Start Deep learning
Python Deep Learning
Deep learning × Python
Thinking about party attack-like growth tactics using deep learning
First Deep Learning ~ Struggle ~
A story about predicting exchange rates with Deep Learning
Deep Learning from scratch
Deep learning 1 Practice of deep learning
Deep learning / cross entropy
First Deep Learning ~ Preparation ~
First Deep Learning ~ Solution ~
[AI] Deep Metric Learning
I tried deep learning
DNN (Deep Learning) Library: Comparison of chainer and TensorFlow (1)
Python: Deep Learning Tuning
Learning Deep Forest, a new learning device comparable to DNN
Deep learning large-scale technology
Deep learning / softmax function
A story about a 40-year-old engineer manager passing "Deep Learning for ENGINEER"
I captured the Touhou Project with Deep Learning ... I wanted to.
Deep Learning from scratch 1-3 chapters
Try deep learning with TensorFlow
<Course> Deep Learning: Day2 CNN
Deep learning image recognition 1 theory
Deep running 2 Tuning of deep learning
About learning with google colab
Deep learning / LSTM scratch code
Rabbit Challenge Deep Learning 1Day
<Course> Deep Learning: Day1 NN
Deep Kernel Learning with Pyro
Try Deep Learning with FPGA
Deep learning for compound formation?
Introducing Udacity Deep Learning Nanodegree
About machine learning mixed matrices
Subjects> Deep Learning: Day3 RNN
Introduction to Deep Learning ~ Learning Rules ~
Rabbit Challenge Deep Learning 2Day
Deep Reinforcement Learning 1 Introduction to Reinforcement Learning
About data management of anvil-app-server
Deep reinforcement learning 2 Implementation of reinforcement learning
Generate Pokemon with Deep Learning
Introduction to Deep Learning ~ Backpropagation ~
Under investigation about PYNQ-Let's do deep learning with FPGA using Python-