Deep Learning with Pytroch: From Beginner to Practice

Table of contents

Basic task flow:

data flow

Model building

training function, validation function

optimizer

loss function

Weight saving and loading

Saving of run log files


When we write a deep learning project, we need to understand the general process of deep learning

Basic task flow:

  1. data flow

    1. File partitioning (training, validation file paths and corresponding labels)
    2. Override of Dataset class
      1. __len__ override
      2. __getitem__ override
    3. Encapsulation of Dateloader
      1. Dataset
      2. Batchsize
      3. Shuffle - whether to shuffle (in the validation set, no need to shuffle)

  1. Model building

  2. training function, validation function

    1. training function
    2. validation function
      1. Don't need gradient, you can use decorator @torch.no_grad()/with torch.on_grad()
      2. Get the accuracy and loss values
  3. optimizer

    1. torch.optim
  4. loss function

    1. Torch.nn. CrossEntropyLoss()
  5. Weight saving and loading

  6. Saving of run log files

Supongo que te gusta

Origin blog.csdn.net/weixin_43507744/article/details/126728059
Recomendado
Clasificación