Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
477 views
in Technique[技术] by (71.8m points)

machine learning - What does it mean to branch the Dense layer for each label in CNN multi-label classification?

I am currently working on a multi-label classification of images with a small number of labels. I am using CNNs to do this, but I have one question. In Kaggle, etc., they use a pre-trained model with 1-2 dense layers for classification, but I think a CNN network for multi-label classification should have a dense layer branch for each label, since it does binary classification of labels. Does it not make sense to do so?

import efficientnet.keras as efn 

base_model = efn.EfficientNetB1(include_top=False, weights='imagenet',input_tensor = Input(shape=(128, 128, 3)))  



x = base_model.output
x = GlobalAveragePooling2D()(x)


x1 = Dense(1024, activation = 'relu')(x)
x1 = Dropout(0.5)(x1)
x1 = Dense(1024, activation = 'relu')(x1)
x1 = Dropout(0.5)(x1)

x2 = Dense(1024, activation = 'relu')(x)
x2 = Dropout(0.5)(x2)
x2 = Dense(1024, activation = 'relu')(x2)
x2 = Dropout(0.5)(x2)

x3 = Dense(1024, activation = 'relu')(x)
x3 = Dropout(0.5)(x3)
x3 = Dense(1024, activation = 'relu')(x3)
x3 = Dropout(0.5)(x3)

x4 = Dense(1024, activation = 'relu')(x)
x4 = Dropout(0.5)(x4)
x4 = Dense(1024, activation = 'relu')(x4)
x4 = Dropout(0.5)(x4)

x5 = Dense(1024, activation = 'relu')(x)
x5 = Dropout(0.5)(x5)
x5 = Dense(1024, activation = 'relu')(x5)
x5 = Dropout(0.5)(x5)

out1 = Dense(1, activation = 'sigmoid')(x1)
out2 = Dense(1, activation = 'sigmoid')(x2)
out3 = Dense(1, activation = 'sigmoid')(x3)
out4 = Dense(1, activation = 'sigmoid')(x4)
out5 = Dense(1, activation = 'sigmoid')(x5)

Thanks for reading. I am waiting for your answer.

question from:https://stackoverflow.com/questions/65661322/what-does-it-mean-to-branch-the-dense-layer-for-each-label-in-cnn-multi-label-cl

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...