EsraaRagaa opened a new issue #8562: Number of output from the mx.sym.SoftmaxOutput URL: https://github.com/apache/incubator-mxnet/issues/8562 ## I am training a model using CNN to classify images between class 1 and 0, but after prediction, I get number of classes equal to number of nodes in the fully connected layer which precedes the softmax layer # This is the code I use for building the model: data = mx.sym.var('data') conv1 = mx.sym.Convolution(data=data, kernel=(3,3), num_filter=6) relu1 = mx.sym.Activation(data=conv1, act_type="relu") pool1 = mx.sym.Pooling(data=relu1, pool_type="max", kernel=(2,2), stride=(2,2)) conv2 = mx.sym.Convolution(data=pool1, kernel=(6,6), num_filter=12) relu2 = mx.sym.Activation(data=conv2, act_type="relu") pool2 = mx.sym.Pooling(data=relu2, pool_type="max", kernel=(2,2), stride=(2,2)) flatten = mx.sym.flatten(data=pool2) fc1 = mx.symbol.FullyConnected(data=flatten, num_hidden=48) lenet = mx.sym.SoftmaxOutput(data=fc1,name='softmax') lenet_model = mx.mod.Module(symbol=lenet, context=mx.cpu()) lenet_model.fit(train_iterator, ..... num_epoch=10) # The solutions I tried to use to fix the problem: 1- lables = mx.sym.Variable('softmax_label') lenet = mx.sym.SoftmaxOutput(data=fc1,label=lables,name='softmax') * result: did not fix the problem, still after prediciton the number probability coresponding to the classes=48 2- lables = mx.sym.Variable('softmax_label') lenet = mx.sym.SoftmaxOutput(data=fc1,label=lables, preserve_shape=True, name='softmax') * result: did not fix the problem, still after prediciton the number probability coresponding to the classes=48 3- lables = mx.sym.Variable('softmax_label') lenet = mx.sym.SoftmaxOutput(data=fc1,label=lables, preserve_shape=True, multi_output=True, name='softmax') * result: did not fix the problem, still after prediciton the number probability coresponding to the classes=48 4- adding an extra hidden layer after fc1and pass it to the softmax extra_hidden_2nods = mx.symbol.FullyConnected(data=fc1, num_hidden=2) lenet = mx.sym.SoftmaxOutput(data=extra_hidden_2nods, name='softmax') * result: fixed the problem but this is not what I want ## Environment info (Required) I am using the last version of mxnet, python, anaconda Thanks in advance
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services