Answers.Body: <p>If your goal is to predict given an image multiple labels (each of them can be binary or multi-class) you could consider two strategies:</p>
  <ul>
  <li>Create for each classification task a separate model, which predicts solves only one problem</li>
  <li>Create a single model with multiple heads</li>
  </ul>
  <p><strong>The first option</strong> seems to be more straightforward, but it would most likely need to consume more memory and computational resources, and the gradient signal from the prediction of one model is independent of other models. In case the labels are uncorrelated or weakly correlated this is not a problem.</p>
  <p>T<strong>he second option</strong>  when you have a joint backbone for all classification problems and only, in the end, the computation graph splits into branches solving each of the classification problems seems to be more efficient, and in the case, where these tasks are related to each other, improvement of accuracy in one task is very likely to be beneficial for the other task.</p>
  <p>Overall, the resulting architecture resembles the <a href="https://www.cs.unc.edu/%7Ewliu/papers/GoogLeNet.pdf" rel="nofollow noreferrer">Inception</a> architecture:
  <a href="https://i.sstatic.net/D2YBl.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/D2YBl.png" alt="enter image description here" /></a></p>
  <p>You can try to put all classification heads in the very end, or some can disentagle from the other part of network a bit earlier.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-10-21T18:48:20.560Z
Answers.LastActivityDate: 2021-10-21T18:48:20.560Z
Answers.UserDisplayName: spiridon_the_sun_rotator
Body: <p>I am working on a project consisting of medical images and a huge dataset of multi-label and non-binary labels/outcomes ( sex, blood pressure, age and 40 more ).</p>
  <p>Would be the best approach to hard code all of them or is there some better approach? If this is the best way, does anyone have a similar PyTorch notebook on which I could orientate myself? Or some smart solution how to hard code them automatically?</p>
  <p>Any help is welcome!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-21T15:33:31.873Z
Comments.Text: Is you network supposed to perfrom multilabel-multiclass classification for each training sample?
Comments.UserDisplayName: spiridon_the_sun_rotator
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-10-21T18:24:53.850Z
Comments.Text: Hey! Yes, that is the plan.
Comments.UserDisplayName: Scheuchzeri
Tags: <classification><deep-neural-networks><pytorch>
Title: Multi label classification on non binary labels with pytorch
UserDisplayName: Scheuchzeri
ThreadText: # Multi label classification on non binary labels with pytorch
  
  (Asked by: username_0 on 2021-10-21)
  
  I am working on a project consisting of medical images and a huge dataset of multi-label and non-binary labels/outcomes ( sex, blood pressure, age and 40 more ).
  
  Would be the best approach to hard code all of them or is there some better approach? If this is the best way, does anyone have a similar PyTorch notebook on which I could orientate myself? Or some smart solution how to hard code them automatically?
  
  Any help is welcome!
  
  **Tags:** classification, deep-neural-networks, pytorch
  > **Comments:**
  > **username_1**: Is you network supposed to perfrom multilabel-multiclass classification for each training sample?  
  > **username_0**: Hey! Yes, that is the plan.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2021-10-21. Score: 1
  
  If your goal is to predict given an image multiple labels (each of them can be binary or multi-class) you could consider two strategies:
  
  * Create for each classification task a separate model, which predicts solves only one problem
  * Create a single model with multiple heads
  
  **The first option** seems to be more straightforward, but it would most likely need to consume more memory and computational resources, and the gradient signal from the prediction of one model is independent of other models. In case the labels are uncorrelated or weakly correlated this is not a problem.
  
  T**he second option** when you have a joint backbone for all classification problems and only, in the end, the computation graph splits into branches solving each of the classification problems seems to be more efficient, and in the case, where these tasks are related to each other, improvement of accuracy in one task is very likely to be beneficial for the other task.
  
  Overall, the resulting architecture resembles the [Inception](https://www.cs.unc.edu/%7Ewliu/papers/GoogLeNet.pdf) architecture:
  [![enter image description here](https://i.sstatic.net/D2YBl.png)](https://i.sstatic.net/D2YBl.png)
  
  You can try to put all classification heads in the very end, or some can disentagle from the other part of network a bit earlier.
  
  
  ---
  
  