how do I set my fully connected layer to be (3 or 2) classification output?

1 回表示 (過去 30 日間)
Afiq Amirudin
Afiq Amirudin 2021 年 6 月 16 日
回答済み: Vineet Joshi 2021 年 7 月 19 日
Im working with pretrained network.
Currently, I have 3 age group (17-20, 21-40, 41-60) and another one is (female , male). My question is how to change the fully connected layer for this type of classification.
Currently I had 6 classes, 3 age group for each gender. Therefore, my classification output is 6 classes instead. Is this the correct way to classify?
  1 件のコメント
Afiq Amirudin
Afiq Amirudin 2021 年 6 月 16 日
How to achieve something like this?
and how do my dataset structure should be?

サインインしてコメントする。

回答 (1 件)

Vineet Joshi
Vineet Joshi 2021 年 7 月 19 日
Hi
It is not possible to have one layer with arbitary number of neurons (3 or 2) . Keeping this in mind, there are three ways to approach your problem.
  1. Create 6 labels (3 * 2) and train the network for classification on this problem. Since the number of instances are equal, you should get decent result but ensure to not let the model overfit.
  2. You can have common layers upto a point and then split the network into two halves, one with output of 2 and other with output of 3. You can refer to the following example. Assemble Multiple-Output Network for Prediction
  3. You can also have two seperate networks for both the predictions, but this is just the brute force way of doing the above.
Hope this was of some help.
Thanks

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by